commit af23a2333b9daa1cbeee4ba29f448ae9011d1c19
parent c530813b9987540f5d82e43263b34e646045c5cd
Author: Pavel Renev <an2qzavok@gmail.com>
Date: Wed, 30 Sep 2020 08:00:20 +0000
fixes for drawing func
Diffstat:
M | sss.c | | | 30 | ++++++++++++++++++------------ |
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/sss.c b/sss.c
@@ -161,10 +161,12 @@ draw_columns(void)
col = 0;
pt = addpt(Pt(defcwidth + view.x, 0), screen->r.min);
while (pt.x < screen->r.max.x) {
- r = rectaddpt(Rect(0, 0, defcwidth, defcheight), pt);
- colnum = smprint("%ld", col);
- draw_cell(screen, r, Ibg2, Iborder, Ifg, colnum, 0);
- free(colnum);
+ if (pt.x >= screen->r.min.x) {
+ r = rectaddpt(Rect(0, 0, defcwidth, defcheight), pt);
+ colnum = smprint("%ld", col);
+ draw_cell(screen, r, Ibg2, Iborder, Ifg, colnum, 0);
+ free(colnum);
+ }
pt.x += defcwidth;
col++;
}
@@ -180,10 +182,12 @@ draw_rows(void)
row = 0;
pt = addpt(Pt(0, defcheight + view.y), screen->r.min);
while (pt.y < screen->r.max.y) {
- r = rectaddpt(Rect(0, 0, defcwidth, defcheight), pt);
- colnum = smprint("%ld", row);
- draw_cell(screen, r, Ibg2, Iborder, Ifg, colnum, 0);
- free(colnum);
+ if (pt.y >= screen->r.min.y) {
+ r = rectaddpt(Rect(0, 0, defcwidth, defcheight), pt);
+ colnum = smprint("%ld", row);
+ draw_cell(screen, r, Ibg2, Iborder, Ifg, colnum, 0);
+ free(colnum);
+ }
pt.y += defcheight;
row++;
}
@@ -227,10 +231,12 @@ draw_cells(void)
pt = addpt(Pt(defcwidth, defcheight), screen->r.min);
pt = addpt(pt, view);
while (pt.y < screen->r.max.y){
- r = rectaddpt(Rect(0,0,defcwidth, defcheight), pt);
- v = table_get(T, xy2addr(x, y));
- text = v.data;
- draw_cell(screen, r, Ibg, Iborder, Ifg, text, -1);
+ if ((pt.x >= screen->r.min.x) && (pt.y >= screen->r.min.y)) {
+ r = rectaddpt(Rect(0,0,defcwidth, defcheight), pt);
+ v = table_get(T, xy2addr(x, y));
+ text = v.data;
+ draw_cell(screen, r, Ibg, Iborder, Ifg, text, -1);
+ };
pt.x += defcwidth;
x++;
if (pt.x > screen->r.max.x){