Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Multiline editing breaks if input has more lines than terminal #311

Closed
electrum opened this issue Sep 13, 2018 · 4 comments · Fixed by #393
Closed

Multiline editing breaks if input has more lines than terminal #311

electrum opened this issue Sep 13, 2018 · 4 comments · Fixed by #393

Comments

@electrum
Copy link
Contributor

No description provided.

@electrum
Copy link
Contributor Author

electrum commented Sep 14, 2018

I've been looking into how to fix this but I'm stuck on the question of how it should work.

It looks like LineReaderImpl.redisplay() already has some code to handle this scenario. I tested it as follows:

  • Make MIN_ROWS larger and rebuild
  • Run the demo
  • Paste in a large string (a chunk of /etc/passwd) surrounded by ' and hit enter
  • Resize terminal to have fewer lines than MIN_ROWS
  • Press up to get to the history entry and see how it behaves. Pressing up/down while in the entry will scroll between the lines. Eventually it gets messed up.

One thought is that we could change the code to activate anytime the number of lines to display is too large for the terminal.

screen shot 2018-09-14 at 10 42 06 am

screen shot 2018-09-14 at 10 42 14 am

screen shot 2018-09-14 at 10 42 33 am

@electrum
Copy link
Contributor Author

My motivation to fix this is to upgrade the Presto CLI to use JLine 3. People often paste large SQL queries that have hundreds or thousands of lines. Multiline editing is an awesome feature, but we can't regress on this common scenario that JLine 2 handles without problems.

@electrum
Copy link
Contributor Author

@gnodet Do you have any thoughts on how this should work?

@gnodet
Copy link
Member

gnodet commented Oct 1, 2018

The display needs to be fixed so that if the number of lines is greater than the height of the terminal, some continuation markers have to be displayed at the top and/or bottom and trim the number of lines. This has to be done in the LineReaderImpl because it will certainly need special treatment for up/down cursor movement.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants