aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/ungrammar
diff options
context:
space:
mode:
authorMichael Davis2022-11-17 01:00:48 +0000
committerGitHub2022-11-17 01:00:48 +0000
commitc6b83368b3b626cb63120b5ac684cc8b1b693172 (patch)
treef14721ce897e1e525e63c384b2fa46fbef141ae4 /runtime/queries/ungrammar
parentb474ee1843d5cb7cb5291bee4166490a223e5aac (diff)
Capture word parts while calculating shellwords (#4632)
This fixes an edge case for completing shellwords. With a file "a b.txt" in the current directory, the sequence `:open a\<tab>` will result in the prompt containing `:open aa\ b.txt`. This is because the length of the input which is trimmed when replacing with completion is calculated on the part of the input which is parsed by shellwords and then escaped (in a separate operation), which is lossy. In this case it loses the trailing backslash. The fix provided here refactors shellwords to track both the _words_ (shellwords with quotes and escapes resolved) and the _parts_ (chunks of the input which turned into each word, with separating whitespace removed). When calculating how much of the input to delete when replacing with the completion item, we now use the length of the last part. This also allows us to eliminate the duplicate work done in the `ends_with_whitespace` check.
Diffstat (limited to 'runtime/queries/ungrammar')
0 files changed, 0 insertions, 0 deletions