[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:26618] less(1) keybindings for textview
From:       "James K. Lowden" <jklowden () schemamania ! org>
Date:       2005-12-22 18:49:30
Message-ID: 20051222134930.629cfea5.jklowden () schemamania ! org
[Download RAW message or body]

Hi, 

I'm still in the dark ages, running 1.0.4, but afaik scrolling text in the
message view window hasn't changed.  

Like a lot of people, I use less(1) to view lots of files, and I've grown
accustomed to using 

	'j' to scroll down a line
	'k' to scroll up a line
	'd' to scroll down a half page
	'u' to scroll up a half page

Looking at the source code confirmed that (as of my version, at least)
these use of Return, Space, and Backspace for these purposes is not
configurable.  As a matter of fact, it was only by looking at the code
that I discovered Shift-Space and Shift-Return are the inverses.  (Whether
that reflects on me, the documentation, or the intuitiveness of the
choices, I leave to you to decide.)  

The attached patch adds these bindings without disturbing the defaults. 
However, because there's no built-in half-page scrolling function, 'd' and
'u' work on whole pages instead.  Good enough to meet the terms of the
contract.  

There is one caveat: the new keys don't work unless the textview widget
has focus.  I'm not sure why, not knowing much about GDK.  Perhaps my
little hack will inspire a more robust solution.  

Regards, 

--jkl


["textview.c.diff" (application/octet-stream)]

--- /tmp/sylpheed-1.0.4/src/textview.c	2005-03-18 00:58:47.000000000 -0500
+++ textview.c	2005-12-22 13:29:07.000000000 -0500
@@ -1540,6 +1540,9 @@
 	case GDK_Control_L:
 	case GDK_Control_R:
 		break;
+	case GDK_d:
+		textview_scroll_page(textview, FALSE);
+		break;
 	case GDK_space:
 		if (summaryview)
 			summary_pass_key_press_event(summaryview, event);
@@ -1549,6 +1552,7 @@
 				 (event->state &
 				  (GDK_SHIFT_MASK|GDK_MOD1_MASK)) != 0);
 		break;
+	case GDK_u:
 	case GDK_BackSpace:
 		textview_scroll_page(textview, TRUE);
 		break;
@@ -1561,6 +1565,11 @@
 		if (summaryview)
 			summary_pass_key_press_event(summaryview, event);
 		break;
+	case GDK_j:
+	case GDK_k:
+		textview_scroll_one_line
+			(textview, event->keyval == GDK_k);
+		break;
 	case GDK_n:
 	case GDK_N:
 	case GDK_p:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic