History

Fix missing initialization of Vterm::margin{Top,Bottom} from Frame

Fallout from the refactoring done in 9d888b3. This caused a visible bug, wherein a program in alternate screen mode (e.g., 'less') would become confused after a window resize.

Tom Szilagyi committed 5 years ago

Commit 82856581 parent ce9cbb54 files · +18 −11Browse files

Unified · Split

4 files
  1. src/frame.cc +8 −4
  2. src/frame.h +2 −1
  3. src/vterm.cc +6 −5
  4. src/vterm.icc +2 −1
src/frame.cc+8−4
@@ -16,7 +16,8 @@ namespace zutty { · 15 unmodified lines
1616 Frame::Frame () {}
1717
1818 Frame::Frame (uint16_t winPx_, uint16_t winPy_,
19− uint16_t nCols_, uint16_t nRows_)
19+ uint16_t nCols_, uint16_t nRows_,
20+ uint16_t& marginTop_, uint16_t& marginBottom_)
2021 : winPx (winPx_)
2122 , winPy (winPy_)
2223 , nCols (nCols_)
@@ -25,7 +26,10 @@ namespace zutty { · 2 unmodified lines
2526 , marginTop (0)
2627 , marginBottom (nRows)
2728 , cells (CharVdev::make_cells (nCols, nRows))
28− {}
29+ {
30+ marginTop_ = marginTop;
31+ marginBottom_ = marginBottom;
32+ }
2933
3034 void
3135 Frame::setMargins (uint16_t marginTop_, uint16_t marginBottom_)
@@ -33,7 +37,7 @@ namespace zutty { · 1 unmodified line
3337 unwrapCellStorage ();
3438 scrollHead = marginTop = marginTop_;
3539 marginBottom = marginBottom_;
36− damage.add (0, nRows * nCols);
40+ expose ();
3741 }
3842
3943 void
@@ -42,7 +46,7 @@ namespace zutty { · 2 unmodified lines
4246 unwrapCellStorage ();
4347 scrollHead = marginTop = marginTop_ = 0;
4448 marginBottom = marginBottom_ = nRows;
45− damage.add (0, nRows * nCols);
49+ expose ();
4650 }
4751
4852 void
src/frame.h+2−1
@@ -21,7 +21,8 @@ namespace zutty { · 20 unmodified lines
2121 explicit Frame ();
2222
2323 explicit Frame (uint16_t winPx_, uint16_t winPy_,
24− uint16_t nCols_, uint16_t nRows_);
24+ uint16_t nCols_, uint16_t nRows_,
25+ uint16_t& marginTop_, uint16_t& marginBottom_);
2526
2627 void resize (uint16_t winPx_, uint16_t winPy_,
2728 uint16_t nCols_, uint16_t nRows_,
src/vterm.cc+6−5
@@ -500,7 +500,7 @@ namespace zutty { · 499 unmodified lines
500500 , onRefresh ([] (const Frame&) {})
501501 , onOsc ([] (int cmd, const std::string& arg)
502502 { logU << "OSC: '" << cmd << ";" << arg << "'" << std::endl; })
503− , frame_pri (winPx, winPy, nCols, nRows)
503+ , frame_pri (winPx, winPy, nCols, nRows, marginTop, marginBottom)
504504 , cf (&frame_pri)
505505 , utf8dec ([this] () { placeGraphicChar (); })
506506 , nColsEff (nCols)
@@ -544,22 +544,23 @@ namespace zutty { · 37 unmodified lines
544544 cf->winPy = winPy;
545545 return;
546546 }
547+ nCols = nCols_;
548+ nRows = nRows_;
547549
548550 hideCursor ();
549551
550552 if (altScreenBufferMode)
551553 {
552− frame_alt = Frame (winPx, winPy, nCols_, nRows_);
554+ frame_alt = Frame (winPx, winPy, nCols, nRows,
555+ marginTop, marginBottom);
553556 }
554557 else
555558 {
556− frame_pri.resize (winPx, winPy, nCols_, nRows_,
559+ frame_pri.resize (winPx, winPy, nCols, nRows,
557560 marginTop, marginBottom);
558561 frame_alt.freeCells ();
559562 }
560563
561− nCols = nCols_;
562− nRows = nRows_;
563564 if (horizMarginMode)
564565 {
565566 nColsEff = std::min (nColsEff, nCols);
src/vterm.icc+2−1
@@ -348,7 +348,8 @@ namespace zutty { · 347 unmodified lines
348348
349349 if (altScreenBufferMode_)
350350 {
351− frame_alt = Frame (winPx, winPy, nCols, nRows);
351+ frame_alt = Frame (winPx, winPy, nCols, nRows,
352+ marginTop, marginBottom);
352353 cf = &frame_alt;
353354 cf->expose ();
354355

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t