Skip to content

Commit cf61a46

Browse files
author
mitchell
committed
Fix more drawing issues related to clipping.
Do not highlight cells or draw tabs or indentation guides outside regions.
1 parent 2ac9cdd commit cf61a46

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

ScintillaCurses.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ class SurfaceImpl : public Surface {
359359
*/
360360
void AlphaRectangle(PRectangle rc, XYPOSITION cornerSize, FillStroke fillStroke) override {
361361
ColourRGBA &fill = fillStroke.fill.colour;
362-
for (int x = rc.left, y = rc.top - 1; x < rc.right; x++) {
362+
for (int x = std::max(rc.left, clip.left), y = rc.top - 1; x < rc.right; x++) {
363363
attr_t attrs = mvwinch(win, y, x) & A_ATTRIBUTES;
364364
short pair = PAIR_NUMBER(attrs), fore, unused;
365365
if (pair > 0) pair_content(pair, &fore, &unused);
@@ -387,6 +387,7 @@ class SurfaceImpl : public Surface {
387387
*/
388388
void Copy(PRectangle rc, Point from, Surface &surfaceSource) override {
389389
// TODO: handle indent guide highlighting.
390+
if (rc.left - 1 < clip.left) return;
390391
wattr_set(win, 0, term_color_pair(COLOR_BLACK, COLOR_BLACK), nullptr);
391392
mvwaddch(win, rc.top, rc.left - 1, '|' | A_BOLD);
392393
}
@@ -580,7 +581,8 @@ class SurfaceImpl : public Surface {
580581
void DrawTabArrow(PRectangle rcTab, const ViewStyle &vsDraw) {
581582
// TODO: set color to vs.whitespaceColours.fore and back.
582583
wattr_set(win, 0, term_color_pair(COLOR_BLACK, COLOR_BLACK), nullptr);
583-
for (int i = rcTab.left - 1; i < rcTab.right; i++) mvwaddch(win, rcTab.top, i, '-' | A_BOLD);
584+
for (int i = std::max(rcTab.left - 1, clip.left); i < rcTab.right; i++)
585+
mvwaddch(win, rcTab.top, i, '-' | A_BOLD);
584586
char tail = vsDraw.tabDrawMode == TabDrawMode::LongArrow ? '>' : '-';
585587
mvwaddch(win, rcTab.top, rcTab.right, tail | A_BOLD);
586588
}

0 commit comments

Comments
 (0)