Skip to content

Commit

Permalink
w
Browse files Browse the repository at this point in the history
  • Loading branch information
christianparpart committed Jul 24, 2021
1 parent be00c9b commit 228f125
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions src/terminal/Grid.h
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,11 @@ class Grid
bool reflowOnResize() const noexcept { return reflowOnResize_; }
void setReflowOnResize(bool _enabled) { reflowOnResize_ = _enabled; }

bool isLineWrapped(LineOffset _line) const noexcept
{
return lines_.at(realLineOffset(_line)).size() > screenSize_.columns;
}

LineCount historyLineCount() const noexcept
{
return linesUsed_ - screenSize_.lines;
Expand Down
14 changes: 7 additions & 7 deletions src/terminal/Screen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1495,13 +1495,13 @@ void Screen::captureBuffer(int _lineCount, bool _logicalLines)
auto capturedBuffer = std::string();
auto writer = VTWriter([&](auto buf, auto len) { capturedBuffer += string_view(buf, len); });

// TODO: when capturing _lineCount < screenSize.lines, start at the lowest non-empty line.
auto const relativeStartLine = _logicalLines ? grid().computeRelativeLineNumberFromBottom(_lineCount)
: unbox<int>(size_.lines) - _lineCount + 1;
auto const startLine = clamp(
1 - unbox<int>(historyLineCount()),
relativeStartLine,
unbox<int>(size_.lines));
// XXX
// if we want 15 logical lines but only 2 real lines are present, then
// the bottom line is taken fully and 14 virtual lines from the top real line.

auto const relativeStartLineOffset = _logicalLines
? grid().lineAt(5).end_offset() - size_.columns.as<int>() * _lineCount
: unbox<int>(size_.lines) - _lineCount + 1;

// dumpState();

Expand Down

0 comments on commit 228f125

Please sign in to comment.