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

Resuming incremental search requires two presses of C-s #108

Closed
m27315 opened this issue Apr 19, 2019 · 5 comments · Fixed by #209
Closed

Resuming incremental search requires two presses of C-s #108

m27315 opened this issue Apr 19, 2019 · 5 comments · Fixed by #209

Comments

@m27315
Copy link

m27315 commented Apr 19, 2019

Steps to Reproduce:

  1. Search for some word using C-s.
  2. Move to blank line or some space without a word under the cursor, so incremental search history is preserved (see Resuming incremental search replaces old search with word at current location #107).
  3. Resume incremental search (C-s).
  4. Note that previous search is recalled and matches are hightlighted. However, searching has not begun.
  5. Press C-s again to jump to the next match.

Expected Behavior

Resuming incremental search would have immediately resumed the search and jumped to the next match from current cursor location.

Versions

Awesome Emacs Keymap: 0.11.2
VSCode Version: 1.33.1
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:20:22.771Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Linux x64 4.19.27-gentoo-r1
@joeshaw
Copy link
Contributor

joeshaw commented May 14, 2019

I wonder if binding to "Find Next" in all cases (ie, not just when findWidgetVisible) is the right way to handle this. Unfortunately, "Find Next" doesn't highlight the find widget, so you couldn't enter new text in that case. I'm not sure if that can be worked around, though.

@joeshaw
Copy link
Contributor

joeshaw commented May 16, 2019

A hack I threw together for this which seems to work is:

export class Find extends EmacsCommand {
    public readonly id = "find";
    
    public execute(textEditor: TextEditor, isInMarkMode: boolean, prefixArgument: number | undefined) {
        return vscode.commands.executeCommand("actions.find").then(() => vscode.commands.executeCommand("editor.action.nextMatchFindAction"));
    }
}

Probably an abuse of overriding EmacsCommand for this, but executing the actions.find command first and then the editor.action.nextMatchFindAction gets the job done in an emacs-like fashion (other than not extending the mark selection as matches happen 😕)

@m27315
Copy link
Author

m27315 commented Feb 26, 2020

@joeshaw, is there a way I can try the above "hack"? ... Thanks for your suggestion!

@whitphx
Copy link
Owner

whitphx commented Mar 16, 2020

@joeshaw Thank you for the suggestion.
I think it's ok to use EmacsCommand for such light purpose.
Can you send a patch?

joeshaw added a commit to joeshaw/vscode-emacs-mcx that referenced this issue Mar 16, 2020
In emacs, C-s resumes a previous incremental search.  In VSCode this
requires two presses.  This new find command emulates the Emacs
behavior.

Fixes whitphx#108
@joeshaw
Copy link
Contributor

joeshaw commented Mar 16, 2020

I submitted a PR for it, #209.

joeshaw added a commit to joeshaw/vscode-emacs-mcx that referenced this issue Mar 16, 2020
In emacs, C-s resumes a previous incremental search.  In VSCode this
requires two presses.  This new find command emulates the Emacs
behavior.

Fixes whitphx#108
joeshaw added a commit to joeshaw/vscode-emacs-mcx that referenced this issue Mar 16, 2020
In emacs, C-s resumes a previous incremental search.  In VSCode this
requires two presses.  This new find command emulates the Emacs
behavior.

Fixes whitphx#108
joeshaw added a commit to joeshaw/vscode-emacs-mcx that referenced this issue Mar 16, 2020
In emacs, C-s resumes a previous incremental search.  In VSCode this
requires two presses.  This new find command emulates the Emacs
behavior.

Fixes whitphx#108
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

Successfully merging a pull request may close this issue.

3 participants