whitphx/vscode-emacs-mcx

Keys don't work on find wedget

makotoshimazu opened this issue · 10 comments

Cursor operations like Ctrl+F/B/A/E and delete like Ctrl+H don't work on Find widget, and moreover, they close the widget.
Is it possible to use them on the widget?

There is no way to customize keybindings of input fields:

(FYI: #55)

Thanks for the pointers!
Now I can understand that this is blocked by issues on vscode. I'm going to watch them.

And I also found that 7da035c is a patch to close the widget.
Now I can understand what's the problem I'm facing with - it closes the widget even when it's replace (not find). I don't have a way to move cursor except for clicking the small input area.

@ganaware Do you have any thoughts?
I personally prefer not closing the widget because currently we can close the find widget by C-g, but we don't have a way to move the cursor during replacing words. (= probably it means reverting the patch)

I understand that what is the problem.

The patch was introduced by #71 to emulate original i-search behavior, and I think it does good job.

But unwillingly it also affects the replace widget, because there is no difference between the replace widget and the find widgets.

We have no way to know which widget is visible.
For 'when' clause contexts, VSCode offers "findWidgetVisible" that cannot distinguish them.
( https://code.visualstudio.com/docs/getstarted/keybindings )

So, which is better ?

  1. more emacs-like i-search, but poor replace-widget experience. (current)
  2. less emacs-like i-search, but cursor movement works.
  3. or ...?

Given that currently we don't have any keyboard shortcuts to move the cursor, I prefer 2.
I like more emacs-like i-search, but personally bad experience on replace widget seems more problematic than C-g to stop i-search.
What do you think?

@tuttieee any ideas?

Sorry, no idea. What @ganaware said is all.
Please override the keybindings by your user-level setting like below as a workaround.

{
    "key": "ctrl+f",
    "command": "-emacs-mcx.executeCommands",
    "when": "editorFocus && findWidgetVisible"
},
{
    "key": "ctrl+b",
    "command": "-emacs-mcx.executeCommands",
    "when": "editorFocus && findWidgetVisible"
},
{
    "key": "ctrl+p",
    "command": "-emacs-mcx.executeCommands",
    "when": "editorFocus && findWidgetVisible"
},
{
    "key": "ctrl+n",
    "command": "-emacs-mcx.executeCommands",
    "when": "editorFocus && findWidgetVisible"
},
{
    "key": "ctrl+a",
    "command": "-emacs-mcx.executeCommands",
    "when": "editorFocus && findWidgetVisible"
},
{
    "key": "ctrl+e",
    "command": "-emacs-mcx.executeCommands",
    "when": "editorFocus && findWidgetVisible"
}

Ah sorry I missed your comments last month.
I have those in my local keybindings.json and I no longer have any problems, but I'd suggest that adding those settings into the default keybindings so that the behavior would be easier to understand (at least for me).
What do you think?

The workaround I provided was to disable closing the find widget - but the disabled behavior here was an intended behavior introduced in #71 as @ganaware said.
So, the workaround here cannot be installed into the default keybindings - it conflicts with the "correct" behavior.

However, there are some options and things to do.

  • To write document about this.
  • To add the "disabled" version keybindings as an option switchable by config.

Thank you for your suggestion. I will do these things.

Now you can use emacs-mcx.cursorMoveOnFindWidget option with v0.26.0 or later.