From 92bf8d4488d50e31b32d593ca78973b557cc8df7 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 17 Mar 2020 15:08:26 -0400 Subject: Align block comments by column if possible, not indent. --- modules/textadept/editing.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules') 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) -- cgit v1.2.3