summaryrefslogtreecommitdiff
path: root/st.c.rej
diff options
context:
space:
mode:
authorstefan <stefan@s00.xyz>2023-04-14 20:54:13 -0400
committerstefan <stefan@s00.xyz>2023-04-14 20:54:13 -0400
commit644a54d987f75dc9036904c4f1ef320fe7fdec7d (patch)
treed2371e00d0bfa43c1b556dfea6151e52c611af76 /st.c.rej
parentea4d4ad4ef0eae8f78d9e38bc3dc3145edded12a (diff)
downloadst-644a54d987f75dc9036904c4f1ef320fe7fdec7d.tar.gz
clean
Diffstat (limited to 'st.c.rej')
-rw-r--r--st.c.rej149
1 files changed, 0 insertions, 149 deletions
diff --git a/st.c.rej b/st.c.rej
deleted file mode 100644
index de7bc2c..0000000
--- a/st.c.rej
+++ /dev/null
@@ -1,149 +0,0 @@
---- st.c
-+++ st.c
-@@ -1435,89 +1598,93 @@ tsetchar(Rune u, const Glyph *attr, int x, int y)
- } else if (term.line[y][x].mode & ATTR_WDUMMY) {
- term.line[y][x-1].u = ' ';
- term.line[y][x-1].mode &= ~ATTR_WIDE;
-- }
-+ }
-
- term.dirty[y] = 1;
- term.line[y][x] = *attr;
- term.line[y][x].u = u;
-+ term.line[y][x].mode |= ATTR_SET;
- }
-
- void
--tclearregion(int x1, int y1, int x2, int y2)
-+tclearglyph(Glyph *gp, int usecurattr)
- {
-- int x, y, temp;
-- Glyph *gp;
-+ if (usecurattr) {
-+ gp->fg = term.c.attr.fg;
-+ gp->bg = term.c.attr.bg;
-+ } else {
-+ gp->fg = defaultfg;
-+ gp->bg = defaultbg;
-+ }
-+ gp->mode = ATTR_NULL;
-+ gp->u = ' ';
-+}
-
-- if (x1 > x2)
-- temp = x1, x1 = x2, x2 = temp;
-- if (y1 > y2)
-- temp = y1, y1 = y2, y2 = temp;
-+void
-+tclearregion(int x1, int y1, int x2, int y2, int usecurattr)
-+{
-+ int x, y;
-
-- LIMIT(x1, 0, term.col-1);
-- LIMIT(x2, 0, term.col-1);
-- LIMIT(y1, 0, term.row-1);
-- LIMIT(y2, 0, term.row-1);
-+ /* regionselected() takes relative coordinates */
-+ if (regionselected(x1+term.scr, y1+term.scr, x2+term.scr, y2+term.scr))
-+ selremove();
-
- for (y = y1; y <= y2; y++) {
- term.dirty[y] = 1;
-- for (x = x1; x <= x2; x++) {
-- gp = &term.line[y][x];
-- if (selected(x, y))
-- selclear();
-- gp->fg = term.c.attr.fg;
-- gp->bg = term.c.attr.bg;
-- gp->mode = 0;
-- gp->u = ' ';
-- }
-+ for (x = x1; x <= x2; x++)
-+ tclearglyph(&term.line[y][x], usecurattr);
- }
- }
-
- void
- tdeletechar(int n)
- {
-- int dst, src, size;
-- Glyph *line;
--
-- LIMIT(n, 0, term.col - term.c.x);
-+ int src, dst, size;
-+ Line line;
-
-+ if (n <= 0)
-+ return;
- dst = term.c.x;
-- src = term.c.x + n;
-+ src = MIN(term.c.x + n, term.col);
- size = term.col - src;
-- line = term.line[term.c.y];
--
-- memmove(&line[dst], &line[src], size * sizeof(Glyph));
-- tclearregion(term.col-n, term.c.y, term.col-1, term.c.y);
-+ if (size > 0) { /* otherwise src would point beyond the array
-+ https://stackoverflow.com/questions/29844298 */
-+ line = term.line[term.c.y];
-+ memmove(&line[dst], &line[src], size * sizeof(Glyph));
-+ }
-+ tclearregion(dst + size, term.c.y, term.col - 1, term.c.y, 1);
- }
-
- void
- tinsertblank(int n)
- {
-- int dst, src, size;
-- Glyph *line;
-+ int src, dst, size;
-+ Line line;
-
-- LIMIT(n, 0, term.col - term.c.x);
--
-- dst = term.c.x + n;
-+ if (n <= 0)
-+ return;
-+ dst = MIN(term.c.x + n, term.col);
- src = term.c.x;
- size = term.col - dst;
-- line = term.line[term.c.y];
--
-- memmove(&line[dst], &line[src], size * sizeof(Glyph));
-- tclearregion(src, term.c.y, dst - 1, term.c.y);
-+ if (size > 0) { /* otherwise dst would point beyond the array */
-+ line = term.line[term.c.y];
-+ memmove(&line[dst], &line[src], size * sizeof(Glyph));
-+ }
-+ tclearregion(src, term.c.y, dst - 1, term.c.y, 1);
- }
-
- void
- tinsertblankline(int n)
- {
- if (BETWEEN(term.c.y, term.top, term.bot))
-- tscrolldown(term.c.y, n, 0);
-+ tscrolldown(term.c.y, n);
- }
-
- void
- tdeleteline(int n)
- {
- if (BETWEEN(term.c.y, term.top, term.bot))
-- tscrollup(term.c.y, n, 0);
-+ tscrollup(term.c.y, term.bot, n, SCROLL_NOSAVEHIST);
- }
-
- int32_t
-@@ -2001,9 +2173,9 @@ csihandle(void)
- break;
- case 'n': /* DSR – Device Status Report (cursor position) */
- if (csiescseq.arg[0] == 6) {
-- len = snprintf(buf, sizeof(buf), "\033[%i;%iR",
-+ n = snprintf(buf, sizeof(buf), "\033[%i;%iR",
- term.c.y+1, term.c.x+1);
-- ttywrite(buf, len, 0);
-+ ttywrite(buf, n, 0);
- }
- break;
- case 'r': /* DECSTBM -- Set Scrolling Region */
© 2025 Stefan Weigl-Bosker