From c0de69e4a22519e99dbb19d15e28a13d9ef12e57 Mon Sep 17 00:00:00 2001 From: sawka Date: Tue, 24 Oct 2023 09:27:20 -0700 Subject: [PATCH] move +3 for descenders to termHeightFromRows --- src/plugins/terminal/terminal.tsx | 3 +-- src/util/textmeasure.ts | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/terminal/terminal.tsx b/src/plugins/terminal/terminal.tsx index 4196ac41..2e3c657d 100644 --- a/src/plugins/terminal/terminal.tsx +++ b/src/plugins/terminal/terminal.tsx @@ -153,8 +153,7 @@ class TerminalRenderer extends React.Component< .get(); let cmd = screen.getCmd(line); // will not be null let usedRows = screen.getUsedRows(lineutil.getRendererContext(line), line, cmd, width); - // TODO: replace the +2 with some calculation based on termFontSize. the +2 is for descenders, which get cut off without this. - let termHeight = termHeightFromRows(usedRows, GlobalModel.termFontSize.get()) + 2; + let termHeight = termHeightFromRows(usedRows, GlobalModel.termFontSize.get()); if (usedRows === 0) { termHeight = 0; } diff --git a/src/util/textmeasure.ts b/src/util/textmeasure.ts index 9be33d8f..e6f35b3f 100644 --- a/src/util/textmeasure.ts +++ b/src/util/textmeasure.ts @@ -83,7 +83,8 @@ function termWidthFromCols(cols: number, fontSize: number): number { function termHeightFromRows(rows: number, fontSize: number): number { let dr = getMonoFontSize(fontSize); - return Math.ceil(dr.height * rows); + // TODO: replace the +3 with some calculation based on termFontSize. the +3 is for descenders, which get cut off without this. + return Math.ceil(dr.height * rows) + 3; } export { measureText, getMonoFontSize, windowWidthToCols, windowHeightToRows, termWidthFromCols, termHeightFromRows };