Skip to content

Commit

Permalink
fix(ui): Make visible cursor in search field move with index
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeflo committed Oct 25, 2024
1 parent c6e20e5 commit bac80a6
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/tui/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,13 +931,10 @@ pub fn render_strings(state: &mut State, frame: &mut Frame, rect: Rect) {

/// Renders the cursor.
fn render_cursor(state: &mut State<'_>, area: Rect, frame: &mut Frame<'_>) {
let scroll = state.input.visual_scroll(area.width as usize);
if state.input_mode {
let (x, y) = (
area.x
+ Input::default()
.with_value(format!("search: {}", state.input.value()))
.visual_cursor() as u16
+ 2,
area.x + ((state.input.visual_cursor()).max(scroll) - scroll) as u16 + 10, // +10: simply to jump over the box chars and "search: " string
area.bottom().saturating_sub(1),
);
frame.render_widget(
Expand Down

0 comments on commit bac80a6

Please sign in to comment.