highlight mode to full line highlightmode

This commit is contained in:
filipriec
2025-04-16 09:08:40 +02:00
parent b6c4d3308d
commit afc8e1a1e5
2 changed files with 19 additions and 5 deletions

View File

@@ -54,6 +54,7 @@ enter_highlight_mode_linewise = ["ctrl+v"]
[keybindings.highlight] [keybindings.highlight]
exit_highlight_mode = ["esc"] exit_highlight_mode = ["esc"]
enter_highlight_mode_linewise = ["ctrl+v"]
[keybindings.edit] [keybindings.edit]
# BIG CHANGES NOW EXIT HANDLES EITHER IF THOSE # BIG CHANGES NOW EXIT HANDLES EITHER IF THOSE

View File

@@ -331,11 +331,24 @@ impl EventHandler {
}, // End AppMode::ReadOnly }, // End AppMode::ReadOnly
AppMode::Highlight => { AppMode::Highlight => {
// --- Handle Highlight Mode Specific Keys ---
// 1. Check for Exit first
if config.get_highlight_action_for_key(key_code, modifiers) == Some("exit_highlight_mode") { if config.get_highlight_action_for_key(key_code, modifiers) == Some("exit_highlight_mode") {
self.highlight_state = HighlightState::Off; self.highlight_state = HighlightState::Off;
self.command_message = "Exited highlight mode".to_string();
terminal.set_cursor_style(SetCursorStyle::SteadyBlock)?; terminal.set_cursor_style(SetCursorStyle::SteadyBlock)?;
return Ok(EventOutcome::Ok(self.command_message.clone())); 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( let (_should_exit, message) = read_only::handle_read_only_event(
app_state, key, config, form_state, login_state, app_state, key, config, form_state, login_state,