diff options
author | Rory Dudley | 2024-09-28 01:09:03 -0600 |
---|---|---|
committer | Rory Dudley | 2024-09-28 01:09:03 -0600 |
commit | 4f62017709220bbc6d60f51720f13fe1ecb19058 (patch) | |
tree | eaf42cfa6b199259f35e77912bbc32e4a610b09d /src/recite | |
parent | 2590315b9e5280ca0c69cce35b4f4bea794790d4 (diff) | |
download | dwarvish-4f62017709220bbc6d60f51720f13fe1ecb19058.tar.gz |
Fix Tab/Shift+Tab autocomplete behavior
Previously, switching between Tab and Shift+Tab while cycling through
autocomplete options could temporarily mess up the order of items. This
patch fixes that flaw by adding two new variables to help keep track of
the state:
- 'last', the last key that was recorded by getchar(),
- and 'length', which keeps track of the length of the last buffer
generated by the autocomplete() function.
These variables are then checked first whenever the user uses Tab or
Shift+Tab. The last know buffer 'length' is used to deal with overflow
in the case of Shift+Tab.
Finally, the logic for processing the autocomplete directory was moved
below the code for handling the actual user input (i.e. appending to the
getline() buffer). This is because the last character in the buffer
(i.e. the last character the user typed) is important for properly
updating the autcomplete working directory.
Diffstat (limited to 'src/recite')
0 files changed, 0 insertions, 0 deletions