mirror of
https://gittea.dev/nova/th.git
synced 2025-10-21 10:20:15 -04:00
tab completion in search and read_string
This commit is contained in:
@@ -143,14 +143,18 @@ int read_string(WINDOW *win, int y, int x, char *str){
|
||||
if (ch == '\n') {
|
||||
err = 0;
|
||||
break;
|
||||
} else if (ch == 27) { /* esc key */
|
||||
err = 1;
|
||||
break;
|
||||
} else if (ch == '\t') { /* tab */
|
||||
memcpy(str + pass, file_current->file_name, strlen(file_current->file_name));
|
||||
mvwaddstr(win, y, x +pass, file_current->file_name);
|
||||
pass += strlen(file_current->file_name);
|
||||
} else if (ch == 127) { /* backspace */
|
||||
if (pass > 0) {
|
||||
pass--;
|
||||
mvwdelch(win, y, pass);
|
||||
}
|
||||
} else if (ch == 27) { /* esc key */
|
||||
err = 1;
|
||||
break;
|
||||
} else {
|
||||
mvwaddch(win, y, x +pass, ch);
|
||||
str[pass] = ch;
|
||||
@@ -782,8 +786,10 @@ void search(){
|
||||
ch = wgetch(win_b);
|
||||
if (ch == '\n') {
|
||||
break;
|
||||
} else if (ch == 27) { /* esc key */
|
||||
break;
|
||||
} else if (ch == '\t') { /* tab */
|
||||
memcpy(search_buffer, file_current->file_name, strlen(file_current->file_name));
|
||||
mvwaddstr(win_b, local_height-1, pass, file_current->file_name);
|
||||
pass = strlen(file_current->file_name);
|
||||
} else if (ch == 127) { /* backspace */
|
||||
mvwdelch(win_b, local_height-1, 1);
|
||||
wdelch(win_b);
|
||||
@@ -791,6 +797,8 @@ void search(){
|
||||
search_buffer[pass-1] = '\0';
|
||||
pass--;
|
||||
}
|
||||
} else if (ch == 27) { /* esc key */
|
||||
break;
|
||||
} else {
|
||||
search_buffer[pass] = ch;
|
||||
pass++;
|
||||
|
Reference in New Issue
Block a user