Skip to content

Commit

Permalink
refactor to use statusLineHeight().
Browse files Browse the repository at this point in the history
  • Loading branch information
Utkarsh-khambra committed Feb 25, 2023
1 parent 8db7840 commit affee03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
15 changes: 3 additions & 12 deletions src/vtbackend/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1056,10 +1056,7 @@ void Terminal::resizeScreenInternal(PageSize totalPageSize, std::optional<ImageS
{
// NOTE: This will only resize the currently active buffer.
// Any other buffer will be resized when it is switched to.
auto const statusLineHeight = _hostWritableStatusLineScreen.pageSize().lines;
auto const mainDisplayPageSize = _state.statusDisplayType == StatusDisplayType::None
? totalPageSize
: totalPageSize - statusLineHeight;
auto const mainDisplayPageSize = totalPageSize - statusLineHeight();

auto const oldMainDisplayPageSize = _settings.pageSize;

Expand Down Expand Up @@ -1692,10 +1689,7 @@ void Terminal::hardReset()
_hostWritableStatusLineScreen.clearScreen();
_hostWritableStatusLineScreen.updateCursorIterator();

auto const statusLineHeight = LineCount(1);
auto const mainDisplayPageSize = _state.statusDisplayType == StatusDisplayType::None
? _settings.pageSize
: _settings.pageSize - statusLineHeight;
auto const mainDisplayPageSize = _settings.pageSize - statusLineHeight();

_primaryScreen.margin() =
Margin { Margin::Vertical { {}, boxed_cast<LineOffset>(mainDisplayPageSize.lines) - 1 },
Expand Down Expand Up @@ -1761,10 +1755,7 @@ void Terminal::applyPageSizeToCurrentBuffer()

void Terminal::applyPageSizeToMainDisplay(ScreenType screenType)
{
auto const statusLineHeight = LineCount(1);
auto const mainDisplayPageSize = _state.statusDisplayType == StatusDisplayType::None
? _settings.pageSize
: _settings.pageSize - statusLineHeight;
auto const mainDisplayPageSize = _settings.pageSize - statusLineHeight();

// clang-format off
switch (screenType)
Expand Down
4 changes: 1 addition & 3 deletions src/vtrasterizer/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ void Renderer::updateFontMetrics()

void Renderer::render(Terminal& terminal, bool pressure)
{
auto const statusLineHeight = terminal.state().statusDisplayType == StatusDisplayType::None
? LineCount(0)
: terminal.hostWritableStatusLineDisplay().pageSize().lines;
auto const statusLineHeight = terminal.statusLineHeight();
_gridMetrics.pageSize = terminal.pageSize() + statusLineHeight;

executeImageDiscards();
Expand Down

0 comments on commit affee03

Please sign in to comment.