mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Merge pull request #1191 from afarber/remove-vertical-borders
feat(ui): remove vertical borders from input prompt for easier copy/paste
This commit is contained in:
@@ -1307,7 +1307,7 @@ describe('InputPrompt', () => {
|
|||||||
mockBuffer.text = text;
|
mockBuffer.text = text;
|
||||||
mockBuffer.lines = [text];
|
mockBuffer.lines = [text];
|
||||||
mockBuffer.viewportVisualLines = [text];
|
mockBuffer.viewportVisualLines = [text];
|
||||||
mockBuffer.visualCursor = [0, 8]; // cursor after '👍' (length is 6 + 2 for emoji)
|
mockBuffer.visualCursor = [0, 7]; // cursor after '👍' (emoji is 1 code point, so total is 7)
|
||||||
|
|
||||||
const { stdout, unmount } = renderWithProviders(
|
const { stdout, unmount } = renderWithProviders(
|
||||||
<InputPrompt {...props} />,
|
<InputPrompt {...props} />,
|
||||||
|
|||||||
@@ -707,15 +707,20 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
|||||||
statusText = t('Accepting edits');
|
statusText = t('Accepting edits');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const borderColor =
|
||||||
|
isShellFocused && !isEmbeddedShellFocused
|
||||||
|
? (statusColor ?? theme.border.focused)
|
||||||
|
: theme.border.default;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Box
|
<Box
|
||||||
borderStyle="round"
|
borderStyle="single"
|
||||||
borderColor={
|
borderTop={true}
|
||||||
isShellFocused && !isEmbeddedShellFocused
|
borderBottom={true}
|
||||||
? (statusColor ?? theme.border.focused)
|
borderLeft={false}
|
||||||
: theme.border.default
|
borderRight={false}
|
||||||
}
|
borderColor={borderColor}
|
||||||
paddingX={1}
|
paddingX={1}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
@@ -829,9 +834,10 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
|||||||
isOnCursorLine &&
|
isOnCursorLine &&
|
||||||
cursorVisualColAbsolute === cpLen(lineText)
|
cursorVisualColAbsolute === cpLen(lineText)
|
||||||
) {
|
) {
|
||||||
|
// Add zero-width space after cursor to prevent Ink from trimming trailing whitespace
|
||||||
renderedLine.push(
|
renderedLine.push(
|
||||||
<Text key={`cursor-end-${cursorVisualColAbsolute}`}>
|
<Text key={`cursor-end-${cursorVisualColAbsolute}`}>
|
||||||
{showCursor ? chalk.inverse(' ') : ' '}
|
{showCursor ? chalk.inverse(' ') + '\u200B' : ' \u200B'}
|
||||||
</Text>,
|
</Text>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,39 +19,39 @@ exports[`InputPrompt > command search (Ctrl+R when not in shell) > expands and c
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`InputPrompt > command search (Ctrl+R when not in shell) > renders match window and expanded view (snapshots) > command-search-collapsed-match 1`] = `
|
exports[`InputPrompt > command search (Ctrl+R when not in shell) > renders match window and expanded view (snapshots) > command-search-collapsed-match 1`] = `
|
||||||
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
"────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
│ (r:) commit │
|
(r:) commit
|
||||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
|
────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
git commit -m "feat: add search" in src/app"
|
git commit -m "feat: add search" in src/app"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`InputPrompt > command search (Ctrl+R when not in shell) > renders match window and expanded view (snapshots) > command-search-expanded-match 1`] = `
|
exports[`InputPrompt > command search (Ctrl+R when not in shell) > renders match window and expanded view (snapshots) > command-search-expanded-match 1`] = `
|
||||||
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
"────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
│ (r:) commit │
|
(r:) commit
|
||||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
|
────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
git commit -m "feat: add search" in src/app"
|
git commit -m "feat: add search" in src/app"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`InputPrompt > snapshots > should not show inverted cursor when shell is focused 1`] = `
|
exports[`InputPrompt > snapshots > should not show inverted cursor when shell is focused 1`] = `
|
||||||
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
"────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
│ > Type your message or @path/to/file │
|
> Type your message or @path/to/file
|
||||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
────────────────────────────────────────────────────────────────────────────────────────────────────"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`InputPrompt > snapshots > should render correctly in shell mode 1`] = `
|
exports[`InputPrompt > snapshots > should render correctly in shell mode 1`] = `
|
||||||
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
"────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
│ ! Type your message or @path/to/file │
|
! Type your message or @path/to/file
|
||||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
────────────────────────────────────────────────────────────────────────────────────────────────────"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`InputPrompt > snapshots > should render correctly in yolo mode 1`] = `
|
exports[`InputPrompt > snapshots > should render correctly in yolo mode 1`] = `
|
||||||
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
"────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
│ * Type your message or @path/to/file │
|
* Type your message or @path/to/file
|
||||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
────────────────────────────────────────────────────────────────────────────────────────────────────"
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`InputPrompt > snapshots > should render correctly when accepting edits 1`] = `
|
exports[`InputPrompt > snapshots > should render correctly when accepting edits 1`] = `
|
||||||
"╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
|
"────────────────────────────────────────────────────────────────────────────────────────────────────
|
||||||
│ > Type your message or @path/to/file │
|
> Type your message or @path/to/file
|
||||||
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯"
|
────────────────────────────────────────────────────────────────────────────────────────────────────"
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user