fix(tui): reduce unnecessary full redraws for better performance
- Remove height change detection (only width changes trigger full redraw) - Change clearOnShrink default to false (use PI_CLEAR_ON_SHRINK=1 to enable) - Fix viewport check to use previousLines.length instead of maxLinesRendered (prevents false positive redraws when appending lines after content shrunk) - Add clearOnShrink setting to /settings in coding-agent - Remove line truncation in custom message component (always show full content)
This commit is contained in:
@@ -21,6 +21,7 @@ export interface RetrySettings {
|
||||
|
||||
export interface TerminalSettings {
|
||||
showImages?: boolean; // default: true (only relevant if terminal supports images)
|
||||
clearOnShrink?: boolean; // default: false (clear empty rows when content shrinks)
|
||||
}
|
||||
|
||||
export interface ImageSettings {
|
||||
@@ -628,6 +629,23 @@ export class SettingsManager {
|
||||
this.save();
|
||||
}
|
||||
|
||||
getClearOnShrink(): boolean {
|
||||
// Settings takes precedence, then env var, then default false
|
||||
if (this.settings.terminal?.clearOnShrink !== undefined) {
|
||||
return this.settings.terminal.clearOnShrink;
|
||||
}
|
||||
return process.env.PI_CLEAR_ON_SHRINK === "1";
|
||||
}
|
||||
|
||||
setClearOnShrink(enabled: boolean): void {
|
||||
if (!this.globalSettings.terminal) {
|
||||
this.globalSettings.terminal = {};
|
||||
}
|
||||
this.globalSettings.terminal.clearOnShrink = enabled;
|
||||
this.markModified("terminal", "clearOnShrink");
|
||||
this.save();
|
||||
}
|
||||
|
||||
getImageAutoResize(): boolean {
|
||||
return this.settings.images?.autoResize ?? true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user