Package: neomutt
Version: 20220429+dfsg1-1
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Dear maintainer,

the upstream commit e33ff7cab64e2be32a9282a31c418f069af1f023 introduced
a regression that corrupts the user interface under certain conditions:

diff --git a/gui/msgwin.c b/gui/msgwin.c
index 204c0dac2..34c5ece8f 100644
- --- a/gui/msgwin.c
+++ b/gui/msgwin.c
@@ -123,8 +123,9 @@ static int msgwin_repaint(struct MuttWindow *win)

   mutt_curses_set_color_by_id(priv->cid);
   mutt_window_move(win, 0, 0);
- -  mutt_paddstr(win, win->state.cols, priv->text);
+  mutt_window_addstr(win, priv->text);
   mutt_curses_set_color_by_id(MT_COLOR_NORMAL);
+  mutt_window_clrtoeol(win);

   mutt_debug(LL_DEBUG5, "repaint done\n");
   return 0;


I am not exactly sure what causes the regression, typically it only
occurs once when a mailbox is (re-)opened and TAB is used to jump to the
first unread mail, corrupting the index view (see attached screenshots).

However, I found that commit 80b28623d312693c845312bb7053b49d6e0253f0
from the main branch inadvertently fixes the issue again.
I attached said commit as patch.


Cheers
Timo

- -- Package-specific info:
NeoMutt 20220429
Copyright (C) 1996-2022 Michael R. Elkins and others.
NeoMutt comes with ABSOLUTELY NO WARRANTY; for details type 'neomutt -vv'.
NeoMutt is free software, and you are welcome to redistribute it
under certain conditions; type 'neomutt -vv' for details.

System: Linux 5.18.0-4-amd64 (x86_64)
ncurses: ncurses 6.3.20220423 (compiled with 6.3.20220423)
libidn: 1.41 (compiled with 1.41)
GPGME: 1.17.1
GnuTLS: 3.7.7
libnotmuch: 5.6.0
storage: tokyocabinet

Configure options: --build=x86_64-linux-gnu --prefix=/usr 
{--includedir=${prefix}/include} {--mandir=${prefix}/share/man} 
{--infodir=${prefix}/share/info} --sysconfdir=/etc --localstatedir=/var 
--disable-option-checking --disable-silent-rules 
{--libdir=${prefix}/lib/x86_64-linux-gnu} --runstatedir=/run 
--disable-maintainer-mode --disable-dependency-tracking --mandir=/usr/share/man 
--libexecdir=/usr/libexec --with-mailpath=/var/mail --gpgme --lua --notmuch 
--with-ui --gnutls --gss --idn --mixmaster --sasl --tokyocabinet --sqlite 
--autocrypt

Compilation CFLAGS: -g -O2 -ffile-prefix-map=/build/neomutt-20220429+dfsg1=. 
-fstack-protector-strong -Wformat -Werror=format-security -std=c99 
-D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D__EXTENSIONS__ -I/usr/include 
-I/usr/include/lua5.4 -DNCURSES_WIDECHAR -isystem /usr/include/mit-krb5

Default options:
  +attach_headers_color +compose_to_sender +compress +cond_date +debug 
  +encrypt_to_self +forgotten_attachments +forwref +ifdef +imap +index_color 
  +initials +limit_current_thread +multiple_fcc +nested_if +new_mail +nntp +pop 
  +progress +quasi_delete +regcomp +reply_with_xorig +sensible_browser +sidebar 
  +skip_quoted +smtp +status_color +timeout +tls_sni +trash 

Compile options:
  +autocrypt +fcntl -flock -fmemopen +futimens +getaddrinfo +gnutls +gpgme +gss 
  +hcache -homespool +idn +inotify -locales_hack +lua +mixmaster +nls +notmuch 
  -openssl +pgp +regex +sasl +smime +sqlite +sun_attachment 

MAILPATH="/var/mail"
MIXMASTER="mixmaster"
PKGDATADIR="/usr/share/neomutt"
SENDMAIL="/usr/sbin/sendmail"
SYSCONFDIR="/etc"

To learn more about NeoMutt, visit: https://neomutt.org
If you find a bug in NeoMutt, please raise an issue at:
    https://github.com/neomutt/neomutt/issues
or send an email to: <neomutt-de...@neomutt.org>

- -- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.18.0-4-amd64 (SMP w/4 CPU threads; PREEMPT)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages neomutt depends on:
ii  libc6             2.34-6
ii  libgnutls30       3.7.7-2
ii  libgpg-error0     1.45-2
ii  libgpgme11        1.17.1-4
ii  libgssapi-krb5-2  1.20-1
ii  libidn12          1.41-1
ii  liblua5.4-0       5.4.4-3
ii  libncursesw6      6.3+20220423-2
ii  libnotmuch5       0.37-1
ii  libsasl2-2        2.1.28+dfsg-7
ii  libsqlite3-0      3.39.2-1
ii  libtinfo6         6.3+20220423-2
ii  libtokyocabinet9  1.4.48-15
ii  sensible-utils    0.0.17

Versions of packages neomutt recommends:
ii  libsasl2-modules  2.1.28+dfsg-7
ii  locales           2.34-6
ii  mailcap           3.70+nmu1

Versions of packages neomutt suggests:
pn  aspell | ispell                   <none>
ii  ca-certificates                   20211016
ii  gnupg                             2.2.35-3
pn  mixmaster                         <none>
ii  msmtp-mta [mail-transport-agent]  1.8.16-1+b1
ii  openssl                           3.0.5-2
pn  urlview                           <none>

Versions of packages neomutt is related to:
ii  neomutt  20220429+dfsg1-1

- -- no debconf information

-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEJvtDgpxjkjCIVtam+C8H+466LVkFAmMIxO4ACgkQ+C8H+466
LVmPHgwAvmxILEOQF148xTZFLx7z1OEcWJoQa0oDvmgqDHmtK6VniugPyWlhZEvr
zbDYCDhsc5Mw508zINzO1BdK5cJsGb/YhSsBfC1KfuwBjpFrPTaw5kG7lwyvOwov
BumrHacHBDmMSD5AfQ2Y+hmzoQZjcrawZcd3cYvf1msRQI+DWCxbJIU/MhAUdsr2
uR5x+dq/bPGmlkC76aIsWe56GXZPLf7oj7WyLukl6RUdb7hKEsUlP+Ov1K0RDB4S
8yvM/zDjinGNc2h9KRqE0JYhIgEvI0HwBRUIjqTn0t0wzLrEOPLFKu56DAlPZeYJ
c9xhZAvm3B3xxqphM3Ggx8cdZhNPizadXaLksyh2KvbetLGDRj2J57NoFNQG9G+S
u4hpAUvESNpVkJ2KJitxM3iga/OLMUcOQx1SIUiaD5VwxzqPemRJmRqG/IWD4WtZ
CGXnHpqPmHBk9EAvrFmQB55nQMJFLkJnqxJ3yZJQzf61hOYfS5hOdfgbMa+E9eOh
1BEbZ3Hc
=/wRP
-----END PGP SIGNATURE-----
>From 80b28623d312693c845312bb7053b49d6e0253f0 Mon Sep 17 00:00:00 2001
From: Richard Russon <r...@flatcap.org>
Date: Wed, 4 May 2022 16:23:07 +0100
Subject: [PATCH] remove lots of unnecessary refreshes

Remove lots of historic calls to menu_queue_redraw().
In many cases, we already call resolve_email(), which is sufficient.

Also, change the Menu to only send a notification if something actually changed.

Functions affected:
- <delete-message>
- <flag-message>
- <jump>
- <modify-labels>
- <next-entry>
- <next-new>
- <next-thread>
- <next-undeleted>
- <previous-entry>
- <previous-undeleted>
- <root-message>
- <save-message>
- <set-flag>
- <tag-message>
- <toggle-new>
- <undelete-message>
---
 index/functions.c | 40 ++++++++++------------------------------
 menu/move.c       | 11 +++++++----
 2 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/index/functions.c b/index/functions.c
index 39e8acd9f..c45e8884b 100644
--- a/index/functions.c
+++ b/index/functions.c
@@ -295,8 +295,7 @@ static int op_delete(struct IndexSharedData *shared, struct 
IndexPrivateData *pr
   }
   else
   {
-    if (!resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED))
-      menu_queue_redraw(priv->menu, MENU_REDRAW_CURRENT);
+    resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED);
   }
 
   return FR_SUCCESS;
@@ -578,8 +577,7 @@ static int op_flag_message(struct IndexSharedData *shared,
       return FR_NO_ACTION;
     mutt_set_flag(m, shared->email, MUTT_FLAG, !shared->email->flagged);
 
-    if (!resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED))
-      menu_queue_redraw(priv->menu, MENU_REDRAW_CURRENT);
+    resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED);
   }
 
   return FR_SUCCESS;
@@ -700,7 +698,6 @@ static int op_jump(struct IndexSharedData *shared, struct 
IndexPrivateData *priv
   }
 
   mutt_buffer_pool_release(&buf);
-  menu_queue_redraw(priv->menu, MENU_REDRAW_FULL);
   return rc;
 }
 
@@ -1182,8 +1179,7 @@ static int op_main_modify_tags(struct IndexSharedData 
*shared,
       m->changed = true;
     }
 
-    if (!resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED))
-      menu_queue_redraw(priv->menu, MENU_REDRAW_CURRENT);
+    resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED);
   }
   rc = FR_SUCCESS;
 
@@ -1315,7 +1311,6 @@ static int op_main_next_new(struct IndexSharedData 
*shared,
     mutt_message(_("Search wrapped to bottom"));
   }
 
-  menu_queue_redraw(priv->menu, MENU_REDRAW_MOTION);
   return FR_SUCCESS;
 }
 
@@ -1363,8 +1358,6 @@ static int op_main_next_thread(struct IndexSharedData 
*shared,
 
     notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
   }
-  else
-    menu_queue_redraw(priv->menu, MENU_REDRAW_MOTION);
 
   return FR_SUCCESS;
 }
@@ -1391,8 +1384,6 @@ static int op_main_next_undeleted(struct IndexSharedData 
*shared,
     notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
     mutt_error(_("No undeleted messages"));
   }
-  else
-    menu_queue_redraw(priv->menu, MENU_REDRAW_MOTION);
 
   return FR_SUCCESS;
 }
@@ -1442,8 +1433,6 @@ static int op_main_prev_undeleted(struct IndexSharedData 
*shared,
     mutt_error(_("No undeleted messages"));
     notify_send(shared->notify, NT_INDEX, NT_INDEX_EMAIL, NULL);
   }
-  else
-    menu_queue_redraw(priv->menu, MENU_REDRAW_MOTION);
 
   return FR_SUCCESS;
 }
@@ -1524,7 +1513,6 @@ static int op_main_root_message(struct IndexSharedData 
*shared,
   if (index != -1)
     menu_set_index(priv->menu, index);
 
-  menu_queue_redraw(priv->menu, MENU_REDRAW_MOTION);
   return FR_SUCCESS;
 }
 
@@ -1548,9 +1536,9 @@ static int op_main_set_flag(struct IndexSharedData 
*shared,
     {
       menu_queue_redraw(priv->menu, MENU_REDRAW_INDEX);
     }
-    else if (!resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED))
+    else
     {
-      menu_queue_redraw(priv->menu, MENU_REDRAW_CURRENT);
+      resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED);
     }
   }
   emaillist_clear(&el);
@@ -1763,8 +1751,6 @@ static int op_next_entry(struct IndexSharedData *shared, 
struct IndexPrivateData
     return FR_ERROR;
   }
   menu_set_index(priv->menu, index);
-
-  menu_queue_redraw(priv->menu, MENU_REDRAW_MOTION);
   return FR_SUCCESS;
 }
 
@@ -1804,8 +1790,6 @@ static int op_prev_entry(struct IndexSharedData *shared, 
struct IndexPrivateData
     return FR_ERROR;
   }
   menu_set_index(priv->menu, index - 1);
-
-  menu_queue_redraw(priv->menu, MENU_REDRAW_MOTION);
   return FR_SUCCESS;
 }
 
@@ -1976,9 +1960,9 @@ static int op_save(struct IndexSharedData *shared, struct 
IndexPrivateData *priv
     {
       menu_queue_redraw(priv->menu, MENU_REDRAW_INDEX);
     }
-    else if (!resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED))
+    else
     {
-      menu_queue_redraw(priv->menu, MENU_REDRAW_CURRENT);
+      resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED);
     }
   }
   emaillist_clear(&el);
@@ -2055,9 +2039,7 @@ static int op_tag(struct IndexSharedData *shared, struct 
IndexPrivateData *priv,
 
   mutt_set_flag(shared->mailbox, shared->email, MUTT_TAG, 
!shared->email->tagged);
 
-  if (!resolve_email(priv->menu, shared, RESOLVE_NEXT_EMAIL))
-    menu_queue_redraw(priv->menu, MENU_REDRAW_CURRENT);
-
+  resolve_email(priv->menu, shared, RESOLVE_NEXT_EMAIL);
   return FR_SUCCESS;
 }
 
@@ -2122,8 +2104,7 @@ static int op_toggle_new(struct IndexSharedData *shared, 
struct IndexPrivateData
     else
       mutt_set_flag(m, shared->email, MUTT_READ, true);
 
-    if (!resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED))
-      menu_queue_redraw(priv->menu, MENU_REDRAW_CURRENT);
+    resolve_email(priv->menu, shared, RESOLVE_NEXT_UNDELETED);
   }
 
   return FR_SUCCESS;
@@ -2161,8 +2142,7 @@ static int op_undelete(struct IndexSharedData *shared, 
struct IndexPrivateData *
   }
   else
   {
-    if (!resolve_email(priv->menu, shared, RESOLVE_NEXT_EMAIL))
-      menu_queue_redraw(priv->menu, MENU_REDRAW_CURRENT);
+    resolve_email(priv->menu, shared, RESOLVE_NEXT_EMAIL);
   }
 
   return FR_SUCCESS;
diff --git a/menu/move.c b/menu/move.c
index 0893b95d6..a27a861e5 100644
--- a/menu/move.c
+++ b/menu/move.c
@@ -90,11 +90,14 @@ MenuRedrawFlags menu_set_and_notify(struct Menu *menu, int 
top, int index)
     }
   }
 
-  menu->redraw |= flags;
-  menu->win->actions |= WA_REPAINT;
+  if (flags != MENU_REDRAW_NO_FLAGS)
+  {
+    menu->redraw |= flags;
+    menu->win->actions |= WA_REPAINT;
 
-  mutt_debug(LL_NOTIFY, "NT_MENU\n");
-  notify_send(menu->notify, NT_MENU, flags, NULL);
+    mutt_debug(LL_NOTIFY, "NT_MENU\n");
+    notify_send(menu->notify, NT_MENU, flags, NULL);
+  }
   return flags;
 }
 
-- 
2.37.2

Reply via email to