aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-03-17 15:08:26 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2020-03-17 15:08:26 -0400
commit92bf8d4488d50e31b32d593ca78973b557cc8df7 (patch)
tree26dd12465821ddae77f0e7d06918010d98f06d5b /modules
parent573c184b20dac1e8d5d5b659a04a2ea9744d6352 (diff)
Align block comments by column if possible, not indent.
Diffstat (limited to 'modules')
-rw-r--r--modules/textadept/editing.lua3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index bc5d8ffa..3b45cee9 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -319,9 +319,12 @@ function M.block_comment()
local s, e = buffer:line_from_position(anchor), buffer:line_from_position(pos)
local ignore_last_line = s ~= e and pos == buffer:position_from_line(e)
anchor, pos = buffer.line_end_position[s] - anchor, buffer.length - pos
+ local column = math.huge
buffer:begin_undo_action()
for line = s, not ignore_last_line and e or e - 1 do
local p = buffer.line_indent_position[line]
+ column = math.min(buffer.column[p], column)
+ p = buffer:find_column(line, column)
local uncomment = buffer:text_range(p, p + #prefix) == prefix
if not uncomment then
buffer:insert_text(p, prefix)