Termux improvement: toggle nav-as-you-type

2 changes:
- Toggle nav-as-you-type with left single/double click below last entry
- Handle mouse events when filter is on
This commit is contained in:
Arun Prakash Jana 2019-07-12 22:28:44 +05:30
parent 713eed0a21
commit bfc8d0a7d3
No known key found for this signature in database
GPG Key ID: A75979F35C080412
2 changed files with 20 additions and 4 deletions

View File

@ -267,8 +267,9 @@ Note: Help & settings, file details, media info and archive listing are shown in
|---| --- |
| Left single on context number | Visit context |
| Left single on top row after context numbers | Visit parent |
| Left single/double after last entry | Toggle nav-as-you-type |
| Left single | Select context or entry |
| Left double | Select context or open file/directory |
| Left double | Select context or open entry |
##### Leader key

View File

@ -1696,6 +1696,7 @@ static int filterentries(char *path)
printprompt(ln);
continue;
case KEY_MOUSE: // fallthrough
case 27: /* Exit filter mode on Escape */
if (len == 1)
cur = oldcur;
@ -3392,13 +3393,27 @@ nochange:
}
#endif
/* Handle clicking on a file */
if (2 <= event.y && event.y < xlines - 2) {
if (2 <= event.y && event.y < xlines - 2)
r = curscroll + (event.y - 2);
if (r >= ndents)
/* Toggle filter mode on left click on last line */
if (event.y >= xlines - 2 || r >= ndents) {
cfg.filtermode ^= 1;
if (cfg.filtermode) {
presel = FILTER;
goto nochange;
}
/* Start watching the directory */
dir_changed = TRUE;
if (ndents)
copycurname();
goto begin;
}
/* Handle clicking on a file */
if (2 <= event.y && event.y < xlines - 2) {
move_cursor(r, 1);
/*Single click just selects, double click also opens */