1
0
Fork 0
mirror of https://github.com/helix-editor/helix synced 2024-06-07 21:56:04 +02:00

Take prompt length into account.

This commit is contained in:
Blaž Hrastnik 2020-12-14 15:58:03 +09:00
parent ed6a4c4bd2
commit ca809617b2

View File

@ -137,9 +137,10 @@ pub fn render_prompt(&self, area: Rect, surface: &mut Surface, theme: &Theme) {
}
}
}
let line = area.height - 1;
// render buffer text
surface.set_string(1, area.height - 1, &self.prompt, text_color);
surface.set_string(2, area.height - 1, &self.line, text_color);
surface.set_string(0, line, &self.prompt, text_color);
surface.set_string(self.prompt.len() as u16, line, &self.line, text_color);
}
}
@ -206,8 +207,8 @@ fn render(&self, area: Rect, surface: &mut Surface, cx: &mut Context) {
fn cursor_position(&self, area: Rect, ctx: &mut Context) -> Option<Position> {
Some(Position::new(
area.height as usize - 1,
area.x as usize + 2 + self.cursor,
area.height as usize,
area.x as usize + self.prompt.len() + self.cursor,
))
}
}