From 6289bf7642c9b8365ab2e33d63c68239857e7d1b Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 20 Jun 2013 10:23:03 -0400 Subject: Fixed crash when transposing in empty buffer; modules/textadept/editing.lua --- modules/textadept/editing.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/textadept/editing.lua') diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index e28cbbc9..8aac38b7 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -335,7 +335,7 @@ end function M.transpose_chars() local pos, char = buffer.current_pos, buffer.char_at[buffer.current_pos] local eol = char == 10 or char == 13 or pos == buffer.length - if eol then pos = pos - 1 end + if eol and pos > 0 then pos = pos - 1 end buffer.target_start, buffer.target_end = pos - 1, pos + 1 buffer:replace_target(buffer:text_range(pos - 1, pos + 1):reverse()) buffer:goto_pos(pos + 1) -- cgit v1.2.3