summaryrefslogtreecommitdiffstats
path: root/src/poem/anthology/alias.rs
diff options
context:
space:
mode:
authorRory Dudley2024-09-28 01:09:03 -0600
committerRory Dudley2024-09-28 01:09:03 -0600
commit4f62017709220bbc6d60f51720f13fe1ecb19058 (patch)
treeeaf42cfa6b199259f35e77912bbc32e4a610b09d /src/poem/anthology/alias.rs
parent2590315b9e5280ca0c69cce35b4f4bea794790d4 (diff)
downloaddwarvish-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/poem/anthology/alias.rs')
0 files changed, 0 insertions, 0 deletions