opencode-quill 0.10.0 → 0.10.1
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/ghost.ts +20 -23
- package/src/tui.tsx +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,12 @@ All notable changes are documented in this file using
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.10.1] - 2026-11-27
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- **composer:** Improve alternatives picker contrast (#37)
|
|
12
|
+
|
|
7
13
|
## [0.10.0] - 2026-11-27
|
|
8
14
|
|
|
9
15
|
### Added
|
|
@@ -199,6 +205,7 @@ All notable changes are documented in this file using
|
|
|
199
205
|
- `/quill` command and command palette action to toggle autocomplete.
|
|
200
206
|
- Local installer script, full test suite, CI workflows, and release tooling.
|
|
201
207
|
|
|
208
|
+
[0.10.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.10.0...v0.10.1
|
|
202
209
|
[0.10.0]: https://github.com/ozandogrultan/opencode-quill/compare/v0.9.2...v0.10.0
|
|
203
210
|
[0.9.2]: https://github.com/ozandogrultan/opencode-quill/compare/v0.9.1...v0.9.2
|
|
204
211
|
[0.9.1]: https://github.com/ozandogrultan/opencode-quill/compare/v0.9.0...v0.9.1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-quill",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"description": "OpenCode prompt autocomplete: local n-gram word and next-word prediction shown as inline ghost text in the TUI composer, accepted with Tab.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/ghost.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RGBA, type CliRenderer, type OptimizedBuffer, type Renderable, type TextareaRenderable } from "@opentui/core"
|
|
1
|
+
import { RGBA, TextAttributes, type CliRenderer, type OptimizedBuffer, type Renderable, type TextareaRenderable } from "@opentui/core"
|
|
2
2
|
import { completionQuery, type TextRange } from "./prose"
|
|
3
3
|
import type { Prediction, WordPredictor } from "./predictor"
|
|
4
4
|
|
|
@@ -21,8 +21,6 @@ type Alternatives = {
|
|
|
21
21
|
text: RGBA
|
|
22
22
|
muted: RGBA
|
|
23
23
|
background: RGBA
|
|
24
|
-
selectedText: RGBA
|
|
25
|
-
selectedBackground: RGBA
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -166,32 +164,36 @@ export class ComposerGhost {
|
|
|
166
164
|
const { prefix } = this.memo!
|
|
167
165
|
const prefixWidth = this.editor.editBuffer.measureText(prefix)
|
|
168
166
|
const cursor = this.editor.visualCursor
|
|
169
|
-
if (cursor.visualRow !== 0 || cursor.visualCol < prefixWidth || y < fitting.length) return false
|
|
167
|
+
if (cursor.visualRow !== 0 || cursor.visualCol < prefixWidth || y < fitting.length + 2) return false
|
|
170
168
|
const terms = fitting.map((candidate) => candidate.replace ? candidate.suffix : prefix + candidate.suffix)
|
|
171
169
|
const measure = (text: string) => this.editor.editBuffer.measureText(text)
|
|
172
|
-
const termWidth = Math.max(...terms.map(measure)) +
|
|
170
|
+
const termWidth = Math.max(...terms.map(measure)) + 6
|
|
173
171
|
const left = Math.max(0, this.editor.screenX)
|
|
174
172
|
const right = Math.min(buffer.width, this.editor.screenX + this.editor.width)
|
|
175
173
|
if (termWidth > Math.min(48, right - left)) return false
|
|
176
|
-
const start = Math.max(left, Math.min(x - prefixWidth -
|
|
174
|
+
const start = Math.max(left, Math.min(x - prefixWidth - 4, right - termWidth))
|
|
177
175
|
const fullHelp = ["↑/↓ move", options.accept && `${options.accept} accept`, options.dismiss && `${options.dismiss} close`].filter(Boolean).join(" · ")
|
|
178
|
-
const help = y > fitting.length
|
|
179
|
-
? [fullHelp, "↑/↓ move"].find((label) => measure(label) +
|
|
176
|
+
const help = y > fitting.length + 2
|
|
177
|
+
? [fullHelp, "↑/↓ move"].find((label) => measure(label) + 4 <= Math.min(48, right - start))
|
|
180
178
|
: undefined
|
|
181
|
-
const width = Math.max(termWidth, help ? measure(help) +
|
|
182
|
-
const height = fitting.length + Number(!!help)
|
|
179
|
+
const width = Math.max(termWidth, help ? measure(help) + 4 : 0)
|
|
180
|
+
const height = fitting.length + Number(!!help) + 2
|
|
183
181
|
const top = y - height
|
|
184
|
-
const {
|
|
182
|
+
const opaque = ({ r, g, b }: RGBA) => RGBA.fromValues(r, g, b, 1)
|
|
183
|
+
const text = opaque(options.colors.text)
|
|
184
|
+
const muted = opaque(options.colors.muted)
|
|
185
|
+
const background = opaque(options.colors.background)
|
|
185
186
|
buffer.pushScissorRect(start, top, width, height)
|
|
186
187
|
try {
|
|
187
|
-
buffer.
|
|
188
|
+
buffer.drawBox({ x: start, y: top, width, height, border: true, borderStyle: "single", borderColor: muted, backgroundColor: background, shouldFill: true })
|
|
188
189
|
terms.forEach((term, index) => {
|
|
189
190
|
const selected = fitting[index] === prediction
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
const label = ` ${selected ? "› " : " "}${term}`
|
|
192
|
+
const row = label + " ".repeat(width - 2 - measure(label))
|
|
193
|
+
buffer.drawText(row, start + 1, top + index + 1,
|
|
194
|
+
selected ? background : text, selected ? text : background, selected ? TextAttributes.BOLD : undefined)
|
|
193
195
|
})
|
|
194
|
-
if (help) buffer.drawText(help, start + 2, y -
|
|
196
|
+
if (help) buffer.drawText(help, start + 2, y - 2, muted, background)
|
|
195
197
|
} finally {
|
|
196
198
|
buffer.popScissorRect()
|
|
197
199
|
}
|
|
@@ -231,14 +233,9 @@ export class ComposerGhost {
|
|
|
231
233
|
buffer.drawText(ghost, x, y, color, this.editor.backgroundColor)
|
|
232
234
|
if (options && !picker && (options.summon || options.cycle || memo.picker)) {
|
|
233
235
|
const counter = ` ${fitting.indexOf(prediction) + 1}/${fitting.length}`
|
|
234
|
-
const hint = options.summon && (!attempted || !options.cycle)
|
|
235
|
-
? ` ${options.summon} ${attempted ? "cycles" : "for"} ${fitting.length} choices`
|
|
236
|
-
: counter
|
|
237
236
|
const width = this.editor.editBuffer.measureText(ghost)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
buffer.drawText(label, x + width, y, dimGhostColor(color), this.editor.backgroundColor)
|
|
241
|
-
break
|
|
237
|
+
if (width + this.editor.editBuffer.measureText(counter) <= room) {
|
|
238
|
+
buffer.drawText(counter, x + width, y, dimGhostColor(color), this.editor.backgroundColor)
|
|
242
239
|
}
|
|
243
240
|
}
|
|
244
241
|
} finally {
|