diff --git a/client/config.toml b/client/config.toml index 12827cb..252a6f4 100644 --- a/client/config.toml +++ b/client/config.toml @@ -54,6 +54,7 @@ enter_highlight_mode_linewise = ["ctrl+v"] [keybindings.highlight] exit_highlight_mode = ["esc"] +enter_highlight_mode_linewise = ["ctrl+v"] [keybindings.edit] # BIG CHANGES NOW EXIT HANDLES EITHER IF THOSE diff --git a/client/src/modes/handlers/event.rs b/client/src/modes/handlers/event.rs index 5a1b040..67de433 100644 --- a/client/src/modes/handlers/event.rs +++ b/client/src/modes/handlers/event.rs @@ -331,11 +331,24 @@ impl EventHandler { }, // End AppMode::ReadOnly AppMode::Highlight => { - if config.get_highlight_action_for_key(key_code, modifiers) == Some("exit_highlight_mode") { - self.highlight_state = HighlightState::Off; - terminal.set_cursor_style(SetCursorStyle::SteadyBlock)?; - return Ok(EventOutcome::Ok(self.command_message.clone())); - } + // --- Handle Highlight Mode Specific Keys --- + // 1. Check for Exit first + if config.get_highlight_action_for_key(key_code, modifiers) == Some("exit_highlight_mode") { + self.highlight_state = HighlightState::Off; + self.command_message = "Exited highlight mode".to_string(); + terminal.set_cursor_style(SetCursorStyle::SteadyBlock)?; + return Ok(EventOutcome::Ok(self.command_message.clone())); + } + // 2. Check for Switch to Linewise + else if config.get_highlight_action_for_key(key_code, modifiers) == Some("enter_highlight_mode_linewise") { + // Only switch if currently characterwise + if let HighlightState::Characterwise { anchor } = self.highlight_state { + self.highlight_state = HighlightState::Linewise { anchor_line: anchor.0 }; + self.command_message = "-- LINE HIGHLIGHT --".to_string(); + return Ok(EventOutcome::Ok(self.command_message.clone())); + } + return Ok(EventOutcome::Ok("".to_string())); + } let (_should_exit, message) = read_only::handle_read_only_event( app_state, key, config, form_state, login_state,