diff options
author | 2013-06-20 10:23:03 -0400 | |
---|---|---|
committer | 2013-06-20 10:23:03 -0400 | |
commit | 6289bf7642c9b8365ab2e33d63c68239857e7d1b (patch) | |
tree | 144152ab774af327a64e671b1525c47a6c18ae50 /modules/textadept/editing.lua | |
parent | 162cafd9e5cd973f313489d8b869664376783e7a (diff) | |
download | textadept-6289bf7642c9b8365ab2e33d63c68239857e7d1b.tar.gz textadept-6289bf7642c9b8365ab2e33d63c68239857e7d1b.zip |
Fixed crash when transposing in empty buffer; modules/textadept/editing.lua
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r-- | modules/textadept/editing.lua | 2 |
1 files changed, 1 insertions, 1 deletions
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) |