opencode-ghost 1.0.4 → 1.0.5
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/CHANGELOG.md +7 -0
- package/package.json +1 -1
- package/src/composer.ts +5 -1
- package/src/tui.tsx +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project are documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.5] - 2026-10-08
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **tui:** Keep inline suggestions visible when the composer blurs
|
|
13
|
+
|
|
8
14
|
## [1.0.4] - 2026-10-08
|
|
9
15
|
|
|
10
16
|
### Fixed
|
|
@@ -209,6 +215,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
209
215
|
- Options for `model`, `acceptKeys`, `maxChars`, `idleDelayMs`,
|
|
210
216
|
`recentMessages` and `system`.
|
|
211
217
|
|
|
218
|
+
[1.0.5]: https://github.com/ozandogrultan/opencode-ghost/compare/v1.0.4...v1.0.5
|
|
212
219
|
[1.0.4]: https://github.com/ozandogrultan/opencode-ghost/compare/v1.0.3...v1.0.4
|
|
213
220
|
[1.0.3]: https://github.com/ozandogrultan/opencode-ghost/compare/v1.0.2...v1.0.3
|
|
214
221
|
[1.0.2]: https://github.com/ozandogrultan/opencode-ghost/compare/v1.0.1...v1.0.2
|
package/package.json
CHANGED
package/src/composer.ts
CHANGED
|
@@ -33,12 +33,16 @@ export type EditorNode = {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export function isEmptyComposer(editor: TextareaRenderable | undefined, focused: unknown, mode: string, normal: boolean, selected: boolean): boolean {
|
|
36
|
+
return !!editor && editor === focused && editor.focused && isEligibleComposer(editor, mode, normal, selected)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function isEligibleComposer(editor: TextareaRenderable | undefined, mode: string, normal: boolean, selected: boolean): boolean {
|
|
36
40
|
if (!editor?.parent || editor.parent.isDestroyed) return false
|
|
37
41
|
const siblings = editor.parent.getChildren().filter((node) =>
|
|
38
42
|
!(node.id.startsWith("slot-layout-") && node.getChildren().length === 0),
|
|
39
43
|
)
|
|
40
44
|
if (siblings.length !== 2 || siblings[0] !== editor) return false
|
|
41
|
-
return normal && mode === "base" && !selected &&
|
|
45
|
+
return normal && mode === "base" && !selected && !editor.isDestroyed && editor.plainText === "" && !editor.hasSelection() && !editor.traits.capture?.includes("navigate") && editor.extmarks.getAll().length === 0
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
export function findComposerEditor<T extends EditorNode>(marker: EditorNode | undefined, isEditor: (node: EditorNode) => node is T, isComposer: (editor: T) => boolean): T | undefined {
|
package/src/tui.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Plugin } from "@opencode/plugin/tui"
|
|
3
3
|
import { TextareaRenderable, InputRenderable, type BoxRenderable, type Renderable } from "@opentui/core"
|
|
4
4
|
import { createEffect, createMemo, createRoot, createSignal, on, onCleanup } from "solid-js"
|
|
5
|
-
import { composerAction, findComposerEditor, isEmptyComposer, keyName, observeComposerInput } from "./composer"
|
|
5
|
+
import { composerAction, findComposerEditor, isEligibleComposer, isEmptyComposer, keyName, observeComposerInput } from "./composer"
|
|
6
6
|
import { createLifecycle } from "./lifecycle"
|
|
7
7
|
import { acceptCommand, acceptShortcuts, ghostKeymapLayers } from "./keymap"
|
|
8
8
|
import { parseSuggestCommand, removedOptionKeys, resolveOptions, suggestionModel } from "./options"
|
|
@@ -118,8 +118,8 @@ export default Plugin.define({
|
|
|
118
118
|
const syncInline = () => {
|
|
119
119
|
composerRevision()
|
|
120
120
|
const current = suggestion()
|
|
121
|
-
const editor = current ? getComposer(current.sessionID)
|
|
122
|
-
inline.sync(editor, current?.text, ghostColor(), !!current && canGenerate(current.sessionID) &&
|
|
121
|
+
const { editor, normal } = current ? getComposer(current.sessionID) : { editor: undefined, normal: false }
|
|
122
|
+
inline.sync(editor, current?.text, ghostColor(), !!current && canGenerate(current.sessionID) && isEligibleComposer(editor, context.keymap.mode.current(), normal, context.renderer.hasSelection))
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
const disposeRouteWatcher = createRoot((dispose) => {
|