summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManos Pitsidianakis <el13635@mail.ntua.gr>2020-10-14 13:17:54 +0300
committerManos Pitsidianakis <el13635@mail.ntua.gr>2020-10-14 14:58:02 +0300
commit310d02042f1f02ff79af8dd115546806c85dbe91 (patch)
treef2043fcfe4c9ccca778604f5815c63cb82267163
parent188e020bd1fdb4320ac44a6190b27d5ca7e44bae (diff)
Rename toggle_thread_snooze to "toggle thread_snooze"
For consistency with other toggle commands.
-rw-r--r--docs/meli.12
-rw-r--r--src/command.rs10
-rw-r--r--src/command/actions.rs3
-rw-r--r--src/components/mail/listing/compact.rs2
-rw-r--r--src/components/mail/listing/conversations.rs2
-rw-r--r--src/state.rs4
6 files changed, 12 insertions, 11 deletions
diff --git a/docs/meli.1 b/docs/meli.1
index d0789022..dcbd5e01 100644
--- a/docs/meli.1
+++ b/docs/meli.1
@@ -395,7 +395,7 @@ where
is a mailbox prefixed with the
.Ar n
number in the side menu for the current account
-.It Cm toggle_thread_snooze
+.It Cm toggle thread_snooze
don't issue notifications for thread under cursor in thread listing
.It Cm search Ar STRING
search mailbox with
diff --git a/src/command.rs b/src/command.rs
index 7bb79d88..a12222e1 100644
--- a/src/command.rs
+++ b/src/command.rs
@@ -380,14 +380,16 @@ define_commands!([
}
)
},
- { tags: ["toggle_thread_snooze"],
+ { tags: ["toggle thread_snooze"],
desc: "turn off new notifications for this thread",
- tokens: &[One(Literal("toggle_thread_snooze"))],
+ tokens: &[One(Literal("toggle thread_snooze"))],
parser: (
fn toggle_thread_snooze(input: &[u8]) -> IResult<&[u8], Action> {
- let (input, _) = tag("toggle_thread_snooze")(input.trim())?;
+ let (input, _) = tag("toggle")(input)?;
+ let (input, _) = is_a(" ")(input)?;
+ let (input, _) = tag("thread_snooze")(input)?;
let (input, _) = eof(input)?;
- Ok((input, ToggleThreadSnooze))
+ Ok((input, Listing(ToggleThreadSnooze)))
}
)
},
diff --git a/src/command/actions.rs b/src/command/actions.rs
index ee14e579..afe2865c 100644
--- a/src/command/actions.rs
+++ b/src/command/actions.rs
@@ -54,6 +54,7 @@ pub enum ListingAction {
Delete,
OpenInNewTab,
Tag(TagAction),
+ ToggleThreadSnooze,
}
#[derive(Debug)]
@@ -111,7 +112,6 @@ pub enum Action {
Sort(SortField, SortOrder),
SubSort(SortField, SortOrder),
Tab(TabAction),
- ToggleThreadSnooze,
MailingListAction(MailingListAction),
View(ViewAction),
SetEnv(String, String),
@@ -131,7 +131,6 @@ impl Action {
Action::Sort(_, _) => false,
Action::SubSort(_, _) => false,
Action::Tab(_) => false,
- Action::ToggleThreadSnooze => false,
Action::MailingListAction(_) => true,
Action::View(_) => false,
Action::SetEnv(_, _) => false,
diff --git a/src/components/mail/listing/compact.rs b/src/components/mail/listing/compact.rs
index 7b910952..d8e6ddfb 100644
--- a/src/components/mail/listing/compact.rs
+++ b/src/components/mail/listing/compact.rs
@@ -1572,7 +1572,7 @@ impl Component for CompactListing {
// FIXME: perform subsort.
return true;
}
- Action::ToggleThreadSnooze if !self.unfocused => {
+ Action::Listing(ToggleThreadSnooze) if !self.unfocused => {
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
let account = &mut context.accounts[&self.cursor_pos.0];
account
diff --git a/src/components/mail/listing/conversations.rs b/src/components/mail/listing/conversations.rs
index af24de61..e78d2b15 100644
--- a/src/components/mail/listing/conversations.rs
+++ b/src/components/mail/listing/conversations.rs
@@ -1504,7 +1504,7 @@ impl Component for ConversationsListing {
*/
return true;
}
- Action::ToggleThreadSnooze if !self.unfocused => {
+ Action::Listing(ToggleThreadSnooze) if !self.unfocused => {
let thread = self.get_thread_under_cursor(self.cursor_pos.2);
let account = &mut context.accounts[&self.cursor_pos.0];
account
diff --git a/src/state.rs b/src/state.rs
index 88536b15..1c193dfe 100644
--- a/src/state.rs
+++ b/src/state.rs
@@ -1111,8 +1111,8 @@ impl State {
UIEvent::FinishedUIDialog(ref id, ref mut results)
if self.overlay.iter().any(|c| c.id() == *id) =>
{
- if let Some(Some(ref mut action)) = results.downcast_mut::<Option<Action>>() {
- self.exec_command(std::mem::replace(action, Action::ToggleThreadSnooze));
+ if let Some(ref mut action @ Some(_)) = results.downcast_mut::<Option<Action>>() {
+ self.exec_command(action.take().unwrap());
let pos = self.overlay.iter().position(|c| c.id() == *id).unwrap();
self.overlay.remove(pos);