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

Escape key closes environment editor modal in vim mode #4877

Open
1 task done
ian-h-chamberlain opened this issue Jun 17, 2022 · 12 comments
Open
1 task done

Escape key closes environment editor modal in vim mode #4877

ian-h-chamberlain opened this issue Jun 17, 2022 · 12 comments
Labels
B-bug Bug: general classification N-investigation Needs: investigation S-verified Status: Verified by maintainer

Comments

@ian-h-chamberlain
Copy link

ian-h-chamberlain commented Jun 17, 2022

Expected Behavior

When editing an environment, I'd like to use Esc to exit insert mode, without closing the modal. Ideally, when pressing the escape key:

  • In insert mode: return to normal mode
  • If anything is selected: deselect what is selected
  • In normal mode: close the environment editor

In practice that might be tricky, so maybe an alternative would be to simply pass the escape keypress to the vim mode handler and prevent closing of the modal with it entirely (in which case, hopefully another keyboard shortcut could be used to close it? :q or :wq would be nice).

Actual Behavior

Pressing escape closes the modal, even when in insert mode.

Reproduction Steps

  1. Open Preferences > General
  2. Set Text Editor Key Map to Vim
  3. Open Manage Environments (cmd+E)
  4. press i and type some text OR select some text
  5. press Escape

Is there an existing issue for this?

Additional Information

Previously closed issue (although seemingly with slightly different behavior): #208

Perhaps this is a regression from the PR delivered against that issue (#1429)?

Insomnia Version

2022.4.1

What operating system are you using?

macOS

Operating System Version

macOS Monterey 12.4 (21F79)

Installation method

Homebrew

Last Known Working Insomnia version

Unsure, but I do think it previously worked as expected.

@ian-h-chamberlain ian-h-chamberlain added B-bug Bug: general classification S-unverified Status: Unverified by maintainer labels Jun 17, 2022
@drice
Copy link

drice commented Jun 21, 2022

I'm having the same issue. I also believe this used to work as expected. I had to switch back to normal keybindings just to edit the environments.

@filfreire filfreire added S-verified Status: Verified by maintainer and removed S-unverified Status: Unverified by maintainer labels Jun 22, 2022
@filfreire
Copy link
Member

Hi @ian-h-chamberlain (and @drice) thanks for reporting this issue!

We're looking to improve how we handle shortcuts (e.g. like Escape to close a modal and others) while we have something focused the the environment editor or other modals.

In the meantime and as an alternative to unblock you, I suggest you could change the keyboard shortcut to close modals to another key that is not Escape:

Screenshot_2022-06-22_at_15_43_28

@filfreire filfreire added the N-investigation Needs: investigation label Jun 22, 2022
@ian-h-chamberlain
Copy link
Author

@filfreire thank you!! It's not a perfect solution, but this is a decent enough workaround for now and at least enables reasonably editing of the modal contents in Vim mode. I set a shortcut ^+C to close the modal and it works for now, although I do think something like :q or :wq would be preferable in the long run.

@ian-h-chamberlain
Copy link
Author

I recently updated to 2022.7.1, and this workaround no longer seems to apply ☹️

I can't find any "Close Modal" shortcut anymore, and actually it seems like the shortcuts are now backwards from what I had previously configured (I have to use ctrl-C to exit insert mode, and Esc closes the modal instead of returning to Normal mode)! I am guessing this is as a result of #4937 (and perhaps more specifically, 6de1dbd)

Is there any way users could at least have the option to reconfigure the "close modal" shortcut to restore the previous workaround? Fixing <Esc> returning to normal mode would also be greatly appreciated.

@mattmannion
Copy link

I can confirm that <ESC> no longer drops you into NORMAL mode and you must resort to <C-c> instead.

@omaryoussef
Copy link

Can confirm in 2022.7.5 "Close Modal" is not there anymore, this bug is incredibly annoying I've had to switch the keymaps back to normal.

@mschmnet
Copy link

It's great that Insomnia has Vim mode (Postman doesn't), but this makes it a little unpleasant. The current status on my machine (macOS) is the same as @mattmannion and @ian-h-chamberlain report. Is there any forecast when this will be addressed? Thank you very much.

@LoganEarl
Copy link

LoganEarl commented Apr 27, 2023

I am having the same problem. I would love to try the workaround where you disable the close modal key bind, but as stated by others that setting appears to be missing.

@Samuelfaure
Copy link

Samuelfaure commented May 22, 2023

Thank you for dealing with this issue, Insomnia is great to use, except this environment modal, which is driving me i n s a n e

@davehouser1
Copy link

Bump on this, is there a reason this keyboard shortcut was removed? Using Ctrl+c really messes up my flow. Can this be fixed for the next release please?

ian-h-chamberlain added a commit to ian-h-chamberlain/insomnia that referenced this issue Sep 27, 2023
Fixes Kong#4877

There are a couple other places that had 'Escape' hardcoded for some
kind of keydown event, but it seems mostly harmless - AFAIK this was the
biggest painful hardcoded shortcut.
@ian-h-chamberlain
Copy link
Author

ian-h-chamberlain commented Sep 27, 2023

I got frustrated enough and decided to try and fix this myself, after all this time (took me long enough)! Hopefully a maintainer can take a look at #6573 and see if they're happy with my solution.

Edit: got pointed to #6518 (comment) which references #6511 and #6370

Linking them here hopefully as a reminder to consider vim keybinds as well with this new refactor of modal closing... Not sure what the timeline is on those changes but 🤞 hopefully will also address this isssue!

ian-h-chamberlain added a commit to ian-h-chamberlain/insomnia that referenced this issue Jan 2, 2024
Fixes Kong#4877

There are a couple other places that had 'Escape' hardcoded for some
kind of keydown event, but it seems mostly harmless - AFAIK this was the
biggest painful hardcoded shortcut.
@ttelford
Copy link

ttelford commented Mar 19, 2024

I'll chime in and say this is also driving me to madness: I've had to modify environments up to three or four times because pressing the esc key to leave 'edit' mode of vi is so much a part of my typing behavior that I end up erasing all of the work I've made in insomnia's environment mode several times per session.

It's becoming incredibly maddening to edit → esc → lose work → curse Insomnia → repeat for several cycles every time I have to use the tool. Muscle memory is a harsh mistress.

I realize that may be more than you'd want to support, but a 'vi-mode' is about mode switching - so it makes sense to use mode switching to do the equivalent things like close a modal dialog. At least in the environment window, if you're using the vi keybinding, it would make sense to require the "close window" keyboard command be inputted from the "command mode", not from any mode. (ie. vi is a modal keyboard input, make sure "command" inputs are from the "command" mode!).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: general classification N-investigation Needs: investigation S-verified Status: Verified by maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants