Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Expose clearScreen on LineReader #610

Closed
sualeh opened this issue Dec 1, 2020 · 7 comments
Closed

Expose clearScreen on LineReader #610

sualeh opened this issue Dec 1, 2020 · 7 comments

Comments

@sualeh
Copy link

sualeh commented Dec 1, 2020

Expose clearScreen on LineReader so that it is generally useful. Or, implement it on Terminal - if that makes more sense.

@gnodet
Copy link
Member

gnodet commented Dec 1, 2020

You could use

lineReader.callWidget(LineReader.CLEAR_SCREEN);

@sualeh
Copy link
Author

sualeh commented Dec 1, 2020

@gnodet - thanks - let me try that.

@sualeh
Copy link
Author

sualeh commented Dec 1, 2020

@gnodet - I get an exception: Widgets can only be called during a readLine call

@mattirn
Copy link
Collaborator

mattirn commented Dec 2, 2020

In general I think that we should not expose methods (neither in LineReaderImpl) that implements widgets but they should be executed by using callWidget() method. Maybe we can implement a method executeWidget() that could be used outside of readerLine call to invoke widgets:

    public void executeWidget(String name) {
        String keyseq = alt(ctrl('W'));
        getKeyMaps().get(LineReader.MAIN).bind(new Reference(name), keyseq);
        runMacro(keyseq);
    }

@sualeh
Copy link
Author

sualeh commented Dec 2, 2020

Thanks. If you could do that, it would be great. I know too little about jline3 to help with a PR.

@gnodet
Copy link
Member

gnodet commented Dec 2, 2020

@sualeh the ReadLineImpl.clearScreen() aims at cleaning and redrawing the screen during a readLine() call. if you simply want to clear the screen, you can simply call

terminal.puts(Capability.clear_screen);

@sualeh
Copy link
Author

sualeh commented Dec 3, 2020

Thanks, @gnodet

@sualeh sualeh closed this as completed Dec 3, 2020
remkop pushed a commit to remkop/picocli that referenced this issue Dec 14, 2020
MarkoMackic pushed a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
MarkoMackic added a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
…sing LineReaderImpl, as suggested in jline/jline3#610"

This reverts commit 6f7523a.
MarkoMackic added a commit to MarkoMackic/picocli that referenced this issue Oct 17, 2021
…sing LineReaderImpl, as suggested in jline/jline3#610"

This reverts commit 6f7523a.
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

No branches or pull requests

3 participants