mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-22 11:04:42 -07:00
feat(cli): prototype clean UI toggle and minimal-mode bleed-through (#18683)
This commit is contained in:
@@ -144,6 +144,8 @@ export function isLargePaste(text: string): boolean {
|
||||
);
|
||||
}
|
||||
|
||||
const DOUBLE_TAB_CLEAN_UI_TOGGLE_WINDOW_MS = 350;
|
||||
|
||||
/**
|
||||
* Attempt to toggle expansion of a paste placeholder in the buffer.
|
||||
* Returns true if a toggle action was performed or hint was shown, false otherwise.
|
||||
@@ -211,7 +213,11 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
||||
const { merged: settings } = useSettings();
|
||||
const kittyProtocol = useKittyKeyboardProtocol();
|
||||
const isShellFocused = useShellFocusState();
|
||||
const { setEmbeddedShellFocused, setShortcutsHelpVisible } = useUIActions();
|
||||
const {
|
||||
setEmbeddedShellFocused,
|
||||
setShortcutsHelpVisible,
|
||||
toggleCleanUiDetailsVisible,
|
||||
} = useUIActions();
|
||||
const {
|
||||
terminalWidth,
|
||||
activePtyId,
|
||||
@@ -223,6 +229,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
||||
} = useUIState();
|
||||
const [suppressCompletion, setSuppressCompletion] = useState(false);
|
||||
const escPressCount = useRef(0);
|
||||
const lastPlainTabPressTimeRef = useRef<number | null>(null);
|
||||
const [showEscapePrompt, setShowEscapePrompt] = useState(false);
|
||||
const escapeTimerRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const [recentUnsafePasteTime, setRecentUnsafePasteTime] = useState<
|
||||
@@ -624,6 +631,33 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
||||
return false;
|
||||
}
|
||||
|
||||
const isPlainTab =
|
||||
key.name === 'tab' && !key.shift && !key.alt && !key.ctrl && !key.cmd;
|
||||
const hasTabCompletionInteraction =
|
||||
completion.showSuggestions ||
|
||||
Boolean(completion.promptCompletion.text) ||
|
||||
reverseSearchActive ||
|
||||
commandSearchActive;
|
||||
if (isPlainTab) {
|
||||
if (!hasTabCompletionInteraction) {
|
||||
const now = Date.now();
|
||||
const isDoubleTabPress =
|
||||
lastPlainTabPressTimeRef.current !== null &&
|
||||
now - lastPlainTabPressTimeRef.current <=
|
||||
DOUBLE_TAB_CLEAN_UI_TOGGLE_WINDOW_MS;
|
||||
if (isDoubleTabPress) {
|
||||
lastPlainTabPressTimeRef.current = null;
|
||||
toggleCleanUiDetailsVisible();
|
||||
return true;
|
||||
}
|
||||
lastPlainTabPressTimeRef.current = now;
|
||||
} else {
|
||||
lastPlainTabPressTimeRef.current = null;
|
||||
}
|
||||
} else {
|
||||
lastPlainTabPressTimeRef.current = null;
|
||||
}
|
||||
|
||||
if (key.name === 'paste') {
|
||||
if (shortcutsHelpVisible) {
|
||||
setShortcutsHelpVisible(false);
|
||||
@@ -1172,6 +1206,7 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
|
||||
kittyProtocol.enabled,
|
||||
shortcutsHelpVisible,
|
||||
setShortcutsHelpVisible,
|
||||
toggleCleanUiDetailsVisible,
|
||||
tryLoadQueuedMessages,
|
||||
setBannerVisible,
|
||||
onSubmit,
|
||||
|
||||
Reference in New Issue
Block a user