highlight mode to full line highlightmode
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -331,11 +331,24 @@ impl EventHandler {
|
|||||||
}, // End AppMode::ReadOnly
|
}, // End AppMode::ReadOnly
|
||||||
|
|
||||||
AppMode::Highlight => {
|
AppMode::Highlight => {
|
||||||
if config.get_highlight_action_for_key(key_code, modifiers) == Some("exit_highlight_mode") {
|
// --- Handle Highlight Mode Specific Keys ---
|
||||||
self.highlight_state = HighlightState::Off;
|
// 1. Check for Exit first
|
||||||
terminal.set_cursor_style(SetCursorStyle::SteadyBlock)?;
|
if config.get_highlight_action_for_key(key_code, modifiers) == Some("exit_highlight_mode") {
|
||||||
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
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(
|
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,
|
||||||
|
|||||||
Reference in New Issue
Block a user