- Fix critical regression: on Linux, Ctrl+C could not interrupt/clear/exit because isAction(key,'c') shadowed the isCtrl block (both resolve to k.ctrl on non-macOS). Restructured: isAction block now falls through to interrupt logic on non-macOS when no selection exists. - Remove double pbcopy: ink's copySelection() already calls setClipboard() which handles pbcopy+tmux+OSC52. The extra writeClipboardText call in useInputHandlers copySelection() was firing pbcopy a second time. - Remove allowClipboardHotkeys prop from TextInput — every caller passed isMac, and TextInput already imports isMac. Eliminated prop-drilling through appLayout, maskedPrompt, and prompts. - Remove dead code: the isCtrl copy paths (lines 277-288) were unreachable on any platform after the isAction block changes. - Simplify textInput Cmd+C: use writeClipboardText directly without the redundant OSC52 fallback (this path is macOS-only where pbcopy works).
34 lines
823 B
TypeScript
34 lines
823 B
TypeScript
import { Box, Text } from '@hermes/ink'
|
|
import { useState } from 'react'
|
|
|
|
import type { Theme } from '../theme.js'
|
|
|
|
import { TextInput } from './textInput.js'
|
|
|
|
export function MaskedPrompt({ cols = 80, icon, label, onSubmit, sub, t }: MaskedPromptProps) {
|
|
const [value, setValue] = useState('')
|
|
|
|
return (
|
|
<Box flexDirection="column">
|
|
<Text bold color={t.color.warn}>
|
|
{icon} {label}
|
|
</Text>
|
|
|
|
{sub && <Text color={t.color.dim}> {sub}</Text>}
|
|
|
|
<Box>
|
|
<Text color={t.color.label}>{'> '}</Text>
|
|
<TextInput columns={Math.max(20, cols - 6)} mask="*" onChange={setValue} onSubmit={onSubmit} value={value} />
|
|
</Box>
|
|
</Box>
|
|
)
|
|
}
|
|
|
|
interface MaskedPromptProps {
|
|
cols?: number
|
|
icon: string
|
|
label: string
|
|
onSubmit: (v: string) => void
|
|
sub?: string
|
|
t: Theme
|
|
}
|