highlight is now working properly well, can keep on going
This commit is contained in:
@@ -50,7 +50,7 @@ move_line_end = ["$"]
|
|||||||
move_first_line = ["gg"]
|
move_first_line = ["gg"]
|
||||||
move_last_line = ["x"]
|
move_last_line = ["x"]
|
||||||
enter_highlight_mode = ["v"]
|
enter_highlight_mode = ["v"]
|
||||||
# highlight_mode_full_line = ["ctrl+v"]
|
enter_highlight_mode_linewise = ["ctrl+v"]
|
||||||
|
|
||||||
[keybindings.highlight]
|
[keybindings.highlight]
|
||||||
exit_highlight_mode = ["esc"]
|
exit_highlight_mode = ["esc"]
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ pub fn render_login(
|
|||||||
app_state: &AppState,
|
app_state: &AppState,
|
||||||
is_edit_mode: bool,
|
is_edit_mode: bool,
|
||||||
is_highlight_mode: bool,
|
is_highlight_mode: bool,
|
||||||
|
is_linewise_highlight: bool,
|
||||||
highlight_anchor: Option<(usize, usize)>,
|
highlight_anchor: Option<(usize, usize)>,
|
||||||
) {
|
) {
|
||||||
// Main container
|
// Main container
|
||||||
@@ -59,6 +60,7 @@ pub fn render_login(
|
|||||||
theme,
|
theme,
|
||||||
is_edit_mode,
|
is_edit_mode,
|
||||||
is_highlight_mode,
|
is_highlight_mode,
|
||||||
|
is_linewise_highlight,
|
||||||
highlight_anchor,
|
highlight_anchor,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ pub fn render_register(
|
|||||||
app_state: &AppState,
|
app_state: &AppState,
|
||||||
is_edit_mode: bool,
|
is_edit_mode: bool,
|
||||||
is_highlight_mode: bool,
|
is_highlight_mode: bool,
|
||||||
|
is_linewise_highlight: bool,
|
||||||
highlight_anchor: Option<(usize, usize)>,
|
highlight_anchor: Option<(usize, usize)>,
|
||||||
) {
|
) {
|
||||||
let block = Block::default()
|
let block = Block::default()
|
||||||
@@ -67,6 +68,7 @@ pub fn render_register(
|
|||||||
theme,
|
theme,
|
||||||
is_edit_mode,
|
is_edit_mode,
|
||||||
is_highlight_mode,
|
is_highlight_mode,
|
||||||
|
is_linewise_highlight,
|
||||||
highlight_anchor,
|
highlight_anchor,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pub fn render_form(
|
|||||||
theme: &Theme,
|
theme: &Theme,
|
||||||
is_edit_mode: bool,
|
is_edit_mode: bool,
|
||||||
is_highlight_mode: bool,
|
is_highlight_mode: bool,
|
||||||
|
is_linewise_highlight: bool,
|
||||||
highlight_anchor: Option<(usize, usize)>,
|
highlight_anchor: Option<(usize, usize)>,
|
||||||
total_count: u64,
|
total_count: u64,
|
||||||
current_position: u64,
|
current_position: u64,
|
||||||
@@ -65,6 +66,7 @@ pub fn render_form(
|
|||||||
theme,
|
theme,
|
||||||
is_edit_mode,
|
is_edit_mode,
|
||||||
is_highlight_mode,
|
is_highlight_mode,
|
||||||
|
is_linewise_highlight,
|
||||||
highlight_anchor,
|
highlight_anchor,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,27 +9,26 @@ use ratatui::{
|
|||||||
};
|
};
|
||||||
use crate::config::colors::themes::Theme;
|
use crate::config::colors::themes::Theme;
|
||||||
use crate::state::pages::canvas_state::CanvasState;
|
use crate::state::pages::canvas_state::CanvasState;
|
||||||
use std::cmp::{min, max}; // Import min and max
|
use std::cmp::{min, max};
|
||||||
|
|
||||||
pub fn render_canvas(
|
pub fn render_canvas(
|
||||||
f: &mut Frame,
|
f: &mut Frame,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
form_state: &impl CanvasState,
|
form_state: &impl CanvasState,
|
||||||
fields: &[&str],
|
fields: &[&str],
|
||||||
current_field_idx: &usize, // Renamed for clarity
|
current_field_idx: &usize,
|
||||||
inputs: &[&String],
|
inputs: &[&String],
|
||||||
theme: &Theme,
|
theme: &Theme,
|
||||||
is_edit_mode: bool,
|
is_edit_mode: bool,
|
||||||
is_highlight_mode: bool,
|
is_highlight_mode: bool,
|
||||||
|
is_linewise_highlight: bool,
|
||||||
highlight_anchor: Option<(usize, usize)>,
|
highlight_anchor: Option<(usize, usize)>,
|
||||||
) -> Option<Rect> {
|
) -> Option<Rect> {
|
||||||
// Split area into columns
|
|
||||||
let columns = Layout::default()
|
let columns = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([Constraint::Percentage(30), Constraint::Percentage(70)])
|
.constraints([Constraint::Percentage(30), Constraint::Percentage(70)])
|
||||||
.split(area);
|
.split(area);
|
||||||
|
|
||||||
// Input container styling
|
|
||||||
let border_style = if form_state.has_unsaved_changes() {
|
let border_style = if form_state.has_unsaved_changes() {
|
||||||
Style::default().fg(theme.warning)
|
Style::default().fg(theme.warning)
|
||||||
} else if is_edit_mode {
|
} else if is_edit_mode {
|
||||||
@@ -42,7 +41,6 @@ pub fn render_canvas(
|
|||||||
.border_style(border_style)
|
.border_style(border_style)
|
||||||
.style(Style::default().bg(theme.bg));
|
.style(Style::default().bg(theme.bg));
|
||||||
|
|
||||||
// Input block dimensions
|
|
||||||
let input_block = Rect {
|
let input_block = Rect {
|
||||||
x: columns[1].x,
|
x: columns[1].x,
|
||||||
y: columns[1].y,
|
y: columns[1].y,
|
||||||
@@ -52,7 +50,6 @@ pub fn render_canvas(
|
|||||||
|
|
||||||
f.render_widget(&input_container, input_block);
|
f.render_widget(&input_container, input_block);
|
||||||
|
|
||||||
// Input rows layout
|
|
||||||
let input_area = input_container.inner(input_block);
|
let input_area = input_container.inner(input_block);
|
||||||
let input_rows = Layout::default()
|
let input_rows = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
@@ -82,87 +79,88 @@ pub fn render_canvas(
|
|||||||
let text = input.as_str();
|
let text = input.as_str();
|
||||||
let text_len = text.chars().count();
|
let text_len = text.chars().count();
|
||||||
|
|
||||||
let line: Line; // Determine the line content with spans
|
let line: Line;
|
||||||
|
|
||||||
if is_highlight_mode && highlight_anchor.is_some() {
|
if is_highlight_mode && highlight_anchor.is_some() {
|
||||||
let (anchor_field, anchor_char) = highlight_anchor.unwrap();
|
let (anchor_field, anchor_char) = highlight_anchor.unwrap();
|
||||||
|
|
||||||
// Determine the actual start and end fields/chars for rendering
|
|
||||||
let start_field = min(anchor_field, *current_field_idx);
|
let start_field = min(anchor_field, *current_field_idx);
|
||||||
let end_field = max(anchor_field, *current_field_idx);
|
let end_field = max(anchor_field, *current_field_idx);
|
||||||
|
|
||||||
let (start_char, end_char) = if anchor_field == *current_field_idx {
|
let highlight_style = Style::default()
|
||||||
// Single line selection
|
.fg(theme.highlight)
|
||||||
(min(anchor_char, current_cursor_pos), max(anchor_char, current_cursor_pos))
|
.bg(theme.highlight_bg)
|
||||||
} else if anchor_field < *current_field_idx {
|
.add_modifier(Modifier::BOLD);
|
||||||
// Anchor is above cursor
|
|
||||||
(anchor_char, current_cursor_pos)
|
|
||||||
} else {
|
|
||||||
// Anchor is below cursor
|
|
||||||
(current_cursor_pos, anchor_char)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Style for highlighted text
|
|
||||||
let highlight_style = Style::default().fg(theme.highlight).bg(theme.highlight_bg).add_modifier(Modifier::BOLD);
|
|
||||||
// Style for normal text within the highlight range (active field color)
|
|
||||||
let normal_style_in_highlight = Style::default().fg(theme.highlight);
|
let normal_style_in_highlight = Style::default().fg(theme.highlight);
|
||||||
// Style for normal text outside highlight range (inactive field color)
|
|
||||||
let normal_style_outside = Style::default().fg(theme.fg);
|
let normal_style_outside = Style::default().fg(theme.fg);
|
||||||
|
|
||||||
if i >= start_field && i <= end_field {
|
if is_linewise_highlight {
|
||||||
// This line is within the highlight range
|
if i >= start_field && i <= end_field {
|
||||||
|
line = Line::from(Span::styled(text, highlight_style));
|
||||||
if start_field == end_field { // Case 1: Single Line Highlight
|
} else {
|
||||||
let safe_start = start_char.min(text_len);
|
line = Line::from(Span::styled(
|
||||||
let safe_end = end_char.min(text_len);
|
text,
|
||||||
let before: String = text.chars().take(safe_start).collect();
|
if is_active { normal_style_in_highlight } else { normal_style_outside }
|
||||||
let highlighted: String = text.chars().skip(safe_start).take(safe_end - safe_start).collect();
|
));
|
||||||
let after: String = text.chars().skip(safe_end).collect();
|
}
|
||||||
line = Line::from(vec![
|
} else {
|
||||||
Span::styled(before, normal_style_in_highlight),
|
let (start_char, end_char) = if anchor_field == *current_field_idx {
|
||||||
Span::styled(highlighted, highlight_style),
|
(min(anchor_char, current_cursor_pos), max(anchor_char, current_cursor_pos))
|
||||||
Span::styled(after, normal_style_in_highlight),
|
} else if anchor_field < *current_field_idx {
|
||||||
]);
|
(anchor_char, current_cursor_pos)
|
||||||
} else if i == start_field { // Case 2: Multi-Line Highlight - Start Line
|
} else {
|
||||||
let safe_start = start_char.min(text_len);
|
(current_cursor_pos, anchor_char)
|
||||||
let before: String = text.chars().take(safe_start).collect();
|
};
|
||||||
let highlighted: String = text.chars().skip(safe_start).collect();
|
|
||||||
line = Line::from(vec![
|
if i >= start_field && i <= end_field {
|
||||||
Span::styled(before, normal_style_in_highlight), // Use active color before highlight starts
|
if start_field == end_field {
|
||||||
Span::styled(highlighted, highlight_style),
|
let safe_start = start_char.min(text_len);
|
||||||
]);
|
let safe_end = end_char.min(text_len);
|
||||||
} else if i == end_field { // Case 4: Multi-Line Highlight - End Line
|
let before: String = text.chars().take(safe_start).collect();
|
||||||
let safe_end = end_char.min(text_len);
|
let highlighted: String = text.chars().skip(safe_start).take(safe_end - safe_start).collect();
|
||||||
let highlighted: String = text.chars().take(safe_end).collect();
|
let after: String = text.chars().skip(safe_end).collect();
|
||||||
let after: String = text.chars().skip(safe_end).collect();
|
line = Line::from(vec![
|
||||||
line = Line::from(vec![
|
Span::styled(before, normal_style_in_highlight),
|
||||||
Span::styled(highlighted, highlight_style),
|
Span::styled(highlighted, highlight_style),
|
||||||
Span::styled(after, normal_style_in_highlight), // Use active color after highlight ends
|
Span::styled(after, normal_style_in_highlight),
|
||||||
]);
|
]);
|
||||||
} else { // Case 3: Multi-Line Highlight - Middle Line
|
} else if i == start_field {
|
||||||
line = Line::from(Span::styled(text, highlight_style)); // Highlight whole line
|
let safe_start = start_char.min(text_len);
|
||||||
|
let before: String = text.chars().take(safe_start).collect();
|
||||||
|
let highlighted: String = text.chars().skip(safe_start).collect();
|
||||||
|
line = Line::from(vec![
|
||||||
|
Span::styled(before, normal_style_in_highlight),
|
||||||
|
Span::styled(highlighted, highlight_style),
|
||||||
|
]);
|
||||||
|
} else if i == end_field {
|
||||||
|
let safe_end = end_char.min(text_len);
|
||||||
|
let highlighted: String = text.chars().take(safe_end).collect();
|
||||||
|
let after: String = text.chars().skip(safe_end).collect();
|
||||||
|
line = Line::from(vec![
|
||||||
|
Span::styled(highlighted, highlight_style),
|
||||||
|
Span::styled(after, normal_style_in_highlight),
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
line = Line::from(Span::styled(text, highlight_style));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
line = Line::from(Span::styled(
|
||||||
|
text,
|
||||||
|
if is_active { normal_style_in_highlight } else { normal_style_outside }
|
||||||
|
));
|
||||||
}
|
}
|
||||||
} else { // Case 5: Line Outside Highlight Range
|
|
||||||
line = Line::from(Span::styled(
|
|
||||||
text,
|
|
||||||
if is_active { normal_style_in_highlight } else { normal_style_outside }
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not in highlight mode, render normally
|
|
||||||
line = Line::from(Span::styled(
|
line = Line::from(Span::styled(
|
||||||
text,
|
text,
|
||||||
if is_active { Style::default().fg(theme.highlight) } else { Style::default().fg(theme.fg) }
|
if is_active { Style::default().fg(theme.highlight) } else { Style::default().fg(theme.fg) }
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
|
|
||||||
let input_display = Paragraph::new(line)
|
let input_display = Paragraph::new(line).alignment(Alignment::Left);
|
||||||
.alignment(Alignment::Left);
|
|
||||||
f.render_widget(input_display, input_rows[i]);
|
f.render_widget(input_display, input_rows[i]);
|
||||||
|
|
||||||
if is_active {
|
if is_active {
|
||||||
active_field_input_rect = Some(input_rows[i]);
|
active_field_input_rect = Some(input_rows[i]);
|
||||||
// Set cursor position (using current_field_idx directly)
|
|
||||||
let cursor_x = input_rows[i].x + form_state.current_cursor_pos() as u16;
|
let cursor_x = input_rows[i].x + form_state.current_cursor_pos() as u16;
|
||||||
let cursor_y = input_rows[i].y;
|
let cursor_y = input_rows[i].y;
|
||||||
f.set_cursor_position((cursor_x, cursor_y));
|
f.set_cursor_position((cursor_x, cursor_y));
|
||||||
@@ -171,4 +169,3 @@ pub fn render_canvas(
|
|||||||
|
|
||||||
active_field_input_rect
|
active_field_input_rect
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ pub struct EventHandler {
|
|||||||
pub command_message: String,
|
pub command_message: String,
|
||||||
pub is_edit_mode: bool,
|
pub is_edit_mode: bool,
|
||||||
pub is_highlight_mode: bool,
|
pub is_highlight_mode: bool,
|
||||||
|
pub is_linewise_highlight: bool,
|
||||||
pub highlight_anchor: Option<(usize, usize)>,
|
pub highlight_anchor: Option<(usize, usize)>,
|
||||||
pub edit_mode_cooldown: bool,
|
pub edit_mode_cooldown: bool,
|
||||||
pub ideal_cursor_column: usize,
|
pub ideal_cursor_column: usize,
|
||||||
@@ -69,6 +70,7 @@ impl EventHandler {
|
|||||||
command_message: String::new(),
|
command_message: String::new(),
|
||||||
is_edit_mode: false,
|
is_edit_mode: false,
|
||||||
is_highlight_mode: false,
|
is_highlight_mode: false,
|
||||||
|
is_linewise_highlight: false,
|
||||||
highlight_anchor: None,
|
highlight_anchor: None,
|
||||||
edit_mode_cooldown: false,
|
edit_mode_cooldown: false,
|
||||||
ideal_cursor_column: 0,
|
ideal_cursor_column: 0,
|
||||||
@@ -216,9 +218,24 @@ impl EventHandler {
|
|||||||
},
|
},
|
||||||
|
|
||||||
AppMode::ReadOnly => {
|
AppMode::ReadOnly => {
|
||||||
if config.get_read_only_action_for_key(key_code, modifiers) == Some("enter_highlight_mode")
|
// Check for Linewise highlight first
|
||||||
|
if config.get_read_only_action_for_key(key_code, modifiers) == Some("enter_highlight_mode_linewise")
|
||||||
&& ModeManager::can_enter_highlight_mode(current_mode) {
|
&& ModeManager::can_enter_highlight_mode(current_mode) {
|
||||||
self.is_highlight_mode = true;
|
self.is_highlight_mode = true;
|
||||||
|
self.is_linewise_highlight = true; // Set linewise flag
|
||||||
|
let current_field_index = if app_state.ui.show_login { login_state.current_field() }
|
||||||
|
else if app_state.ui.show_register { register_state.current_field() }
|
||||||
|
else { form_state.current_field() };
|
||||||
|
// For linewise, anchor char doesn't matter, use 0
|
||||||
|
self.highlight_anchor = Some((current_field_index, 0));
|
||||||
|
self.command_message = "-- LINE HIGHLIGHT --".to_string();
|
||||||
|
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
||||||
|
}
|
||||||
|
// Check for Character-wise highlight
|
||||||
|
else if config.get_read_only_action_for_key(key_code, modifiers) == Some("enter_highlight_mode")
|
||||||
|
&& ModeManager::can_enter_highlight_mode(current_mode) {
|
||||||
|
self.is_highlight_mode = true;
|
||||||
|
self.is_linewise_highlight = false; // Ensure linewise is false
|
||||||
let current_field_index = if app_state.ui.show_login { login_state.current_field() }
|
let current_field_index = if app_state.ui.show_login { login_state.current_field() }
|
||||||
else if app_state.ui.show_register { register_state.current_field() }
|
else if app_state.ui.show_register { register_state.current_field() }
|
||||||
else { form_state.current_field() };
|
else { form_state.current_field() };
|
||||||
@@ -229,8 +246,8 @@ impl EventHandler {
|
|||||||
self.command_message = "-- HIGHLIGHT --".to_string();
|
self.command_message = "-- HIGHLIGHT --".to_string();
|
||||||
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
||||||
}
|
}
|
||||||
|
// Check for entering edit mode (before cursor)
|
||||||
if config.get_read_only_action_for_key(key_code, modifiers) == Some("enter_edit_mode_before")
|
else if config.get_read_only_action_for_key(key_code, modifiers) == Some("enter_edit_mode_before")
|
||||||
&& ModeManager::can_enter_edit_mode(current_mode) {
|
&& ModeManager::can_enter_edit_mode(current_mode) {
|
||||||
self.is_edit_mode = true;
|
self.is_edit_mode = true;
|
||||||
self.edit_mode_cooldown = true;
|
self.edit_mode_cooldown = true;
|
||||||
@@ -238,8 +255,8 @@ impl EventHandler {
|
|||||||
terminal.set_cursor_style(SetCursorStyle::BlinkingBar)?;
|
terminal.set_cursor_style(SetCursorStyle::BlinkingBar)?;
|
||||||
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
||||||
}
|
}
|
||||||
|
// Check for entering edit mode (after cursor)
|
||||||
if config.get_read_only_action_for_key(key_code, modifiers) == Some("enter_edit_mode_after")
|
else if config.get_read_only_action_for_key(key_code, modifiers) == Some("enter_edit_mode_after")
|
||||||
&& ModeManager::can_enter_edit_mode(current_mode) {
|
&& ModeManager::can_enter_edit_mode(current_mode) {
|
||||||
let current_input = if app_state.ui.show_login || app_state.ui.show_register{
|
let current_input = if app_state.ui.show_login || app_state.ui.show_register{
|
||||||
login_state.get_current_input()
|
login_state.get_current_input()
|
||||||
@@ -267,21 +284,17 @@ impl EventHandler {
|
|||||||
terminal.set_cursor_style(SetCursorStyle::BlinkingBar)?;
|
terminal.set_cursor_style(SetCursorStyle::BlinkingBar)?;
|
||||||
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
return Ok(EventOutcome::Ok(self.command_message.clone()));
|
||||||
}
|
}
|
||||||
|
// Check for entering command mode
|
||||||
if let Some(action) = config.get_read_only_action_for_key(key_code, modifiers) {
|
else if config.get_read_only_action_for_key(key_code, modifiers) == Some("enter_command_mode")
|
||||||
if action == "enter_command_mode" && ModeManager::can_enter_command_mode(current_mode) {
|
&& ModeManager::can_enter_command_mode(current_mode) {
|
||||||
self.command_mode = true;
|
self.command_mode = true;
|
||||||
self.command_input.clear();
|
self.command_input.clear();
|
||||||
self.command_message.clear();
|
self.command_message.clear();
|
||||||
return Ok(EventOutcome::Ok(String::new()));
|
return Ok(EventOutcome::Ok(String::new()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(action) = config.get_action_for_key_in_mode(
|
// Check for common actions (save, quit, etc.) only if no mode change happened
|
||||||
&config.keybindings.common,
|
if let Some(action) = config.get_common_action(key_code, modifiers) {
|
||||||
key_code,
|
|
||||||
modifiers
|
|
||||||
) {
|
|
||||||
match action {
|
match action {
|
||||||
"save" | "force_quit" | "save_and_quit" | "revert" => {
|
"save" | "force_quit" | "save_and_quit" | "revert" => {
|
||||||
return common_mode::handle_core_action(
|
return common_mode::handle_core_action(
|
||||||
@@ -302,6 +315,7 @@ impl EventHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If no mode change or specific common action handled, delegate to read_only handler
|
||||||
let (_should_exit, message) = read_only::handle_read_only_event(
|
let (_should_exit, message) = read_only::handle_read_only_event(
|
||||||
app_state,
|
app_state,
|
||||||
key,
|
key,
|
||||||
@@ -317,8 +331,9 @@ impl EventHandler {
|
|||||||
&mut self.edit_mode_cooldown,
|
&mut self.edit_mode_cooldown,
|
||||||
&mut self.ideal_cursor_column,
|
&mut self.ideal_cursor_column,
|
||||||
).await?;
|
).await?;
|
||||||
|
// Note: handle_read_only_event should ignore mode entry keys internally now
|
||||||
return Ok(EventOutcome::Ok(message));
|
return Ok(EventOutcome::Ok(message));
|
||||||
},
|
}, // End AppMode::ReadOnly
|
||||||
|
|
||||||
AppMode::Highlight => {
|
AppMode::Highlight => {
|
||||||
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") {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ impl FormState {
|
|||||||
theme: &Theme,
|
theme: &Theme,
|
||||||
is_edit_mode: bool,
|
is_edit_mode: bool,
|
||||||
is_highlight_mode: bool,
|
is_highlight_mode: bool,
|
||||||
|
is_linewise_highlight: bool,
|
||||||
highlight_anchor: Option<(usize, usize)>,
|
highlight_anchor: Option<(usize, usize)>,
|
||||||
total_count: u64,
|
total_count: u64,
|
||||||
current_position: u64,
|
current_position: u64,
|
||||||
@@ -51,6 +52,7 @@ impl FormState {
|
|||||||
theme,
|
theme,
|
||||||
is_edit_mode,
|
is_edit_mode,
|
||||||
is_highlight_mode,
|
is_highlight_mode,
|
||||||
|
is_linewise_highlight,
|
||||||
highlight_anchor,
|
highlight_anchor,
|
||||||
total_count,
|
total_count,
|
||||||
current_position,
|
current_position,
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ pub fn render_ui(
|
|||||||
theme: &Theme,
|
theme: &Theme,
|
||||||
is_edit_mode: bool,
|
is_edit_mode: bool,
|
||||||
is_highlight_mode: bool,
|
is_highlight_mode: bool,
|
||||||
|
is_linewise_highlight: bool,
|
||||||
highlight_anchor: Option<(usize, usize)>,
|
highlight_anchor: Option<(usize, usize)>,
|
||||||
total_count: u64,
|
total_count: u64,
|
||||||
current_position: u64,
|
current_position: u64,
|
||||||
@@ -95,6 +96,7 @@ pub fn render_ui(
|
|||||||
app_state,
|
app_state,
|
||||||
register_state.current_field < 4,
|
register_state.current_field < 4,
|
||||||
is_highlight_mode,
|
is_highlight_mode,
|
||||||
|
is_linewise_highlight,
|
||||||
highlight_anchor,
|
highlight_anchor,
|
||||||
);
|
);
|
||||||
} else if app_state.ui.show_login {
|
} else if app_state.ui.show_login {
|
||||||
@@ -106,6 +108,7 @@ pub fn render_ui(
|
|||||||
app_state,
|
app_state,
|
||||||
login_state.current_field < 2,
|
login_state.current_field < 2,
|
||||||
is_highlight_mode,
|
is_highlight_mode,
|
||||||
|
is_linewise_highlight,
|
||||||
highlight_anchor,
|
highlight_anchor,
|
||||||
);
|
);
|
||||||
} else if app_state.ui.show_admin {
|
} else if app_state.ui.show_admin {
|
||||||
@@ -172,6 +175,7 @@ pub fn render_ui(
|
|||||||
theme,
|
theme,
|
||||||
is_edit_mode,
|
is_edit_mode,
|
||||||
is_highlight_mode,
|
is_highlight_mode,
|
||||||
|
is_linewise_highlight,
|
||||||
highlight_anchor,
|
highlight_anchor,
|
||||||
total_count,
|
total_count,
|
||||||
current_position,
|
current_position,
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ pub async fn run_ui() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
&theme,
|
&theme,
|
||||||
is_edit_mode,
|
is_edit_mode,
|
||||||
event_handler.is_highlight_mode,
|
event_handler.is_highlight_mode,
|
||||||
|
event_handler.is_linewise_highlight,
|
||||||
event_handler.highlight_anchor,
|
event_handler.highlight_anchor,
|
||||||
app_state.total_count,
|
app_state.total_count,
|
||||||
app_state.current_position,
|
app_state.current_position,
|
||||||
|
|||||||
Reference in New Issue
Block a user