comparison mcabber/src/screen.c @ 194:a05d5c3876ec

[/trunk] Changeset 206 by mikael * Default group for Jabber agents is "Jabber Agents" * Add backward_kill_word() (bound to Ctrl-w)
author mikael
date Fri, 06 May 2005 19:57:55 +0000
parents 9c2023d60986
children cdaa53d5ef70
comparison
equal deleted inserted replaced
193:5cbdcccfab29 194:a05d5c3876ec
1068 if (strncmp(cmdhisto_backup, mask, len)) return NULL; // No match 1068 if (strncmp(cmdhisto_backup, mask, len)) return NULL; // No match
1069 cmdhisto_cur = NULL; 1069 cmdhisto_cur = NULL;
1070 return cmdhisto_backup; 1070 return cmdhisto_backup;
1071 } 1071 }
1072 1072
1073 // backward_kill_word()
1074 // Kill the word before the cursor, in input line
1075 void backward_kill_word()
1076 {
1077 char *c, *old = ptr_inputline;
1078 int spaceallowed = 1;
1079
1080 if (ptr_inputline == inputLine) return;
1081
1082 for (c = ptr_inputline-1 ; c > inputLine ; c--)
1083 if (!isalnum(*c)) {
1084 if (*c == ' ')
1085 if (!spaceallowed) break;
1086 } else spaceallowed = 0;
1087
1088 if (c != inputLine || *c != ' ')
1089 if ((c < ptr_inputline-1) && (!isalnum(*c)))
1090 c++;
1091
1092 // Modify the line
1093 ptr_inputline = c;
1094 for (;;) {
1095 *c = *old++;
1096 if (!*c++) break;
1097 }
1098 }
1099
1073 // which_row() 1100 // which_row()
1074 // Tells which row our cursor is in, in the command line. 1101 // Tells which row our cursor is in, in the command line.
1075 // -1 -> normal text 1102 // -1 -> normal text
1076 // 0 -> command 1103 // 0 -> command
1077 // 1 -> parameter 1 (etc.) 1104 // 1 -> parameter 1 (etc.)
1327 scr_ScrollUp(); 1354 scr_ScrollUp();
1328 break; 1355 break;
1329 case 14: // Ctrl-n 1356 case 14: // Ctrl-n
1330 scr_ScrollDown(); 1357 scr_ScrollDown();
1331 break; 1358 break;
1359 case 23: // Ctrl-w
1360 backward_kill_word();
1361 check_offset(-1);
1362 break;
1332 case 27: // ESC 1363 case 27: // ESC
1333 currentWindow = NULL; 1364 currentWindow = NULL;
1334 chatmode = FALSE; 1365 chatmode = FALSE;
1335 if (current_buddy) 1366 if (current_buddy)
1336 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE); 1367 buddy_setflags(BUDDATA(current_buddy), ROSTER_FLAG_LOCK, FALSE);