Archive of RubyForge sup-talk mailing list
 help / color / mirror / Atom feed
* [sup-talk] [PATCH] Vi-style scroll keys
@ 2008-04-24  0:43 Marc Hartstein
  2008-04-24  0:43 ` [sup-talk] [PATCH] Fixes alignment when printing help screen if \C-x is bound Marc Hartstein
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Hartstein @ 2008-04-24  0:43 UTC (permalink / raw)


Adds ^f/^b ^d/^u ^e/^y keybindings to scroll-mode.
---
 lib/sup/modes/scroll-mode.rb |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/sup/modes/scroll-mode.rb b/lib/sup/modes/scroll-mode.rb
index 922bf92..2d70fef 100644
--- a/lib/sup/modes/scroll-mode.rb
+++ b/lib/sup/modes/scroll-mode.rb
@@ -15,12 +15,14 @@ class ScrollMode < Mode
   COL_JUMP = 2
 
   register_keymap do |k|
-    k.add :line_down, "Down one line", :down, 'j', 'J'
-    k.add :line_up, "Up one line", :up, 'k', 'K'
+    k.add :line_down, "Down one line", :down, 'j', 'J', "\C-e"
+    k.add :line_up, "Up one line", :up, 'k', 'K', "\C-y"
     k.add :col_left, "Left one column", :left, 'h'
     k.add :col_right, "Right one column", :right, 'l'
-    k.add :page_down, "Down one page", :page_down, ' '
-    k.add :page_up, "Up one page", :page_up, 'p', :backspace
+    k.add :page_down, "Down one page", :page_down, ' ', "\C-f"
+    k.add :page_up, "Up one page", :page_up, 'p', :backspace, "\C-b"
+    k.add :half_page_down, "Down one half page", "\C-d"
+    k.add :half_page_up, "Up one half page", "\C-u"
     k.add :jump_to_start, "Jump to top", :home, '^', '1'
     k.add :jump_to_end, "Jump to bottom", :end, '$', '0'
     k.add :jump_to_left, "Jump to the left", '['
@@ -130,6 +132,8 @@ class ScrollMode < Mode
   def line_up;  jump_to_line @topline - 1; end
   def page_down; jump_to_line @topline + buffer.content_height - @slip_rows; end
   def page_up; jump_to_line @topline - buffer.content_height + @slip_rows; end
+  def half_page_down; jump_to_line @topline + buffer.content_height / 2; end
+  def half_page_up; jump_to_line @topline - buffer.content_height / 2; end
   def jump_to_start; jump_to_line 0; end
   def jump_to_end; jump_to_line lines - buffer.content_height; end
 
-- 
1.5.3.7



^ permalink raw reply	[flat|nested] 2+ messages in thread

* [sup-talk] [PATCH] Fixes alignment when printing help screen if \C-x is bound.
  2008-04-24  0:43 [sup-talk] [PATCH] Vi-style scroll keys Marc Hartstein
@ 2008-04-24  0:43 ` Marc Hartstein
  0 siblings, 0 replies; 2+ messages in thread
From: Marc Hartstein @ 2008-04-24  0:43 UTC (permalink / raw)


Width calculations were getting off by one, causing truncated definitions.
---
 lib/sup/keymap.rb |    8 +-------
 1 files changed, 1 insertions(+), 7 deletions(-)

diff --git a/lib/sup/keymap.rb b/lib/sup/keymap.rb
index 3176415..080e11d 100644
--- a/lib/sup/keymap.rb
+++ b/lib/sup/keymap.rb
@@ -43,16 +43,10 @@ class Keymap
     when :home: "<home>"
     when :end: "<end>"
     when :enter, :return: "<enter>"
-    when :ctrl_l: "ctrl-l"
-    when :ctrl_g: "ctrl-g"
     when :tab: "tab"
     when " ": "<space>"
     else
-      if k.is_a?(String) && k.length == 1
-        k
-      else
-        raise ArgumentError, "unknown key name \"#{k}\""
-      end
+      Curses::keyname(keysym_to_keycode k)
     end
   end
 
-- 
1.5.3.7



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-04-24  0:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-24  0:43 [sup-talk] [PATCH] Vi-style scroll keys Marc Hartstein
2008-04-24  0:43 ` [sup-talk] [PATCH] Fixes alignment when printing help screen if \C-x is bound Marc Hartstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox