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