aboutsummaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2004-05-07 07:49:06 +0000
committerKalle Wallin <kaw@linux.se>2004-05-07 07:49:06 +0000
commitab032e2b5a5499f783c034eeb64a1dd3f3387a1c (patch)
tree5257e42a079672a44aacfd6236e907a067294df9 /command.c
parentb4983deb8e8efac613d4d1ec4c73235b35b5139b (diff)
downloadmpd-ab032e2b5a5499f783c034eeb64a1dd3f3387a1c.tar.gz
mpd-ab032e2b5a5499f783c034eeb64a1dd3f3387a1c.tar.xz
mpd-ab032e2b5a5499f783c034eeb64a1dd3f3387a1c.zip
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
Diffstat (limited to 'command.c')
-rw-r--r--command.c19
1 files changed, 16 insertions, 3 deletions
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;
}