On Thu, 3 Apr 2025 17:59:52 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:

>> The `java.io.Console` has several backends: a simple on in `java.base`, a 
>> more convenient one in `jdk.internal.le` (with line-reading based on JLine) 
>> and one for JShell.
>> 
>> The backend based on JLine is proving to be a somewhat problematic - JLine 
>> is very powerful, possibly too powerful and complex for the simple task of 
>> editing a line with no completion, no history, no variables, no commands, 
>> etc. As a consequence, there are inevitable sharp edges in this backend.
>> 
>> The idea in this PR is to replace the use of JLine in the `jdk.internal.le` 
>> backend with a simple escape code interpreter, that only handles a handful 
>> of keys/codes (left/right arrow, home, end, delete, backspace, enter), and 
>> ignores the rest. The goal is to have something simple with less surprising 
>> behavior.
>
> Jan Lahoda has updated the pull request incrementally with three additional 
> commits since the last revision:
> 
>  - Using control characters to get backspace control character.
>  - If there's no native library available, fall back to the standard provider.
>  - Reflecting review feedback.

I have updated the PR based on most of the review comments so far:
- removed the unnecessary qualified exports 
(https://github.com/openjdk/jdk/pull/24242/commits/91fa1b28e0436e55eed9cdee07e0e28c25bf666a)
- reduced line lengths 
(https://github.com/openjdk/jdk/pull/24242/commits/91fa1b28e0436e55eed9cdee07e0e28c25bf666a)
- cleaned comments in the C code 
(https://github.com/openjdk/jdk/pull/24242/commits/91fa1b28e0436e55eed9cdee07e0e28c25bf666a)
- cleaned up the makefiles 
(https://github.com/openjdk/jdk/pull/24242/commits/91fa1b28e0436e55eed9cdee07e0e28c25bf666a)
- if the native library (for UNIX) is not available, fall back to the 
simple/default provider (although support for AIX would be great, of course) 
(https://github.com/openjdk/jdk/pull/24242/commits/c6256eeeabfd73e7e67bf7f8c18c337e6bb92534)
- I realized the backspace value can (and should) be read from the terminal as 
a control character, so I did that 
(https://github.com/openjdk/jdk/pull/24242/commits/d5176d68e8cc73914a0efef45a60f0ff03885bcc)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/24242#issuecomment-2776568012

Reply via email to