mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 06:04:40 +00:00
Fix alt+backspace in Kitty mode and clamp Codex effort (refs #752)
This commit is contained in:
parent
6484ae279d
commit
be26d362fa
3 changed files with 7 additions and 6 deletions
|
|
@ -209,6 +209,7 @@ function buildSystemPrompt(userSystemPrompt?: string): { instructions: string; d
|
|||
|
||||
function clampReasoningEffort(modelId: string, effort: string): string {
|
||||
const id = modelId.includes("/") ? modelId.split("/").pop()! : modelId;
|
||||
if (id.startsWith("gpt-5.2") && effort === "minimal") return "low";
|
||||
if (id === "gpt-5.1" && effort === "xhigh") return "high";
|
||||
if (id === "gpt-5.1-codex-mini") return effort === "high" || effort === "xhigh" ? "high" : "medium";
|
||||
return effort;
|
||||
|
|
|
|||
|
|
@ -771,8 +771,8 @@ export function matchesKey(data: string, keyId: KeyId): boolean {
|
|||
|
||||
case "backspace":
|
||||
if (alt && !ctrl && !shift) {
|
||||
if (!_kittyProtocolActive) {
|
||||
return data === "\x1b\x7f" || data === "\x1b\b";
|
||||
if (data === "\x1b\x7f" || data === "\x1b\b") {
|
||||
return true;
|
||||
}
|
||||
return matchesKittySequence(data, CODEPOINTS.backspace, MODIFIERS.alt);
|
||||
}
|
||||
|
|
@ -1065,7 +1065,7 @@ export function parseKey(data: string): string | undefined {
|
|||
if (data === "\x1b[Z") return "shift+tab";
|
||||
if (!_kittyProtocolActive && data === "\x1b\r") return "alt+enter";
|
||||
if (!_kittyProtocolActive && data === "\x1b ") return "alt+space";
|
||||
if (!_kittyProtocolActive && (data === "\x1b\x7f" || data === "\x1b\b")) return "alt+backspace";
|
||||
if (data === "\x1b\x7f" || data === "\x1b\b") return "alt+backspace";
|
||||
if (!_kittyProtocolActive && data === "\x1bB") return "alt+left";
|
||||
if (!_kittyProtocolActive && data === "\x1bF") return "alt+right";
|
||||
if (!_kittyProtocolActive && data.length === 2 && data[0] === "\x1b") {
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ describe("matchesKey", () => {
|
|||
assert.strictEqual(parseKey("\x00"), "ctrl+space");
|
||||
});
|
||||
|
||||
it("should parse legacy alt-prefixed sequences only when kitty inactive", () => {
|
||||
it("should parse legacy alt-prefixed sequences when kitty inactive", () => {
|
||||
setKittyProtocolActive(false);
|
||||
assert.strictEqual(matchesKey("\x1b ", "alt+space"), true);
|
||||
assert.strictEqual(parseKey("\x1b "), "alt+space");
|
||||
|
|
@ -153,8 +153,8 @@ describe("matchesKey", () => {
|
|||
setKittyProtocolActive(true);
|
||||
assert.strictEqual(matchesKey("\x1b ", "alt+space"), false);
|
||||
assert.strictEqual(parseKey("\x1b "), undefined);
|
||||
assert.strictEqual(matchesKey("\x1b\b", "alt+backspace"), false);
|
||||
assert.strictEqual(parseKey("\x1b\b"), undefined);
|
||||
assert.strictEqual(matchesKey("\x1b\b", "alt+backspace"), true);
|
||||
assert.strictEqual(parseKey("\x1b\b"), "alt+backspace");
|
||||
assert.strictEqual(matchesKey("\x1b\x03", "ctrl+alt+c"), false);
|
||||
assert.strictEqual(parseKey("\x1b\x03"), undefined);
|
||||
assert.strictEqual(matchesKey("\x1bB", "alt+left"), false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue