diff options
author | 2019-08-25 09:31:47 -0400 | |
---|---|---|
committer | 2019-08-25 09:31:47 -0400 | |
commit | c7201765391c9d5cdeb737484ed428165f735e4b (patch) | |
tree | 01e3f8fc259e77728ee2137ad9a5225fffd3582f /modules/textadept/editing.lua | |
parent | 0e47dd7dbac02a4da93af5cde406153f4d9a5036 (diff) | |
download | textadept-c7201765391c9d5cdeb737484ed428165f735e4b.tar.gz textadept-c7201765391c9d5cdeb737484ed428165f735e4b.zip |
Do not auto-indent when pressing enter at the start of a non-empty line.
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r-- | modules/textadept/editing.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index 7a7ef3c0..1624ee6d 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -170,6 +170,10 @@ end) events.connect(events.CHAR_ADDED, function(code) if not M.auto_indent or code ~= 10 then return end local line = buffer:line_from_position(buffer.current_pos) + if line > 0 and buffer:get_line(line - 1):find('^[\r\n]+$') and + buffer:get_line(line):find('^[^\r\n]') then + return -- do not auto-indent when pressing enter from start of previous line + end local i = line - 1 while i >= 0 and buffer:get_line(i):find('^[\r\n]+$') do i = i - 1 end if i >= 0 then @@ -625,7 +629,7 @@ function M.show_documentation(pos, case_insensitive) ::lookup:: if symbol ~= '' then local symbol_patt = '^'..symbol:gsub('(%p)', '%%%1') - if case_insensitive then + if case_insensitive then symbol_patt = symbol_patt:gsub('%a', function(ch) return string.format('[%s%s]', ch:upper(), ch:lower()) end) |