move +3 for descenders to termHeightFromRows

This commit is contained in:
sawka 2023-10-24 09:27:20 -07:00
parent 082fe4a425
commit c0de69e4a2
2 changed files with 3 additions and 3 deletions

View File

@ -153,8 +153,7 @@ class TerminalRenderer extends React.Component<
.get(); .get();
let cmd = screen.getCmd(line); // will not be null let cmd = screen.getCmd(line); // will not be null
let usedRows = screen.getUsedRows(lineutil.getRendererContext(line), line, cmd, width); 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());
let termHeight = termHeightFromRows(usedRows, GlobalModel.termFontSize.get()) + 2;
if (usedRows === 0) { if (usedRows === 0) {
termHeight = 0; termHeight = 0;
} }

View File

@ -83,7 +83,8 @@ function termWidthFromCols(cols: number, fontSize: number): number {
function termHeightFromRows(rows: number, fontSize: number): number { function termHeightFromRows(rows: number, fontSize: number): number {
let dr = getMonoFontSize(fontSize); 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 }; export { measureText, getMonoFontSize, windowWidthToCols, windowHeightToRows, termWidthFromCols, termHeightFromRows };