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:
Mario Zechner 2026-02-02 08:10:08 +01:00
parent 419c07fb19
commit 0925fafe3b
8 changed files with 80 additions and 48 deletions

View file

@ -258,6 +258,7 @@ export class InteractiveMode {
this.session = session;
this.version = VERSION;
this.ui = new TUI(new ProcessTerminal(), this.settingsManager.getShowHardwareCursor());
this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
this.headerContainer = new Container();
this.chatContainer = new Container();
this.pendingMessagesContainer = new Container();
@ -2996,6 +2997,7 @@ export class InteractiveMode {
editorPaddingX: this.settingsManager.getEditorPaddingX(),
autocompleteMaxVisible: this.settingsManager.getAutocompleteMaxVisible(),
quietStartup: this.settingsManager.getQuietStartup(),
clearOnShrink: this.settingsManager.getClearOnShrink(),
},
{
onAutoCompactChange: (enabled) => {
@ -3084,6 +3086,10 @@ export class InteractiveMode {
this.editor.setAutocompleteMaxVisible(maxVisible);
}
},
onClearOnShrinkChange: (enabled) => {
this.settingsManager.setClearOnShrink(enabled);
this.ui.setClearOnShrink(enabled);
},
onCancel: () => {
done();
this.ui.requestRender();