summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2019-06-06 04:57:52 +0900
committeraycabta <aycabta@gmail.com>2019-06-06 04:57:52 +0900
commit02880d1f4a9ebd1c0a807376fcb25ccd908334b4 (patch)
tree08420a2ab7cfe3737c9fde4c35ade5d4fb9a36e6 /lib
parentfd173372285f9575e424f854d8072b5f71fce1e2 (diff)
Skip transpose-words if less than 2 word
Diffstat (limited to 'lib')
-rw-r--r--lib/reline/line_editor.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/reline/line_editor.rb b/lib/reline/line_editor.rb
index 568cea8bd4..c5f00c28dc 100644
--- a/lib/reline/line_editor.rb
+++ b/lib/reline/line_editor.rb
@@ -1418,6 +1418,7 @@ class Reline::LineEditor
middle = @line.byteslice(middle_start, right_word_start - middle_start)
right_word = @line.byteslice(right_word_start, after_start - right_word_start)
after = @line.byteslice(after_start, @line.bytesize - after_start)
+ return if left_word.empty? or right_word.empty?
@line = before + right_word + middle + left_word + after
from_head_to_left_word = before + right_word + middle + left_word
@byte_pointer = from_head_to_left_word.bytesize