]> git.cworth.org Git - sup/commitdiff
make left/h and right/l have the same behavior in edit-message-mode
authorwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Fri, 14 Dec 2007 00:54:04 +0000 (00:54 +0000)
committerwmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Fri, 14 Dec 2007 00:54:04 +0000 (00:54 +0000)
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@769 5c8cc53c-5e98-4d25-b20a-d8db53a31250

lib/sup/modes/edit-message-mode.rb

index 3df3176f924ac0b0ccf525adc41b6ce2acdcd059..cdfee01a6431fd0d52281151a0f183a58667caf9 100644 (file)
@@ -50,8 +50,8 @@ EOS
     k.add :save_as_draft, "Save as draft", 'P'
     k.add :attach_file, "Attach a file", 'a'
     k.add :delete_attachment, "Delete an attachment", 'd'
-    k.add :move_cursor_right, "Move selector to the right", :right
-    k.add :move_cursor_left, "Move selector to the left", :left
+    k.add :move_cursor_right, "Move selector to the right", :right, 'l'
+    k.add :move_cursor_left, "Move selector to the left", :left, 'h'
   end
 
   def initialize opts={}
@@ -163,15 +163,21 @@ EOS
 protected
 
   def move_cursor_left
-    return unless curpos < @selectors.length
-    @selectors[curpos].roll_left
-    buffer.mark_dirty
+    if curpos < @selectors.length
+      @selectors[curpos].roll_left
+      buffer.mark_dirty
+    else
+      col_left
+    end
   end
 
   def move_cursor_right
-    return unless curpos < @selectors.length
-    @selectors[curpos].roll_right
-    buffer.mark_dirty
+    if curpos < @selectors.length
+      @selectors[curpos].roll_right
+      buffer.mark_dirty
+    else
+      col_right
+    end
   end
 
   def add_selector s