mirror of
https://github.com/dvorka/hstr.git
synced 2025-02-24 14:57:35 +08:00
Adding removal also in history selection.
This commit is contained in:
parent
2ff78a02cf
commit
f9b90b3f2b
1 changed files with 15 additions and 0 deletions
15
src/hstr.c
15
src/hstr.c
|
@ -207,6 +207,19 @@ void color_attr_off(int c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void selection_remove(char *cmd, HistoryItems *history) {
|
||||||
|
if(history->count) {
|
||||||
|
int i, w, count;
|
||||||
|
for(i=0, w=0; i<history->count; i++) {
|
||||||
|
if(strcmp(history->items[i], cmd)) {
|
||||||
|
history->items[w]=history->items[i];
|
||||||
|
w++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
history->count=w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *selection_loop(HistoryItems *history) {
|
char *selection_loop(HistoryItems *history) {
|
||||||
initscr();
|
initscr();
|
||||||
color_start();
|
color_start();
|
||||||
|
@ -243,6 +256,8 @@ char *selection_loop(HistoryItems *history) {
|
||||||
if(selectionCursorPosition!=SELECTION_CURSOR_IN_PROMPT) {
|
if(selectionCursorPosition!=SELECTION_CURSOR_IN_PROMPT) {
|
||||||
delete=selection[selectionCursorPosition];
|
delete=selection[selectionCursorPosition];
|
||||||
deleteOccurences=history_mgmt_remove(delete);
|
deleteOccurences=history_mgmt_remove(delete);
|
||||||
|
selection_remove(delete, history);
|
||||||
|
result = print_selection(stdscr, maxHistoryItems, prefix, history);
|
||||||
print_cmd_deleted_label(stdscr, delete, deleteOccurences);
|
print_cmd_deleted_label(stdscr, delete, deleteOccurences);
|
||||||
move(y, basex+strlen(prefix));
|
move(y, basex+strlen(prefix));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue