#105 Improve focus switching between source editor and console


I find it quite painful to go back and forth between the source code editor and the R console at the bottom of the screen, and yet that's one of my most common working patterns. The problem is that one constantly needs to focus the relevant part of the screen, which requires moving the pointer and clicking on the window; this requires moving the hands off the keyboard, which is quite disruptive. I have a few suggestions to improve this:

1) Avoid the need to change focus at all.
When I'm using the console, I often need to run code from the editor; but none of the normal solutions (Alt+F[789], toolbar button) works, because the editor isn't focused. Moreover, if you want to use one of these solutions, you need to click in the editor to focus it, effectively losing the previous selection you could have wanted to run again (this happens to me very often).
I think this can be solved easily: there's no need to disable shortcuts and toolbar buttons related to the editor when you're using the console. These shortcuts don't conflict with the console, and the console doesn't add toolbar buttons. Thus, I think the commands related to the top pane of the main window (editor, help browser, data editor) should stay active even when the console is focused; the only difference would be that normal text goes in the console instead of in the top pane.

2) Make it easier changing the focused part.
We need a quick shortcut to switch between the top pane and the console. That way, one doesn't need to use the pointer and click at all. Since you're typically typing things, it's much better to keep your hands on the keyboard.

What do you think?


  • Thomas Friedrichsmeier


    1) I need to think about this some more, but it's not quite as easy. While there are almost no shortcut conflicts between console and script editor by default (but Shift+F8, and F2 are; these do the "same" thing, but for different windows), users are free to assign custom shortcuts to all actions in each "part". Thus it will be difficult to avoid conflicts, reliably, if more than one part can be active at the same time.

    2) Try Ctrl+Tab ! (And beyond that, check Windows->Activate for more specific window switching shortcuts).


    So I think, 2 is implemented, already. 1 is probably a no-go, IMO, but I'll think about this some more, and leave the ticket open for the moment.


  • Milan Bouchet-Valat

    Ah, I didn't know the Ctrl+Tab trick, that's definitely what my point 2) is about. I wonder how I missed it when looking at the shortcuts dialog... So that one is fixed.

    About the first point, well, I think you have to consider trade-offs. I don't think that preventing users from setting conflicting shortcuts between the top pane and the console is really a problem, given the very low probability of this being useful. And the advantage is high, since it makes the whole GUI more stable when you switch (no changing toolbars), and more efficient for everyone. Maybe that's more of a technical problem, since RKWard needs to detect and prevent conflicts between the console and all other parts.

    As for the F2 and Alt+F8, that's not much of an issue. F2 can simply show help for the function in the focused part. For Alt+F8, it should run the selection of the console if it's focused, and if it isn't, the selection of the editor (even if I think running selections from the console is really a corner case).


Log in to post a comment.