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