Mercurial > ~mikael > mcabber > hg
comparison mcabber/src/screen.c @ 174:6354625e8fb2
[/trunk] Changeset 186 by mikael
* Fix a bug in scr_cmdhisto_next()
* Backup current line when moving to the command history lines
author | mikael |
---|---|
date | Thu, 05 May 2005 06:17:41 +0000 |
parents | 09e24917059d |
children | 7b7dd6d69f58 |
comparison
equal
deleted
inserted
replaced
173:09e24917059d | 174:6354625e8fb2 |
---|---|
41 static window_entry_t *currentWindow; | 41 static window_entry_t *currentWindow; |
42 | 42 |
43 static int chatmode; | 43 static int chatmode; |
44 int update_roster; | 44 int update_roster; |
45 | 45 |
46 static char inputLine[INPUTLINE_LENGTH+1]; | 46 static char inputLine[INPUTLINE_LENGTH+1]; |
47 static char *ptr_inputline; | 47 static char *ptr_inputline; |
48 static short int inputline_offset; | 48 static short int inputline_offset; |
49 static int completion_started; | 49 static int completion_started; |
50 static GList *cmdhisto; | 50 static GList *cmdhisto; |
51 static GList *cmdhisto_cur; | 51 static GList *cmdhisto_cur; |
52 static char cmdhisto_backup[INPUTLINE_LENGTH+1]; | |
52 | 53 |
53 | 54 |
54 /* Functions */ | 55 /* Functions */ |
55 | 56 |
56 int scr_WindowWidth(WINDOW * win) | 57 int scr_WindowWidth(WINDOW * win) |
968 const char *scr_cmdhisto_prev(char *mask, guint len) | 969 const char *scr_cmdhisto_prev(char *mask, guint len) |
969 { | 970 { |
970 GList *hl; | 971 GList *hl; |
971 if (!cmdhisto_cur) { | 972 if (!cmdhisto_cur) { |
972 hl = g_list_last(cmdhisto); | 973 hl = g_list_last(cmdhisto); |
974 if (hl) { // backup current line | |
975 strncpy(cmdhisto_backup, mask, INPUTLINE_LENGTH); | |
976 } | |
973 } else { | 977 } else { |
974 hl = g_list_previous(cmdhisto_cur); | 978 hl = g_list_previous(cmdhisto_cur); |
975 } | 979 } |
976 while (hl) { | 980 while (hl) { |
977 if (!strncmp((char*)hl->data, mask, len)) { | 981 if (!strncmp((char*)hl->data, mask, len)) { |
995 if (!strncmp((char*)hl->data, mask, len)) { | 999 if (!strncmp((char*)hl->data, mask, len)) { |
996 // Found a match | 1000 // Found a match |
997 cmdhisto_cur = hl; | 1001 cmdhisto_cur = hl; |
998 return (const char*)hl->data; | 1002 return (const char*)hl->data; |
999 } | 1003 } |
1000 return NULL; | 1004 if (strncmp(cmdhisto_backup, mask, len)) |
1005 return NULL; | |
1006 cmdhisto_cur = NULL; | |
1007 return cmdhisto_backup; | |
1001 } | 1008 } |
1002 | 1009 |
1003 // which_row() | 1010 // which_row() |
1004 // Tells which row our cursor is in, in the command line. | 1011 // Tells which row our cursor is in, in the command line. |
1005 // -1 -> normal text | 1012 // -1 -> normal text |