From ab032e2b5a5499f783c034eeb64a1dd3f3387a1c Mon Sep 17 00:00:00 2001 From: Kalle Wallin Date: Fri, 7 May 2004 07:49:06 +0000 Subject: Added support for moving songs in a playlist (move-up,move-down). git-svn-id: https://svn.musicpd.org/ncmpc/trunk@936 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- command.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'command.c') diff --git a/command.c b/command.c index f900f3733..1e9edcd0d 100644 --- a/command.c +++ b/command.c @@ -57,6 +57,7 @@ extern void screen_resize(void); #define F5 KEY_F(5) #define F6 KEY_F(6) + static command_definition_t cmds[] = { { { 13, 0, 0 }, CMD_PLAY, "play", @@ -101,6 +102,11 @@ static command_definition_t cmds[] = { { 'S', 0, 0 }, CMD_SAVE_PLAYLIST, "save", "Save playlist" }, + { { 0, 0, 0 }, CMD_LIST_MOVE_UP, "move-up", + "Move item up" }, + { { 0, 0, 0 }, CMD_LIST_MOVE_DOWN, "move-down", + "Move item down" }, + { { UP, ',', 0 }, CMD_LIST_PREVIOUS, "up", "Move cursor up" }, { { DWN, '.', 0 }, CMD_LIST_NEXT, "down", @@ -157,7 +163,7 @@ get_command_definitions(void) char * key2str(int key) { - static char buf[4]; + static char buf[32]; int i; buf[0] = 0; @@ -201,10 +207,17 @@ key2str(int key) for(i=0; i<=63; i++) if( key==KEY_F(i) ) { - snprintf(buf, 4, "F%d", i ); + snprintf(buf, 32, "F%d", i ); return buf; } - snprintf(buf, 4, "%c", key); + if( !(key & ~037) ) + snprintf(buf, 32, "Ctrl-%c", 'A'+(key & 037)-1 ); + else if( (key & ~037) == 224 ) + snprintf(buf, 32, "Alt-%c", 'A'+(key & 037)-1 ); + else if( key>32 && key<256 ) + snprintf(buf, 32, "%c", key); + else + snprintf(buf, 32, "0x%03X", key); } return buf; } -- cgit v1.2.3