new string methods

--HG--
branch : pmacs2
This commit is contained in:
moculus 2008-02-27 07:33:24 +00:00
parent ec2d1ab3ea
commit eff5bef2bb
2 changed files with 23 additions and 0 deletions

View File

@ -1427,6 +1427,25 @@ class SomethingCrazy(Method):
def _execute(self, w, **vargs):
pass
class InsertSquotes(Method):
'''Insert a pair of single-quotes into the buffer'''
def _execute(self, w, **vargs):
w.insert_string_at_cursor("''")
w.backward()
class InsertDquotes(Method):
'''Insert a pair of double-quotes into the buffer'''
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 CloseTag(Method):
mytag = ')'
def _execute(self, w, **vargs):

View File

@ -179,6 +179,10 @@ class Fundamental(Handler):
self.add_bindings('grep', ('C-c g',))
self.add_bindings('pipe', ('C-c p',))
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-"',))
# unbound actions
self.add_action(method.GetToken())