Browse Source

conf/shortcuts.rs: add info_message_{next,previous}

master
Manos Pitsidianakis 3 months ago
parent
commit
13c5798c7b
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 8
      docs/meli.conf.5
  2. 4
      src/conf/shortcuts.rs
  3. 40
      src/state.rs

8
docs/meli.conf.5

@ -609,6 +609,14 @@ Go to the
.Em n Ns
th tab
.Pq Em cannot be redefined
.It Ic info_message_next
Show next info message, if any
.\" default value
.Pq Ql Em M->
.It Ic info_message_previous
Show previous info message, if any
.\" default value
.Pq Ql Em M-<
.El
.sp
.Em listing

4
src/conf/shortcuts.rs

@ -222,7 +222,9 @@ shortcut_key_values! { "general",
scroll_right |> "Generic scroll right (catch-all setting)" |> Key::Right,
scroll_left |> "Generic scroll left (catch-all setting)" |> Key::Left,
scroll_up |> "Generic scroll up (catch-all setting)" |> Key::Char('k'),
scroll_down |> "Generic scroll down (catch-all setting)" |> Key::Char('j')
scroll_down |> "Generic scroll down (catch-all setting)" |> Key::Char('j'),
info_message_next |> "Show next info message, if any" |> Key::Alt('>'),
info_message_previous |> "Show previous info message, if any" |> Key::Alt('<')
}
}

40
src/state.rs

@ -700,12 +700,30 @@ impl State {
if self.display_messages.len() > 1 {
write_string_to_grid(
if self.display_messages_pos == 0 {
"Next: >"
&if self.display_messages_pos == 0 {
format!(
"Next: {}",
self.context.settings.shortcuts.general.info_message_next
)
} else if self.display_messages_pos + 1 == self.display_messages.len() {
"Prev: <"
format!(
"Prev: {}",
self.context
.settings
.shortcuts
.general
.info_message_previous
)
} else {
"Prev: <, Next: >"
format!(
"Prev: {} Next: {}",
self.context
.settings
.shortcuts
.general
.info_message_previous,
self.context.settings.shortcuts.general.info_message_next
)
},
&mut self.overlay_grid,
noto_colors.fg,
@ -1174,7 +1192,15 @@ impl State {
self.redraw();
return;
}
UIEvent::Input(Key::Alt('<')) => {
UIEvent::Input(ref key)
if *key
== self
.context
.settings
.shortcuts
.general
.info_message_previous =>
{
self.display_messages_expiration_start = Some(melib::datetime::now());
self.display_messages_active = true;
self.display_messages_initialised = false;
@ -1182,7 +1208,9 @@ impl State {
self.display_messages_pos = self.display_messages_pos.saturating_sub(1);
return;
}
UIEvent::Input(Key::Alt('>')) => {
UIEvent::Input(ref key)
if *key == self.context.settings.shortcuts.general.info_message_next =>
{
self.display_messages_expiration_start = Some(melib::datetime::now());
self.display_messages_active = true;
self.display_messages_initialised = false;

Loading…
Cancel
Save