diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-02-10 17:00:59 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-25 00:04:47 +0200 |
commit | 2130ed48ceb0db955b942b942bac82a5b6aee57b (patch) | |
tree | 8e1ce060e18332c8ec8f2afa7366a7e4e72ce430 /overlays/neomutt/commands.patch | |
parent | b437ebc0449a8776b8007ab895e2290e75c01002 (diff) | |
download | NUR-2130ed48ceb0db955b942b942bac82a5b6aee57b.tar.gz NUR-2130ed48ceb0db955b942b942bac82a5b6aee57b.tar.zst NUR-2130ed48ceb0db955b942b942bac82a5b6aee57b.zip |
Add neomutt patch for empty mailboxes
Diffstat (limited to 'overlays/neomutt/commands.patch')
-rw-r--r-- | overlays/neomutt/commands.patch | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/overlays/neomutt/commands.patch b/overlays/neomutt/commands.patch new file mode 100644 index 00000000..6c910cfb --- /dev/null +++ b/overlays/neomutt/commands.patch | |||
@@ -0,0 +1,87 @@ | |||
1 | commit 763056828abe9716c4dfce754a47d8ecdefb3029 | ||
2 | Author: Ismaël Bouya <ismael.bouya@normalesup.org> | ||
3 | Date: Mon Feb 10 16:13:33 2020 +0100 | ||
4 | |||
5 | Fix commands that don’t need to have a non-empty mailbox to be valid | ||
6 | |||
7 | Some commands act on the whole mailbox (tag-pattern, delete-pattern, | ||
8 | search), and even though they don’t do anything when the mailbox is | ||
9 | empty, there is no reason to fail when it happens. This commit removes | ||
10 | the check that the mailbox is non-empty before doing said actions. | ||
11 | |||
12 | diff --git a/index.c b/index.c | ||
13 | index 0f4b9f99f..0adfc19f1 100644 | ||
14 | --- a/index.c | ||
15 | +++ b/index.c | ||
16 | @@ -1642,7 +1642,7 @@ int mutt_index_menu(struct MuttWindow *dlg) | ||
17 | case OP_JUMP: | ||
18 | { | ||
19 | int msg_num = 0; | ||
20 | - if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE)) | ||
21 | + if (!prereq(Context, menu, CHECK_IN_MAILBOX)) | ||
22 | break; | ||
23 | if (isdigit(LastKey)) | ||
24 | mutt_unget_event(LastKey, 0); | ||
25 | @@ -1687,7 +1687,7 @@ int mutt_index_menu(struct MuttWindow *dlg) | ||
26 | |||
27 | case OP_MAIN_DELETE_PATTERN: | ||
28 | if (!prereq(Context, menu, | ||
29 | - CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE | CHECK_READONLY | CHECK_ATTACH)) | ||
30 | + CHECK_IN_MAILBOX | CHECK_READONLY | CHECK_ATTACH)) | ||
31 | { | ||
32 | break; | ||
33 | } | ||
34 | @@ -1852,12 +1852,17 @@ int mutt_index_menu(struct MuttWindow *dlg) | ||
35 | menu->redraw = REDRAW_FULL; | ||
36 | break; | ||
37 | |||
38 | - case OP_SEARCH: | ||
39 | + // Initiating a search can happen on an empty mailbox, but | ||
40 | + // searching for next/previous/... needs to be on a message and | ||
41 | + // thus a non-empty mailbox | ||
42 | case OP_SEARCH_REVERSE: | ||
43 | case OP_SEARCH_NEXT: | ||
44 | case OP_SEARCH_OPPOSITE: | ||
45 | if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE)) | ||
46 | break; | ||
47 | + case OP_SEARCH: | ||
48 | + if (!prereq(Context, menu, CHECK_IN_MAILBOX)) | ||
49 | + break; | ||
50 | menu->current = mutt_search_command(menu->current, op); | ||
51 | if (menu->current == -1) | ||
52 | menu->current = menu->oldcurrent; | ||
53 | @@ -1926,14 +1931,14 @@ int mutt_index_menu(struct MuttWindow *dlg) | ||
54 | } | ||
55 | |||
56 | case OP_MAIN_TAG_PATTERN: | ||
57 | - if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE)) | ||
58 | + if (!prereq(Context, menu, CHECK_IN_MAILBOX)) | ||
59 | break; | ||
60 | mutt_pattern_func(MUTT_TAG, _("Tag messages matching: ")); | ||
61 | menu->redraw |= REDRAW_INDEX | REDRAW_STATUS; | ||
62 | break; | ||
63 | |||
64 | case OP_MAIN_UNDELETE_PATTERN: | ||
65 | - if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE | CHECK_READONLY)) | ||
66 | + if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_READONLY)) | ||
67 | break; | ||
68 | /* L10N: CHECK_ACL */ | ||
69 | /* L10N: Due to the implementation details we do not know whether we | ||
70 | @@ -1950,7 +1955,7 @@ int mutt_index_menu(struct MuttWindow *dlg) | ||
71 | break; | ||
72 | |||
73 | case OP_MAIN_UNTAG_PATTERN: | ||
74 | - if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE)) | ||
75 | + if (!prereq(Context, menu, CHECK_IN_MAILBOX)) | ||
76 | break; | ||
77 | if (mutt_pattern_func(MUTT_UNTAG, _("Untag messages matching: ")) == 0) | ||
78 | menu->redraw |= REDRAW_INDEX | REDRAW_STATUS; | ||
79 | @@ -3189,7 +3194,7 @@ int mutt_index_menu(struct MuttWindow *dlg) | ||
80 | } | ||
81 | |||
82 | case OP_MAIN_COLLAPSE_ALL: | ||
83 | - if (!prereq(Context, menu, CHECK_IN_MAILBOX | CHECK_MSGCOUNT | CHECK_VISIBLE)) | ||
84 | + if (!prereq(Context, menu, CHECK_IN_MAILBOX)) | ||
85 | break; | ||
86 | |||
87 | if ((C_Sort & SORT_MASK) != SORT_THREADS) | ||