parent
f6313f23c0
commit
883b8d51e5
|
@ -537,14 +537,17 @@ class CommentRegion(Method):
|
|||
w.input_line = "Empty kill region"
|
||||
return
|
||||
|
||||
commentc = w.mode.commentc or '#'
|
||||
c = w.mode.commentc or '#'
|
||||
lvl = w.buffer.detect_indent_level(p1.y, p2.y) or 0
|
||||
|
||||
x = w.buffer.detect_indent_level(p1.y, p2.y) or 0
|
||||
for y in range(p1.y, p2.y):
|
||||
c = commentc
|
||||
if len(w.buffer.lines[y]) < x:
|
||||
c += ' ' * (x - len(w.buffer.lines[y]))
|
||||
w.buffer.insert_string(Point(x, y), c)
|
||||
if len(w.buffer.lines[y]) < lvl:
|
||||
pad = lvl - len(w.buffer.lines[y])
|
||||
x = lvl - pad
|
||||
else:
|
||||
pad = 0
|
||||
x = lvl
|
||||
w.buffer.insert_string(Point(x, y), ' ' * pad + c)
|
||||
|
||||
class UncommentRegion(Method):
|
||||
'''Remove a comment from every line in the current buffer'''
|
||||
|
@ -806,17 +809,11 @@ class JustifyLeft(Method):
|
|||
class Undo(Method):
|
||||
'''Undo last action'''
|
||||
def _execute(self, w, **vargs):
|
||||
try:
|
||||
w.undo()
|
||||
except Exception, e:
|
||||
w.set_error("%s" % (e))
|
||||
w.undo()
|
||||
class Redo(Method):
|
||||
'''Redo last undone action'''
|
||||
def _execute(self, w, **vargs):
|
||||
try:
|
||||
w.redo()
|
||||
except Exception, e:
|
||||
w.set_error("%s" % (e))
|
||||
w.redo()
|
||||
|
||||
class UnindentBlock(Method):
|
||||
'''Prepend a tab of space to each line in region'''
|
||||
|
|
Loading…
Reference in New Issue