Commit 8345f24e authored by Luis Javier Merino's avatar Luis Javier Merino Committed by Tomaz Canabrava
Browse files

More robust reflow on zsh with semantic prompts

Improve the logic for avoiding doing reflow of zsh prompts (zsh will
repaint the prompt and command line) when there are semantic prompt
markers (OSC 133).

BUG: 447830
parent 81195810
Pipeline #134361 passed with stage
in 2 minutes and 31 seconds
......@@ -487,10 +487,18 @@ void Screen::resizeImage(int new_lines, int new_columns)
// It needs to identify the 'zsh' and calculate the new command line.
auto sessionController = _currentTerminalDisplay->sessionController();
auto terminal = sessionController->session()->foregroundProcessName();
if (terminal == QLatin1String("zsh") && cursorLine > 0 && (_lineProperties.at(cursorLine - 1) & LINE_WRAPPED) != 0) {
while (cursorLine + cursorLineCorrection > 0 && (_lineProperties.at(cursorLine + cursorLineCorrection - 1) & LINE_WRAPPED) != 0) {
if (terminal == QLatin1String("zsh")) {
while (cursorLine + cursorLineCorrection > 0 && (_lineProperties.at(cursorLine + cursorLineCorrection) & LINE_PROMPT_START) == 0) {
--cursorLineCorrection;
}
if (cursorLine + cursorLineCorrection > 0 && (_lineProperties.at(cursorLine + cursorLineCorrection) & LINE_PROMPT_START) != 0) {
_lineProperties[cursorLine + cursorLineCorrection - 1] &= ~LINE_WRAPPED;
} else {
cursorLineCorrection = 0;
while (cursorLine + cursorLineCorrection > 0 && (_lineProperties.at(cursorLine + cursorLineCorrection - 1) & LINE_WRAPPED) != 0) {
--cursorLineCorrection;
}
}
}
}
......
......@@ -734,6 +734,12 @@ void Vt102Emulation::processSessionAttributeRequest(int tokenSize)
return;
}
if (attribute == 133) {
if (value == QLatin1String("A")) {
_currentScreen->setLineProperty(LINE_PROMPT_START, true);
}
}
if (value == QLatin1String("?")) {
// pass terminator type indication here, because OSC response terminator
// should match the terminator of OSC request.
......
......@@ -29,6 +29,7 @@ const int LINE_WRAPPED = (1 << 0);
const int LINE_DOUBLEWIDTH = (1 << 1);
const int LINE_DOUBLEHEIGHT_TOP = (1 << 2);
const int LINE_DOUBLEHEIGHT_BOTTOM = (1 << 3);
const int LINE_PROMPT_START = (1 << 4);
const RenditionFlags DEFAULT_RENDITION = 0;
const RenditionFlags RE_BOLD = (1 << 0);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment