Fix tab completion EOFError for Windows paths ending with backslash - #1366
Open
arimu1 wants to merge 1 commit into
Open
Fix tab completion EOFError for Windows paths ending with backslash#1366arimu1 wants to merge 1 commit into
arimu1 wants to merge 1 commit into
Conversation
Do not throw EOFError for escaped newlines (or unclosed quotes) when parsing in COMPLETE/SPLIT_LINE context, matching JLine DefaultParser. Also disable backslash escapes on Windows where '\' is the path separator, and implement CompletingParsedLine properly so completion candidates are escaped/quoted. Fixes spring-projects#1169 Signed-off-by: arimu1 <19286898+arimu1@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Tab completion of Windows paths (PowerShell/CMD) failed with:
\is both the JLine/DefaultParser escape character and the Windows path separator. Completing a directory inserts a trailing\, and the next Tab hiteofOnEscapedNewLineeven inParseContext.COMPLETE.Changes
EOFErrorfor escaped newlines / unclosed quotes when context isCOMPLETEorSPLIT_LINE(parity with JLineDefaultParser).org.jline.reader.CompletingParsedLineproperly (escape,rawWordCursor,rawWordLength) instead of a no-op wrap.DefaultJLineShellConfiguration,JLineShellAutoConfiguration): setescapeCharstonullwhenFile.separatorChar == '\\'so multi-level Windows path completion keeps backslashes.Testing
./mvnw -pl spring-shell-jline -am test -Dtest=ExtendedDefaultParserTests -Dsurefire.failIfNoSpecifiedTests=false38 tests, Temurin 21. New coverage for COMPLETE trailing
\, ACCEPT_LINE still throws, Windows-style paths with escapes disabled, and CompletingParsedLine escaping.Fixes #1169