opencode-vim 0.0.17 → 0.0.18

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.18",
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
 
@@ -112,6 +112,10 @@ function VimKeyboard(props: { ctx: PromptContext; config: VimConfig; state: Retu
112
112
  }
113
113
  }
114
114
 
115
+ function canHandleKeys(props: { ctx: PromptContext; enabled: Accessor<boolean> }) {
116
+ return props.enabled() && !props.ctx.disabled && props.ctx.visible !== false && !props.ctx.api.ui.dialog.open
117
+ }
118
+
115
119
  function readablePending(sequence: string) {
116
120
  if (!sequence) return undefined
117
121
  return sequence.replaceAll("><", " ")