Skip to content

Commit

Permalink
TerminalSize (Windows): support size in pixel detection
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Sep 3, 2024
1 parent 352ed51 commit d79bf0a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/detection/terminalsize/terminalsize_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ bool ffDetectTerminalSize(FFTerminalSizeResult* result)
}
else
{
ffGetTerminalResponse("\e[18t", "\e[8;%hu;%hut", &result->rows, &result->columns);
// Windows Terminal doesn't report `\e` for some reason
ffGetTerminalResponse("\e[18t", "%*[^;];%hu;%hut", &result->rows, &result->columns);
}
}

Expand All @@ -38,12 +39,10 @@ bool ffDetectTerminalSize(FFTerminalSizeResult* result)
result->width = result->columns * (uint16_t) cfi.dwFontSize.X;
result->height = result->rows * (uint16_t) cfi.dwFontSize.Y;
}
else
if (result->width == 0 || result->height == 0)
{
// Pending https://github.com/microsoft/terminal/issues/8581
// if (result->width == 0 && result->height == 0)
// ffGetTerminalResponse("\033[14t", "\033[4;%hu;%hut", &result->height, &result->width);
return false;
// Windows Terminal doesn't report `\e` for some reason
ffGetTerminalResponse("\e[14t", "%*[^;];%hu;%hut", &result->height, &result->width);
}
}

Expand Down

0 comments on commit d79bf0a

Please sign in to comment.