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.
Unified · Split
| @@ -16,7 +16,8 @@ namespace zutty { · 15 unmodified lines | ||
| 16 | 16 | Frame::Frame () {} |
| 17 | 17 | |
| 18 | 18 | 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_) | |
| 20 | 21 | : winPx (winPx_) |
| 21 | 22 | , winPy (winPy_) |
| 22 | 23 | , nCols (nCols_) |
| @@ -25,7 +26,10 @@ namespace zutty { · 2 unmodified lines | ||
| 25 | 26 | , marginTop (0) |
| 26 | 27 | , marginBottom (nRows) |
| 27 | 28 | , cells (CharVdev::make_cells (nCols, nRows)) |
| 28 | − {} | |
| 29 | + { | |
| 30 | + marginTop_ = marginTop; | |
| 31 | + marginBottom_ = marginBottom; | |
| 32 | + } | |
| 29 | 33 | |
| 30 | 34 | void |
| 31 | 35 | Frame::setMargins (uint16_t marginTop_, uint16_t marginBottom_) |
| @@ -33,7 +37,7 @@ namespace zutty { · 1 unmodified line | ||
| 33 | 37 | unwrapCellStorage (); |
| 34 | 38 | scrollHead = marginTop = marginTop_; |
| 35 | 39 | marginBottom = marginBottom_; |
| 36 | − damage.add (0, nRows * nCols); | |
| 40 | + expose (); | |
| 37 | 41 | } |
| 38 | 42 | |
| 39 | 43 | void |
| @@ -42,7 +46,7 @@ namespace zutty { · 2 unmodified lines | ||
| 42 | 46 | unwrapCellStorage (); |
| 43 | 47 | scrollHead = marginTop = marginTop_ = 0; |
| 44 | 48 | marginBottom = marginBottom_ = nRows; |
| 45 | − damage.add (0, nRows * nCols); | |
| 49 | + expose (); | |
| 46 | 50 | } |
| 47 | 51 | |
| 48 | 52 | void |
| @@ -21,7 +21,8 @@ namespace zutty { · 20 unmodified lines | ||
| 21 | 21 | explicit Frame (); |
| 22 | 22 | |
| 23 | 23 | 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_); | |
| 25 | 26 | |
| 26 | 27 | void resize (uint16_t winPx_, uint16_t winPy_, |
| 27 | 28 | uint16_t nCols_, uint16_t nRows_, |
| @@ -500,7 +500,7 @@ namespace zutty { · 499 unmodified lines | ||
| 500 | 500 | , onRefresh ([] (const Frame&) {}) |
| 501 | 501 | , onOsc ([] (int cmd, const std::string& arg) |
| 502 | 502 | { logU << "OSC: '" << cmd << ";" << arg << "'" << std::endl; }) |
| 503 | − , frame_pri (winPx, winPy, nCols, nRows) | |
| 503 | + , frame_pri (winPx, winPy, nCols, nRows, marginTop, marginBottom) | |
| 504 | 504 | , cf (&frame_pri) |
| 505 | 505 | , utf8dec ([this] () { placeGraphicChar (); }) |
| 506 | 506 | , nColsEff (nCols) |
| @@ -544,22 +544,23 @@ namespace zutty { · 37 unmodified lines | ||
| 544 | 544 | cf->winPy = winPy; |
| 545 | 545 | return; |
| 546 | 546 | } |
| 547 | + nCols = nCols_; | |
| 548 | + nRows = nRows_; | |
| 547 | 549 | |
| 548 | 550 | hideCursor (); |
| 549 | 551 | |
| 550 | 552 | if (altScreenBufferMode) |
| 551 | 553 | { |
| 552 | − frame_alt = Frame (winPx, winPy, nCols_, nRows_); | |
| 554 | + frame_alt = Frame (winPx, winPy, nCols, nRows, | |
| 555 | + marginTop, marginBottom); | |
| 553 | 556 | } |
| 554 | 557 | else |
| 555 | 558 | { |
| 556 | − frame_pri.resize (winPx, winPy, nCols_, nRows_, | |
| 559 | + frame_pri.resize (winPx, winPy, nCols, nRows, | |
| 557 | 560 | marginTop, marginBottom); |
| 558 | 561 | frame_alt.freeCells (); |
| 559 | 562 | } |
| 560 | 563 | |
| 561 | − nCols = nCols_; | |
| 562 | − nRows = nRows_; | |
| 563 | 564 | if (horizMarginMode) |
| 564 | 565 | { |
| 565 | 566 | nColsEff = std::min (nColsEff, nCols); |
| @@ -348,7 +348,8 @@ namespace zutty { · 347 unmodified lines | ||
| 348 | 348 | |
| 349 | 349 | if (altScreenBufferMode_) |
| 350 | 350 | { |
| 351 | − frame_alt = Frame (winPx, winPy, nCols, nRows); | |
| 351 | + frame_alt = Frame (winPx, winPy, nCols, nRows, | |
| 352 | + marginTop, marginBottom); | |
| 352 | 353 | cf = &frame_alt; |
| 353 | 354 | cf->expose (); |
| 354 | 355 | |