Visitar URL original
[consoleui] Make prompts work in non-fullscreen mode by gnodet · Pull Request #1283 · jline/jline3 · GitHub
Skip to content

[consoleui] Make prompts work in non-fullscreen mode - #1283

Merged
gnodet merged 2 commits into
jline:masterfrom
gnodet:fix-1239-non-fullscreen-prompts
May 22, 2025
Merged

gnodet merged 2 commits into
jline:masterfrom
gnodet:fix-1239-non-fullscreen-prompts

Conversation

@gnodet

@gnodet gnodet commented May 21, 2025

Copy link
Copy Markdown
Member

This change fixes issue #1239 by removing the use of alternate screen buffer
(enter_ca_mode/exit_ca_mode) in the ConsolePrompt class. This allows the
consoleui component to create UIs in the default buffer instead of always
switching to full screen mode in the secondary buffer.

Key changes:

  • Remove terminal.puts(InfoCmp.Capability.enter_ca_mode) from open()
  • Remove terminal.puts(InfoCmp.Capability.exit_ca_mode) from close()
  • Pass Display instance through the AbstractPrompt hierarchy
  • Simplify resetDisplay() method to avoid recreating the Display instance
  • Add UP/DOWN key bindings to InputValuePrompt

This makes consoleui more suitable for CLI commands that need a nice interface
without taking over the entire terminal.

This change fixes issue jline#1239 by removing the use of alternate screen buffer
(enter_ca_mode/exit_ca_mode) in the ConsolePrompt class. This allows the
consoleui component to create UIs in the default buffer instead of always
switching to full screen mode in the secondary buffer.

Key changes:
- Remove terminal.puts(InfoCmp.Capability.enter_ca_mode) from open()
- Remove terminal.puts(InfoCmp.Capability.exit_ca_mode) from close()
- Pass Display instance through the AbstractPrompt hierarchy
- Simplify resetDisplay() method to avoid recreating the Display instance
- Do not call reset() when refreshing the display
- Do not redisplay the results and only print a newline at the end
- Add UP/DOWN key bindings to InputValuePrompt

This makes consoleui more suitable for CLI commands that need a nice interface
without taking over the entire terminal.
@gnodet
gnodet force-pushed the fix-1239-non-fullscreen-prompts branch from ffde3d8 to 3947ebb Compare May 21, 2025 09:54
@gnodet

gnodet commented May 21, 2025

Copy link
Copy Markdown
Member Author

@quintesse do you want to give it a try ?

@gnodet gnodet self-assigned this May 21, 2025
@gnodet gnodet added this to the 3.30.3 milestone May 21, 2025
@quintesse

Copy link
Copy Markdown
Contributor

@gnodet definitely! Hopefully I can find some time today 👍

@quintesse

Copy link
Copy Markdown
Contributor

The first thing I can tell is that db37cee seems to have broken the rebuild.bat. If I type ./build rebuild it tries to execute call mvnw.cmd clean install rebuild which fails because of the extra argument at the end.

@quintesse

Copy link
Copy Markdown
Contributor

Also the ( and ) in lines like this https://github.com/jline/jline3/blob/master/build.bat#L68 mess with the if-statement ( and ), you have to escape them like ^( and ^).

So after running the build manually and this fix I can run the demo.

@quintesse

quintesse commented May 21, 2025 •

Copy link
Copy Markdown
Contributor

Everything looks to work fine, except perhaps for a lack of "cleanup" of the last cancelled prompt, like this:

image

Edit: just tried a simple test to see if it's an issue with cancelled lists, but no it really has to do with the last item being cancelled and exiting the prompt. Eg. if I swap the first two questions I get:

image

@gnodet

gnodet commented May 22, 2025

Copy link
Copy Markdown
Member Author

Everything looks to work fine, except perhaps for a lack of "cleanup" of the last cancelled prompt, like this:

image

Edit: just tried a simple test to see if it's an issue with cancelled lists, but no it really has to do with the last item being cancelled and exiting the prompt. Eg. if I swap the first two questions I get:

image

Thx ! I've fixed the display at the end.

I've raised another PR for the batch file which I've tested with Wine as I don't have a windows computer or VM available atm.

@quintesse

Copy link
Copy Markdown
Contributor

Just tested it, works great! (and build file now works again on Windows 👍)

@gnodet
gnodet deleted the fix-1239-non-fullscreen-prompts branch July 7, 2025 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants