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

Vim Mode and Read Only Fixes #1240

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

allie-wake-up
Copy link

Currently in vim mode if the editor isn't selected and I hit j it will cause the editor to gain focus and insert the j character before entering vim normal mode. Read only mode is broken when toggling vim mode. This PR attempts to fix those issues. I don't know if there's a better way to fix the read only mode than calling reloadPage but it seems to work

  • remove client.focus call from global keydown handler. This call is what breaks vim mode

  • add client.reloadPage call to setUiOption syscall. This appears to fix read only mode that is completely broken without the above focus call. It also seems to fix the issue when toggling vim mode

  • add client.focus call to CommandPalette onTrigger if no cmd is selected. Without the client.focus call above, the editor is no longer selected when exiting the command palette with escape - this call fixes that

  • add watch-all task to deno.json to run all 3 watches in 1 terminal window

- remove client.focus call from global keydown handler. This call causes
  issues with vim mode.  For instance typing j with the editor not
  focused would insert a j before properly going to normal mode instead
  of just moving down a line as expected
- add client.reloadPage call to setUiOption syscall. This appears to fix
  read only mode that is broken without the above focus call.  In
  particular when switching between vim and regular mode read only mode
  was previously broken even with the client.focus call
- add client.focus call to CommandPalette onTrigger if no cmd is
  selected. Without the client.focus call above, the editor is no longer
  selected when exiting the command palette with escape - this call
  fixes that
- add watch-all task to deno.json to run all 3 watches in 1 terminal
  window
Copy link
Collaborator

@zefhemel zefhemel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to look at this more closely and test a lot of scenarios. It was kind of a pain to get this to work again last time, and moving the client.focus call may break yet other cases. Some patience :D

@@ -47,6 +47,7 @@
"watch-web": "deno run -A --check build_web.ts --watch",
"watch-server": "deno run -A --unstable-kv --unstable-worker-options --check --watch silverbullet.ts",
"watch-plugs": "deno run -A --check build_plugs.ts -w",
"watch-all": "deno task watch-web & deno task watch-server & deno task watch-plugs",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with adding this, but then let's add deno task watch-server at the end so you can pass it arguments (like a folder), for instance deno task watch-all ~/tmp

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 this pull request may close these issues.

2 participants