aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/textadept/editing.lua2
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)