bhcli

A TUI for chatting on LE PHP Chats (onion)
git clone https://git.dasho.dev/n0tr1v/bhcli.git
Log | Files | Refs | README

commit c6aed740498e276bd280dc4aa3051d2bfb6ff538
parent cef2b5a88ef8201b8e1802db8033e51d94f36018
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Sun,  2 Apr 2023 07:51:48 -0700

tag shortcut to prefix /m if the message was in /m

Diffstat:
Msrc/main.rs | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main.rs b/src/main.rs @@ -1240,12 +1240,17 @@ impl LeChatPHPClient { fn handle_normal_mode_key_event_tag(&mut self, app: &mut App) { if let Some(idx) = app.items.state.selected() { + let text = &app.items.items.get(idx).unwrap().text; if let Some(username) = get_username( &self.base_client.username, - &app.items.items.get(idx).unwrap().text, + &text, &self.config.members_tag, ) { - app.input = format!("@{} ", username); + if text.text().starts_with(&app.members_tag) { + app.input = format!("/m @{} ", username); + } else { + app.input = format!("@{} ", username); + } app.input_idx = app.input.width(); app.input_mode = InputMode::Editing; app.items.unselect();