Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/screen.c @ 1985:0870005f7efc
Add command /iline clear_history
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 27 Mar 2011 13:35:08 +0200 |
parents | 1d8f9135e000 |
children | 7837d5a3f509 |
comparison
equal
deleted
inserted
replaced
1984:b0470ef8669b | 1985:0870005f7efc |
---|---|
3204 "Multi-line mode: line #%d added [%.25s...", num, line); | 3204 "Multi-line mode: line #%d added [%.25s...", num, line); |
3205 } | 3205 } |
3206 | 3206 |
3207 // scr_cmdhisto_addline() | 3207 // scr_cmdhisto_addline() |
3208 // Add a line to the inputLine history | 3208 // Add a line to the inputLine history |
3209 static inline void scr_cmdhisto_addline(char *line) | 3209 static void scr_cmdhisto_addline(char *line) |
3210 { | 3210 { |
3211 int max_histo_lines; | 3211 int max_histo_lines; |
3212 | 3212 |
3213 if (!line || !*line) | 3213 if (!line || !*line) |
3214 return; | 3214 return; |
3227 cmdhisto_nblines--; | 3227 cmdhisto_nblines--; |
3228 } | 3228 } |
3229 | 3229 |
3230 cmdhisto = g_list_append(cmdhisto, g_strdup(line)); | 3230 cmdhisto = g_list_append(cmdhisto, g_strdup(line)); |
3231 cmdhisto_nblines++; | 3231 cmdhisto_nblines++; |
3232 } | |
3233 | |
3234 // scr_cmdhisto_reset() | |
3235 // Reset the inputLine history | |
3236 static void scr_cmdhisto_reset(void) | |
3237 { | |
3238 while (cmdhisto_nblines) { | |
3239 g_free(cmdhisto->data); | |
3240 cmdhisto = g_list_delete_link(cmdhisto, cmdhisto); | |
3241 cmdhisto_nblines--; | |
3242 } | |
3243 cmdhisto_backup[0] = 0; | |
3244 cmdhisto_cur = NULL; | |
3232 } | 3245 } |
3233 | 3246 |
3234 // scr_cmdhisto_prev() | 3247 // scr_cmdhisto_prev() |
3235 // Look for previous line beginning w/ the given mask in the inputLine history | 3248 // Look for previous line beginning w/ the given mask in the inputLine history |
3236 // Returns NULL if none found | 3249 // Returns NULL if none found |
3492 } else { | 3505 } else { |
3493 // Reset history line pointer | 3506 // Reset history line pointer |
3494 cmdhisto_cur = NULL; | 3507 cmdhisto_cur = NULL; |
3495 } | 3508 } |
3496 return 0; | 3509 return 0; |
3510 } | |
3511 | |
3512 // readline_clear_history() | |
3513 // Clear command line history. | |
3514 void readline_clear_history(void) | |
3515 { | |
3516 scr_cmdhisto_reset(); | |
3497 } | 3517 } |
3498 | 3518 |
3499 void readline_cancel_completion(void) | 3519 void readline_cancel_completion(void) |
3500 { | 3520 { |
3501 scr_cancel_current_completion(); | 3521 scr_cancel_current_completion(); |