aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2008-09-21 21:37:42 +0200
committerMax Kellermann <max@duempel.org>2008-09-21 21:37:42 +0200
commitad98c332ac7551dbf1f99b2c7f5ae60e1009787f (patch)
tree379ac6ed2d99e1775b1bfa6ea55a71c4dbc8aee5 /src
parent13740b3e9977fccebc45a82190088de72c7735fd (diff)
downloadmpd-ad98c332ac7551dbf1f99b2c7f5ae60e1009787f.tar.gz
mpd-ad98c332ac7551dbf1f99b2c7f5ae60e1009787f.tar.xz
mpd-ad98c332ac7551dbf1f99b2c7f5ae60e1009787f.zip
wreadln: adding additional line editing binds
Adding some GNU readline-style binds. These are ^B/^F to move the cursor back/forward, and ^N/^P to go to the next/previous line.
Diffstat (limited to '')
-rw-r--r--src/wreadln.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/wreadln.c b/src/wreadln.c
index ed8ad9a39..dc1dfe867 100644
--- a/src/wreadln.c
+++ b/src/wreadln.c
@@ -33,11 +33,15 @@
#endif
#define KEY_CTRL_A 1
+#define KEY_CTRL_B 2
#define KEY_CTRL_C 3
-#define KEY_CTRL_D 4
+#define KEY_CTRL_D 4
#define KEY_CTRL_E 5
+#define KEY_CTRL_F 6
#define KEY_CTRL_G 7
#define KEY_CTRL_K 11
+#define KEY_CTRL_N 14
+#define KEY_CTRL_P 16
#define KEY_CTRL_U 21
#define KEY_CTRL_Z 26
#define KEY_BCKSPC 8
@@ -251,9 +255,11 @@ _wreadln(WINDOW *w,
return NULL;
case KEY_LEFT:
+ case KEY_CTRL_B:
cursor_move_left(&cursor, &start);
break;
case KEY_RIGHT:
+ case KEY_CTRL_F:
cursor_move_right(&cursor, &start, width, x0, x1, line);
break;
case KEY_HOME:
@@ -291,6 +297,7 @@ _wreadln(WINDOW *w,
}
break;
case KEY_UP:
+ case KEY_CTRL_P:
/* get previous history entry */
if( history && hlist->prev ) {
if( hlist==hcurrent )
@@ -305,6 +312,7 @@ _wreadln(WINDOW *w,
cursor_move_to_eol(&cursor, &start, width, x0, x1, line);
break;
case KEY_DOWN:
+ case KEY_CTRL_N:
/* get next history entry */
if( history && hlist->next ) {
/* get next line */