mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 16:42:19 +00:00
fix(terminal): allow Shift when Esc+_ yanks the last argument
Underscore is Shift+Minus, so rejecting all shiftKey follow-ups dropped M-_ after autocomplete dismissed. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
e30bc51ee6
commit
f960f4c78e
2 files changed
+20
-3
No files matched your search
@@ -36,8 +36,9 @@ export function autocompleteEscMetaFollowUpSequence(e: {
|
||||
metaKey: boolean;
|
||||
shiftKey: boolean;
|
||||
}): string | null {
|
||||
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) return null;
|
||||
if (e.key === ".") return "\x1b.";
|
||||
if (e.altKey || e.ctrlKey || e.metaKey) return null;
|
||||
// `_` is Shift+Minus on a standard keyboard; Shift+. is `>` and must not yank.
|
||||
if (e.key === "." && !e.shiftKey) return "\x1b.";
|
||||
if (e.key === "_") return "\x1b_";
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -234,6 +234,22 @@ test("Esc+. after dismissing the popup sends ESC+. to the shell", () => {
|
||||
assert.deepEqual(writes, ["\x1b."]);
|
||||
});
|
||||
|
||||
test("Esc then Shift+. does not yank (Shift+. is >)", () => {
|
||||
const { context, writes } = createContext();
|
||||
handleTerminalAutocompleteKeyEvent(keyEvent("Escape"), context);
|
||||
context.stateRef.current = {
|
||||
...context.stateRef.current,
|
||||
popupVisible: false,
|
||||
suggestions: [],
|
||||
};
|
||||
|
||||
const greaterThan = shiftKeyEvent(">");
|
||||
const result = handleTerminalAutocompleteKeyEvent(greaterThan, context);
|
||||
|
||||
assert.equal(result, true);
|
||||
assert.deepEqual(writes, []);
|
||||
});
|
||||
|
||||
test("Esc+_ after dismissing the popup sends ESC+_ to the shell", () => {
|
||||
const { context, writes } = createContext();
|
||||
handleTerminalAutocompleteKeyEvent(keyEvent("Escape"), context);
|
||||
@@ -243,7 +259,7 @@ test("Esc+_ after dismissing the popup sends ESC+_ to the shell", () => {
|
||||
suggestions: [],
|
||||
};
|
||||
|
||||
const underscore = keyEvent("_");
|
||||
const underscore = shiftKeyEvent("_");
|
||||
const result = handleTerminalAutocompleteKeyEvent(underscore, context);
|
||||
|
||||
assert.equal(result, false);
|
||||
|
||||
Reference in new issue
Block a user