mirror of https://github.com/buster-so/buster.git
hide vim mode
This commit is contained in:
parent
fe79f4e979
commit
de2f13e311
|
@ -24,6 +24,7 @@ export function Main() {
|
|||
const [vimEnabled] = useState(() => getSetting('vimMode'));
|
||||
const [currentVimMode, setCurrentVimMode] = useState<VimMode>('insert');
|
||||
const [showSettings, setShowSettings] = useState(false);
|
||||
const [isAutocompleteOpen, setIsAutocompleteOpen] = useState(false);
|
||||
|
||||
useInput((value, key) => {
|
||||
if (key.ctrl && value === 'c') {
|
||||
|
@ -98,8 +99,13 @@ export function Main() {
|
|||
placeholder='Try "Review the changes in my current branch"'
|
||||
onVimModeChange={setCurrentVimMode}
|
||||
onCommandExecute={handleCommandExecute}
|
||||
onAutocompleteStateChange={setIsAutocompleteOpen}
|
||||
/>
|
||||
<VimStatus
|
||||
vimMode={currentVimMode}
|
||||
vimEnabled={vimEnabled}
|
||||
hideWhenAutocomplete={isAutocompleteOpen}
|
||||
/>
|
||||
<VimStatus vimMode={currentVimMode} vimEnabled={vimEnabled} />
|
||||
</Box>
|
||||
<ChatFooter />
|
||||
</Box>
|
||||
|
|
|
@ -66,10 +66,11 @@ export function ChatStatusBar() {
|
|||
interface VimStatusProps {
|
||||
vimMode?: 'normal' | 'insert' | 'visual';
|
||||
vimEnabled?: boolean;
|
||||
hideWhenAutocomplete?: boolean;
|
||||
}
|
||||
|
||||
export function VimStatus({ vimMode, vimEnabled }: VimStatusProps) {
|
||||
if (!vimEnabled || !vimMode) {
|
||||
export function VimStatus({ vimMode, vimEnabled, hideWhenAutocomplete }: VimStatusProps) {
|
||||
if (!vimEnabled || !vimMode || hideWhenAutocomplete) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -105,6 +106,7 @@ interface ChatInputProps {
|
|||
onSubmit: () => void;
|
||||
onVimModeChange?: (mode: 'normal' | 'insert' | 'visual') => void;
|
||||
onCommandExecute?: (command: SlashCommand) => void;
|
||||
onAutocompleteStateChange?: (isOpen: boolean) => void;
|
||||
}
|
||||
|
||||
export function ChatInput({
|
||||
|
@ -114,6 +116,7 @@ export function ChatInput({
|
|||
onSubmit,
|
||||
onVimModeChange,
|
||||
onCommandExecute,
|
||||
onAutocompleteStateChange,
|
||||
}: ChatInputProps) {
|
||||
const [mentionQuery, setMentionQuery] = useState<string | null>(null);
|
||||
const [mentionStart, setMentionStart] = useState<number>(-1);
|
||||
|
@ -188,6 +191,12 @@ export function ChatInput({
|
|||
}
|
||||
}, [slashQuery]);
|
||||
|
||||
// Notify parent when autocomplete state changes
|
||||
useEffect(() => {
|
||||
const isOpen = showAutocomplete || showCommandAutocomplete;
|
||||
onAutocompleteStateChange?.(isOpen);
|
||||
}, [showAutocomplete, showCommandAutocomplete, onAutocompleteStateChange]);
|
||||
|
||||
// Handle autocomplete navigation
|
||||
const handleAutocompleteNavigate = (direction: 'up' | 'down' | 'select' | 'close') => {
|
||||
// Handle command autocomplete
|
||||
|
|
Loading…
Reference in New Issue