1
0
mirror of https://gittea.dev/nova/th.git synced 2025-10-22 02:40:15 -04:00

tab completion in search and read_string

This commit is contained in:
nova
2025-08-23 20:58:48 +02:00
parent 0d2310cd7c
commit a0a102e5f6

View File

@@ -143,14 +143,18 @@ int read_string(WINDOW *win, int y, int x, char *str){
if (ch == '\n') { if (ch == '\n') {
err = 0; err = 0;
break; break;
} else if (ch == 27) { /* esc key */ } else if (ch == '\t') { /* tab */
err = 1; memcpy(str + pass, file_current->file_name, strlen(file_current->file_name));
break; mvwaddstr(win, y, x +pass, file_current->file_name);
pass += strlen(file_current->file_name);
} else if (ch == 127) { /* backspace */ } else if (ch == 127) { /* backspace */
if (pass > 0) { if (pass > 0) {
pass--; pass--;
mvwdelch(win, y, pass); mvwdelch(win, y, pass);
} }
} else if (ch == 27) { /* esc key */
err = 1;
break;
} else { } else {
mvwaddch(win, y, x +pass, ch); mvwaddch(win, y, x +pass, ch);
str[pass] = ch; str[pass] = ch;
@@ -782,8 +786,10 @@ void search(){
ch = wgetch(win_b); ch = wgetch(win_b);
if (ch == '\n') { if (ch == '\n') {
break; break;
} else if (ch == 27) { /* esc key */ } else if (ch == '\t') { /* tab */
break; 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 */ } else if (ch == 127) { /* backspace */
mvwdelch(win_b, local_height-1, 1); mvwdelch(win_b, local_height-1, 1);
wdelch(win_b); wdelch(win_b);
@@ -791,6 +797,8 @@ void search(){
search_buffer[pass-1] = '\0'; search_buffer[pass-1] = '\0';
pass--; pass--;
} }
} else if (ch == 27) { /* esc key */
break;
} else { } else {
search_buffer[pass] = ch; search_buffer[pass] = ch;
pass++; pass++;