Fix a bug that causes the cursor position to be incorrect when opening new terminals: http://lists.schmorp.de/pipermail/rxvt-unicode/2023q1/002639.html https://bugs.archlinux.org/task/77062 https://gitlab.alpinelinux.org/alpine/aports/-/issues/14525 This patches reverts all changes made to 'src/screen.C' in rxvt-unicode 9.31. --- rxvt-unicode-9.31/src/screen.C 2022-08-08 06:33:08.000000000 -0400 +++ rxvt-unicode-9.30/src/screen.C 2021-07-02 23:55:47.000000000 -0400 @@ -293,7 +293,6 @@ int common_col = min (prev_ncol, ncol); - // resize swap_buf, blank drawn_buf for (int row = min (nrow, prev_nrow); row--; ) { scr_blank_screen_mem (drawn_buf [row], DEFAULT_RSTYLE); @@ -307,7 +306,6 @@ int pend = MOD (term_start + top_row , prev_total_rows); int q = total_rows; // rewrapped row -#if ENABLE_FRILLS if ((rewrap_always || top_row) && !rewrap_never) { // Re-wrap lines. This is rather ugly, possibly because I am too dumb @@ -389,35 +387,36 @@ scr_blank_line (*qline, qline->l, ncol - qline->l, DEFAULT_RSTYLE); } while (p != pend && q > 0); + + term_start = total_rows - nrow; + top_row = q - term_start; + + // make sure all terminal lines exist + while (top_row > 0) + scr_blank_screen_mem (ROW (--top_row), DEFAULT_RSTYLE); } else -#endif { - // wing, instead of wrap - screen.cur.row += nrow - prev_nrow; + // if no scrollback exists (yet), wing, instead of wrap - do + for (int row = min (nrow, prev_nrow); row--; ) { - p = MOD (p - 1, prev_total_rows); - q--; + line_t &src = prev_row_buf [MOD (term_start + row, prev_total_rows)]; + line_t &dst = row_buf [row]; -
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 John Darrington <jmd@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu pa