Skip to content

Fix tab completion EOFError for Windows paths ending with backslash - #1366

Open
arimu1 wants to merge 1 commit into
spring-projects:mainfrom
arimu1:fix/1169-powershell-tab-completion-eof
Open

Fix tab completion EOFError for Windows paths ending with backslash#1366
arimu1 wants to merge 1 commit into
spring-projects:mainfrom
arimu1:fix/1169-powershell-tab-completion-eof

Conversation

@arimu1

@arimu1 arimu1 commented Aug 7, 2026

Copy link
Copy Markdown

Description

Tab completion of Windows paths (PowerShell/CMD) failed with:

org.jline.reader.EOFError: Escaped new line
  at ExtendedDefaultParser.parse(...)

\ is both the JLine/DefaultParser escape character and the Windows path separator. Completing a directory inserts a trailing \, and the next Tab hit eofOnEscapedNewLine even in ParseContext.COMPLETE.

Changes

  • ExtendedDefaultParser: skip EOFError for escaped newlines / unclosed quotes when context is COMPLETE or SPLIT_LINE (parity with JLine DefaultParser).
  • ExtendedArgumentList: implement org.jline.reader.CompletingParsedLine properly (escape, rawWordCursor, rawWordLength) instead of a no-op wrap.
  • Parser beans (DefaultJLineShellConfiguration, JLineShellAutoConfiguration): set escapeChars to null when File.separatorChar == '\\' so multi-level Windows path completion keeps backslashes.

Testing

./mvnw -pl spring-shell-jline -am test -Dtest=ExtendedDefaultParserTests -Dsurefire.failIfNoSpecifiedTests=false

38 tests, Temurin 21. New coverage for COMPLETE trailing \, ACCEPT_LINE still throws, Windows-style paths with escapes disabled, and CompletingParsedLine escaping.

Fixes #1169

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tab auto-completion in PowerShell fails with EOFError: Escaped new line

1 participant