improvements and whatnot

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-04-01 18:35:09 +00:00
parent 99645692d4
commit d2fca5279c
3 changed files with 29 additions and 10 deletions

View File

@ -182,6 +182,19 @@ class OverwriteChar(Method):
self.char = c
def _execute(self, w, **vargs):
w.overwrite_char_at_cursor(self.char)
class InsertText(Method):
'''Insert literal text into the buffer'''
args = [arg('text', t="string", p="Literal: ", h='Literal text to insert')]
def _execute(self, w, **vargs):
w.insert_string_at_cursor(vargs['text'])
class InsertText2(Method):
'''Insert escaped text into the buffer'''
args = [arg('text', t="string", p="Text: ", h='Text to insert')]
def _execute(self, w, **vargs):
text = vargs['text'].replace('\\n', '\n')
text = text.replace('\\t', ' ')
text = text.replace('\\\\', '\\')
w.insert_string_at_cursor(text)
# killing/copying/etc.
class Kill(Method):
@ -388,14 +401,6 @@ class InsertDquotes(Method):
def _execute(self, w, **vargs):
w.insert_string_at_cursor('""')
w.backward()
class InsertEscapedSquote(Method):
'''Insert an escaped single-quote'''
def _execute(self, w, **vargs):
w.insert_string_at_cursor("\\'")
class InsertEscapedDquote(Method):
'''Insert an escaped double-quote'''
def _execute(self, w, **vargs):
w.insert_string_at_cursor('\\"')
class InsertTab(Method):
'''Insert tab into buffer, or tabbify line, depending on mode'''

View File

@ -187,8 +187,6 @@ class Fundamental(Handler):
self.add_bindings('view-buffer-parent', ('C-c .',))
self.add_bindings('insert-squotes', ('M-\'',))
self.add_bindings('insert-dquotes', ('M-"',))
self.add_bindings('insert-escaped-squote', ('C-c M-\'',))
self.add_bindings('insert-escaped-dquote', ('C-c M-"',))
self.add_bindings('get-token', ('C-c t',))
# create all the insert actions for the basic text input

View File

@ -215,6 +215,8 @@ class Python(mode.Fundamental):
self.add_action_and_bindings(PythonGotoFunction(), ('C-c M-g',))
self.add_action_and_bindings(PythonCheckSyntax(), ('C-c s',))
self.add_action_and_bindings(PythonDictCleanup(), ('C-c h',))
self.add_action_and_bindings(PythonInsertTripleSquotes(), ('C-c M-\'',))
self.add_action_and_bindings(PythonInsertTripleDquotes(), ('C-c M-"',))
# other python
self.functions = None
def build_function_map(self):
@ -373,4 +375,18 @@ class PythonDictCleanup(method.Method):
w.kill(start_p, end_p)
w.insert_string(start_p, data)
class PythonInsertTripleSquotes(method.Method):
'''Insert a triple-quoted string using single-quotes'''
def _execute(self, w, **vargs):
w.insert_string_at_cursor("''''''")
for i in range(0, 3):
w.backward()
class PythonInsertTripleDquotes(method.Method):
'''Insert a triple-quoted string using double-quotes'''
def _execute(self, w, **vargs):
w.insert_string_at_cursor('""""""')
for i in range(0, 3):
w.backward()
install = Python.install