mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-15 15:50:35 -07:00
feat(ui): add solid background color option for input prompt (#16563)
Co-authored-by: Alexander Farber <farber72@outlook.de>
This commit is contained in:
@@ -4,34 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
import { lerp } from '../../utils/math.js';
|
||||
import { type LoadedSettings } from '../../config/settings.js';
|
||||
import { isAlternateBufferEnabled } from '../hooks/useAlternateBuffer.js';
|
||||
|
||||
const getMainAreaWidthInternal = (terminalWidth: number): number => {
|
||||
if (terminalWidth <= 80) {
|
||||
return Math.round(0.98 * terminalWidth);
|
||||
}
|
||||
if (terminalWidth >= 132) {
|
||||
return Math.round(0.9 * terminalWidth);
|
||||
}
|
||||
|
||||
// Linearly interpolate between 80 columns (98%) and 132 columns (90%).
|
||||
const t = (terminalWidth - 80) / (132 - 80);
|
||||
const percentage = lerp(98, 90, t);
|
||||
|
||||
return Math.round(percentage * terminalWidth * 0.01);
|
||||
};
|
||||
|
||||
export const calculateMainAreaWidth = (
|
||||
terminalWidth: number,
|
||||
settings: LoadedSettings,
|
||||
): number => {
|
||||
if (settings.merged.ui.useFullWidth) {
|
||||
if (isAlternateBufferEnabled(settings)) {
|
||||
return terminalWidth - 1;
|
||||
}
|
||||
return terminalWidth;
|
||||
if (isAlternateBufferEnabled(settings)) {
|
||||
return terminalWidth - 1;
|
||||
}
|
||||
return getMainAreaWidthInternal(terminalWidth);
|
||||
return terminalWidth;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user