opencode-vim 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-vim",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/Tarquinen/opencode-vim"
@@ -103,7 +103,7 @@ export function SnippetAutocomplete(props: SnippetAutocompleteProps) {
103
103
  props.controller.navigate = undefined
104
104
  })
105
105
 
106
- const dialogBlockingInput = () => dialogOpen() || dialogHandoffUntil() > Date.now()
106
+ const dialogBlockingInput = () => props.ctx.api.ui.dialog.open || dialogOpen() || dialogHandoffUntil() > Date.now()
107
107
  const match = createMemo(() => {
108
108
  if (props.ctx.disabled || props.ctx.visible === false) return undefined
109
109
  return findTrailingHashtagTrigger(input())
@@ -43,7 +43,7 @@ function VimKeyboard(props: { ctx: PromptContext; config: VimConfig; state: Retu
43
43
 
44
44
  const cursorStyleTimer = setInterval(syncCursorStyle, 50)
45
45
  const offKeyIntercept = props.ctx.api.keymap.intercept("key", ({ event }) => {
46
- if (!props.enabled() || props.ctx.disabled || props.ctx.visible === false) return
46
+ if (!canHandleKeys(props)) return
47
47
  const key = keyNotation(event)
48
48
  if (!key || !passThroughKey(event, key, props.state.mode())) return
49
49
  if (preparePassThroughKey(props.ctx, key, props.state.mode())) preparedEvents.add(event)
@@ -61,8 +61,8 @@ function VimKeyboard(props: { ctx: PromptContext; config: VimConfig; state: Retu
61
61
  pending: props.state.pending(),
62
62
  })
63
63
 
64
- if (!props.enabled() || props.ctx.disabled || props.ctx.visible === false) {
65
- props.log("keyboard.skip", { enabled: props.enabled(), disabled: props.ctx.disabled, visible: props.ctx.visible })
64
+ if (!canHandleKeys(props)) {
65
+ props.log("keyboard.skip", { enabled: props.enabled(), disabled: props.ctx.disabled, visible: props.ctx.visible, dialogOpen: props.ctx.api.ui.dialog.open })
66
66
  return
67
67
  }
68
68
 
@@ -77,6 +77,11 @@ function VimKeyboard(props: { ctx: PromptContext; config: VimConfig; state: Retu
77
77
  return
78
78
  }
79
79
 
80
+ if (key === "<Esc>" && props.state.mode() === "normal" && !props.state.pending()) {
81
+ props.log("keyboard.fallthrough", { key, mode: props.state.mode() })
82
+ return
83
+ }
84
+
80
85
  if (sendNavigationKey(event, props.ctx, key, props.state.mode(), props.snippets)) {
81
86
  syncCursorStyle(true)
82
87
  props.ctx.requestRender()
@@ -112,6 +117,10 @@ function VimKeyboard(props: { ctx: PromptContext; config: VimConfig; state: Retu
112
117
  }
113
118
  }
114
119
 
120
+ function canHandleKeys(props: { ctx: PromptContext; enabled: Accessor<boolean> }) {
121
+ return props.enabled() && !props.ctx.disabled && props.ctx.visible !== false && !props.ctx.api.ui.dialog.open
122
+ }
123
+
115
124
  function readablePending(sequence: string) {
116
125
  if (!sequence) return undefined
117
126
  return sequence.replaceAll("><", " ")