napari / napari-console

A plugin that adds a console to napari
BSD 3-Clause "New" or "Revised" License
3 stars 12 forks source link

IPython console: bind shortcuts to edit content. #34

Open Carreau opened 3 years ago

Carreau commented 3 years ago

πŸš€ Feature

In the embeded console, most shortcut to clear text (Ctrl-C), delete one word (Ctrl-W), exit (Ctrl-D), force insert a new line (Ctrl-O), search in history (Ctrl-R), have no effects, and should likely be bound sensible default.

Motivation

The console is meant to replicate the IPython interface, and should be familiar to user of IPython and of other text base interface.

Pitch

list typical keyboard shortcuts of bash/ipython and replicate them in the console.

Alternatives

sofroniewn commented 3 years ago

This sounds very reasonable. We're in the process of moving the console into it's own repo and eventually making it a plugin - see https://github.com/napari/napari-console and napari/napari#2118 and so this contribution might happen in the new repo!

psobolewskiPhD commented 1 year ago

This should probably be transferred to napari/napari-console because I think the PR will belong in that repo, but maybe more visibility here? What do you think @Carreau ?

Carreau commented 1 year ago

IMHO we should fold napari console back in napari as most issues/PRs there got forgotten. But it's up to the core devs.

psobolewskiPhD commented 1 year ago

@Carreau my understanding from conversations with the core devs is that we rather devolve more things to plugins and try and make napari more lean at the core. Folding the console back in isn't happening. I think part of the issue is that there arn't too many core devs that use itβ€”I'm a big one though! I'm very keen on extending how napari interacts with scripts via the console.

Either way, the issue is important, but I'm not sure where the fix lies: napari keybinds or napari-console.

Czaki commented 1 year ago

@Carreau I just launched qtconsole python -m qtconsole that is used as backed for napari-console and these shortcuts are also not working (Ctrl+R is opening rename tab dialog).

So maybe this issue should be raised in qtconsole itself?

Carreau commented 1 year ago

So maybe this issue should be raised in qtconsole itself?

Maybe, I'm not a frequent user/contributor to decide. I think as a library binding by default is bad practice. but I have no preferences.

psobolewskiPhD commented 6 months ago

I looked into this on the qtconsole side. There actually are a number of keybinds all hard-coded, e.g start here and scroll: https://github.com/jupyter/qtconsole/blob/9bd175bb1e6c11e6a7b2b1d2d285cc1358b128ca/qtconsole/console_widget.py#L1313

I'm not sure why they chose the ones they did... they claim to be:

        * Providing the traditional Unix-style console keyboard shortcuts

There was an issue asking about it, but was closed, so seems like a won't implement: https://github.com/jupyter/qtconsole/issues/240

Maybe we should just document them and get used to it?