mail/view: show current number command buffer
Tests / Test on ${{ matrix.build }} (linux-amd64, ubuntu-latest, stable, x86_64-unknown-linux-gnu) (push) Successful in 10m44s Details

The command buffer in the envelope view records numbers the user presses
and then combines them with an action (e.g. type n in decimal; press
open_url action to open nth link, analogously with attachments).

Since a few commits ago, the command buffer number stopped being printed
on the envelope view.

Signed-off-by: Manos Pitsidianakis <manos@pitsidianak.is>
feature/sieve
Manos Pitsidianakis 2023-09-13 15:29:06 +03:00
parent 64ba0459ee
commit 81974311c2
Signed by: Manos Pitsidianakis
GPG Key ID: 7729C7707F7E09D0
1 changed files with 26 additions and 1 deletions

View File

@ -1236,6 +1236,28 @@ impl Component for EnvelopeView {
s.draw(grid, area, context);
}
// Draw number command buffer at the bottom right corner:
let l = nth_row_area(area, height!(area));
if self.cmd_buf.is_empty() {
clear_area(
grid,
(pos_inc(l.0, (width!(area).saturating_sub(8), 0)), l.1),
self.view_settings.theme_default,
);
} else {
let s = self.cmd_buf.to_string();
write_string_to_grid(
&s,
grid,
self.view_settings.theme_default.fg,
self.view_settings.theme_default.bg,
self.view_settings.theme_default.attrs,
(pos_inc(l.0, (width!(area).saturating_sub(s.len()), 0)), l.1),
None,
);
}
self.dirty = false;
}
@ -1291,7 +1313,10 @@ impl Component for EnvelopeView {
return true;
}
UIEvent::Input(Key::Char(c)) if c.is_ascii_digit() => {
self.cmd_buf.push(c);
if self.cmd_buf.len() < 9 {
self.cmd_buf.push(c);
self.set_dirty(true);
}
return true;
}
UIEvent::Input(ref key)