1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-22 21:01:36 +03:00

Fix text cursor position when using multiple panes

This commit is contained in:
kumattau 2022-05-18 09:19:20 +09:00 committed by Wez Furlong
parent 53b9a68a9c
commit 9b5c887874
2 changed files with 7 additions and 6 deletions

View File

@ -1730,10 +1730,10 @@ impl TermWindow {
} }
} }
fn update_text_cursor(&mut self, pane: &Rc<dyn Pane>) { fn update_text_cursor(&mut self, pos: &PositionedPane) {
let cursor = pane.get_cursor_position();
if let Some(win) = self.window.as_ref() { if let Some(win) = self.window.as_ref() {
let top = pane.get_dimensions().physical_top; let cursor = pos.pane.get_cursor_position();
let top = pos.pane.get_dimensions().physical_top;
let tab_bar_height = if self.show_tab_bar && !self.config.tab_bar_at_bottom { let tab_bar_height = if self.show_tab_bar && !self.config.tab_bar_at_bottom {
self.tab_bar_pixel_height().unwrap() self.tab_bar_pixel_height().unwrap()
} else { } else {
@ -1743,9 +1743,10 @@ impl TermWindow {
let r = Rect::new( let r = Rect::new(
Point::new( Point::new(
(cursor.x.max(0) as isize * self.render_metrics.cell_size.width) (((cursor.x + pos.left) as isize).max(0) * self.render_metrics.cell_size.width)
.add(padding_left as isize), .add(padding_left as isize),
((cursor.y - top).max(0) as isize * self.render_metrics.cell_size.height) ((cursor.y + pos.top as isize - top).max(0)
* self.render_metrics.cell_size.height)
.add(tab_bar_height as isize) .add(tab_bar_height as isize)
.add(padding_top as isize), .add(padding_top as isize),
), ),

View File

@ -1625,7 +1625,7 @@ impl super::TermWindow {
for pos in panes { for pos in panes {
if pos.is_active { if pos.is_active {
self.update_text_cursor(&pos.pane); self.update_text_cursor(&pos);
if focused { if focused {
pos.pane.advise_focus(); pos.pane.advise_focus();
mux::Mux::get() mux::Mux::get()