From 93a94308bd8fcc871291afb94026640f6e28a08e Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Sat, 15 Oct 2022 08:52:20 +0200 Subject: [PATCH] Merge pull request #1417 from ailin-nemui/loop do not freeze on alt+left/right (cherry picked from commit 0c97433c7c41e50744da1c2ceaf19131e96fdf18) --- src/fe-text/mainwindows.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fe-text/mainwindows.c b/src/fe-text/mainwindows.c index fae7ced8..26b94248 100644 --- a/src/fe-text/mainwindows.c +++ b/src/fe-text/mainwindows.c @@ -1629,6 +1629,7 @@ static int window_refnum_left(int refnum, int wrap) { MAIN_WINDOW_REC *find_sticky; WINDOW_REC *window; + int start_refnum = refnum; window = window_find_refnum(refnum); g_return_val_if_fail(window != NULL, -1); @@ -1638,7 +1639,7 @@ static int window_refnum_left(int refnum, int wrap) do { refnum = window_refnum_prev(refnum, wrap); - if (refnum < 0) + if (refnum < 0 || refnum == start_refnum) break; window = window_find_refnum(refnum); @@ -1651,6 +1652,7 @@ static int window_refnum_right(int refnum, int wrap) { MAIN_WINDOW_REC *find_sticky; WINDOW_REC *window; + int start_refnum = refnum; window = window_find_refnum(refnum); g_return_val_if_fail(window != NULL, -1); @@ -1660,7 +1662,7 @@ static int window_refnum_right(int refnum, int wrap) do { refnum = window_refnum_next(refnum, wrap); - if (refnum < 0) + if (refnum < 0 || refnum == start_refnum) break; window = window_find_refnum(refnum);