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

Show the REPL/output with cursor at the bottom #792

Open
glebovmaksim opened this issue Sep 20, 2020 · 6 comments
Open

Show the REPL/output with cursor at the bottom #792

glebovmaksim opened this issue Sep 20, 2020 · 6 comments

Comments

@glebovmaksim
Copy link

glebovmaksim commented Sep 20, 2020

Hi! 😄 This issue based on the fact that the REPL/output window can be easily closed, so we need a convenient way to open it again. There is a keyboard shortcut ctrl+alt+c o, which is very nice (and I use it a lot), but it has one drawback: the REPL/output opens with cursor at the top of the file. That means the user must manually scroll to the bottom to use the REPL.

There is one special case, though, when ctrl+alt+c o brings back the REPL/output with cursor at the bottom: when the REPL/output contains unread evaluation results. It's implemented by introducing state:

if (visibleResultsEditors.length == 0) {
scrollToBottomSub = vscode.window.onDidChangeActiveTextEditor((editor) => {
if (isResultsDoc(editor.document)) {
util.scrollToBottom(editor);
scrollToBottomSub.dispose();
}
});
state.extensionContext.subscriptions.push(scrollToBottomSub);
}

This auto-scrolling happens not only after using the keyboard shortcut, but also after opening the REPL/output file manually by clicking in the file explorer (not a big deal, but maybe a little bit magical).

I cannot imaging the case when it's necessary to open the REPL/output with cursor at the top, so my proposal is to eliminate the state and always bring it back with cursor at the bottom when using command/shortcut. The meaning of the command: "Show the REPL/output ready to be used". Manual clicking in the file explorer will still open the file in a regular and predictable way.

I've already made this change in my fork and it works very well for me. Will be happy to make a PR.

glebovmaksim pushed a commit to glebovmaksim/calva that referenced this issue Sep 20, 2020
glebovmaksim pushed a commit to glebovmaksim/calva that referenced this issue Sep 20, 2020
@PEZ
Copy link
Collaborator

PEZ commented Sep 20, 2020

I'd be fine with that the window always scrolls to bottom when opened via the command. Not sure what you mean by removing state, but if it works like you describe, I like it.

@bpringe
Copy link
Member

bpringe commented Sep 20, 2020

This sounds good to me!

@bevo009
Copy link

bevo009 commented Feb 13, 2021

This annoys me too, and Ctrl-End doesn't work to go to the bottom either
+1 for the repl always opening with the cursor at the bottom, or an option for that
fwiw,
I use Ctrl-G (Go to Line #) and enter the last line number shown to avoid manually clicking at the bottom with the mouse

@PEZ
Copy link
Collaborator

PEZ commented Feb 13, 2021

Sounds odd that ctrl+end doesn't work. Is it bound to something else, maybe? cmd+down works on Mac for me...

@bevo009
Copy link

bevo009 commented Feb 15, 2021

@PEZ When Calva Bindings are enabled,
neither Ctrl-Home or Ctrl-End work as usual here on Win10

Ctrl-Home is bound to (default):
Calva Paredit: Forward to List End/Close
paredit.closeList

Ctrl-End is bound to (default):
Calva Paredit: Select Backward to List Start/Open
paredit.selectOpenList

@PEZ
Copy link
Collaborator

PEZ commented Feb 15, 2021

Thanks! We should consider changing those bindings...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants