projects/guix·blob python-team · refs

79 lines · 2.7 KiB

1Fix a bug that causes the cursor position to be incorrect when opening
2new terminals:
3
4http://lists.schmorp.de/pipermail/rxvt-unicode/2023q1/002639.html
5https://bugs.archlinux.org/task/77062
6https://gitlab.alpinelinux.org/alpine/aports/-/issues/14525
7
8This patches reverts all changes made to 'src/screen.C' in rxvt-unicode 9.31.
9
10--- rxvt-unicode-9.31/src/screen.C 2022-08-08 06:33:08.000000000 -0400
11+++ rxvt-unicode-9.30/src/screen.C 2021-07-02 23:55:47.000000000 -0400
12@@ -293,7 +293,6 @@
13
14 int common_col = min (prev_ncol, ncol);
15
16- // resize swap_buf, blank drawn_buf
17 for (int row = min (nrow, prev_nrow); row--; )
18 {
19 scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE);
20@@ -307,7 +306,6 @@
21 int pend = MOD (term_start + top_row , prev_total_rows);
22 int q = total_rows; // rewrapped row
23
24-#if ENABLE_FRILLS
25 if ((rewrap_always || top_row) && !rewrap_never)
26 {
27 // Re-wrap lines. This is rather ugly, possibly because I am too dumb
28@@ -389,35 +387,36 @@
29 scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE);
30 }
31 while (p != pend && q > 0);
32+
33+ term_start = total_rows - nrow;
34+ top_row = q - term_start;
35+
36+ // make sure all terminal lines exist
37+ while (top_row > 0)
38+ scr_blank_screen_mem (ROW (--top_row), DEFAULT_RSTYLE);
39 }
40 else
41-#endif
42 {
43- // wing, instead of wrap
44- screen.cur.row += nrow - prev_nrow;
45+ // if no scrollback exists (yet), wing, instead of wrap
46
47- do
48+ for (int row = min (nrow, prev_nrow); row--; )
49 {
50- p = MOD (p - 1, prev_total_rows);
51- q--;
52+ line_t &src = prev_row_buf [MOD (term_start + row, prev_total_rows)];
53+ line_t &dst = row_buf [row];
54
55- copy_line (row_buf [q], prev_row_buf [p]);
56+ copy_line (dst, src);
57 }
58- while (p != pend && q > 0);
59- }
60
61- term_start = total_rows - nrow;
62- top_row = q - term_start;
63+ for (int row = prev_nrow; row < nrow; row++)
64+ scr_blank_screen_mem (row_buf [row], DEFAULT_RSTYLE);
65
66- // make sure all terminal lines exist
67- while (top_row > 0)
68- scr_blank_screen_mem (ROW (--top_row), DEFAULT_RSTYLE);
69+ term_start = 0;
70+ }
71
72 clamp_it (screen.cur.row, 0, nrow - 1);
73 clamp_it (screen.cur.col, 0, ncol - 1);
74 }
75
76- // ensure drawn_buf, swap_buf and terminal rows are all initialized
77 for (int row = nrow; row--; )
78 {
79 if (!ROW (row).valid ()) scr_blank_screen_mem (ROW (row), DEFAULT_RSTYLE);