aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/editing.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r--modules/textadept/editing.lua6
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)