summaryrefslogtreecommitdiff
path: root/packages/cli/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/cli/src')
-rw-r--r--packages/cli/src/ui/App.tsx24
1 files changed, 22 insertions, 2 deletions
diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx
index 43936778..6caa4026 100644
--- a/packages/cli/src/ui/App.tsx
+++ b/packages/cli/src/ui/App.tsx
@@ -294,6 +294,26 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
);
useInput((input: string, key: InkKeyType) => {
+ if (!constrainHeight) {
+ // Automatically re-enter constrain height mode if the user types
+ // anything. When constrainHeight==false, the user will experience
+ // significant flickering so it is best to disable it immediately when
+ // the user starts interacting with the app.
+ setConstrainHeight(true);
+
+ // If our pending history item happens to exceed the terminal height we will most likely need to refresh
+ // our static collection to ensure no duplication or tearing. This is currently working around a core bug
+ // in Ink which we have a PR out to fix: https://github.com/vadimdemedes/ink/pull/717
+ if (pendingHistoryItemRef.current && pendingHistoryItems.length > 0) {
+ const pendingItemDimensions = measureElement(
+ pendingHistoryItemRef.current,
+ );
+ if (pendingItemDimensions.height > availableTerminalHeight) {
+ refreshStatic();
+ }
+ }
+ }
+
if (key.ctrl && input === 'o') {
setShowErrorDetails((prev) => !prev);
refreshStatic();
@@ -315,7 +335,7 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
}
handleExit(ctrlDPressedOnce, setCtrlDPressedOnce, ctrlDTimerRef);
} else if (key.ctrl && input === 's') {
- setConstrainHeight((prev) => !prev);
+ setConstrainHeight(false);
}
});
@@ -523,7 +543,7 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
);
}
const mainAreaWidth = Math.floor(terminalWidth * 0.9);
- const debugConsoleMaxHeight = Math.max(terminalHeight * 0.2, 5);
+ const debugConsoleMaxHeight = Math.floor(Math.max(terminalHeight * 0.2, 5));
// Arbitrary threshold to ensure that items in the static area are large
// enough but not too large to make the terminal hard to use.
const staticAreaMaxItemHeight = Math.max(terminalHeight * 4, 100);