Skip to content

Commit

Permalink
Don't reset the scrolling when the window position changes (#2208)
Browse files Browse the repository at this point in the history
  • Loading branch information
fredizzimo committed Jan 4, 2024
1 parent f90663d commit 01bccdb
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/renderer/rendered_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
cmd_line::CmdLineSettings,
dimensions::Dimensions,
editor::{AnchorInfo, Style, WindowType},
profiling::tracy_zone,
profiling::{tracy_plot, tracy_zone},
renderer::{animation_utils::*, GridRenderer, RendererSettings},
settings::SETTINGS,
utils::RingBuffer,
Expand Down Expand Up @@ -216,10 +216,16 @@ impl RenderedWindow {
);
animating |= self.grid_current_position != prev_position;

animating |= self
let scrolling = self
.scroll_animation
.update(dt, settings.scroll_animation_length);

animating |= scrolling;

if scrolling {
tracy_plot!("Scroll position {}", self.scroll_animation.position.into());
}

animating
}

Expand Down Expand Up @@ -483,12 +489,15 @@ impl RenderedWindow {
}

let height = new_grid_size.height as usize;
self.actual_lines.resize(height, None);
self.grid_size = new_grid_size;
if height != self.actual_lines.len() {
self.actual_lines.resize(height, None);
self.grid_size = new_grid_size;

self.scrollback_lines.resize(2 * height, None);
self.scrollback_lines.clone_from_iter(&self.actual_lines);
self.scroll_delta = 0;
self.scrollback_lines.resize(2 * height, None);
self.scrollback_lines.clone_from_iter(&self.actual_lines);
self.scroll_delta = 0;
self.scroll_animation.reset();
}

self.anchor_info = anchor_info;
self.window_type = window_type;
Expand All @@ -500,7 +509,6 @@ impl RenderedWindow {
self.grid_start_position = new_destination;
self.grid_destination = new_destination;
}
self.scroll_animation.reset();
}
WindowDrawCommand::DrawLine {
row,
Expand Down

0 comments on commit 01bccdb

Please sign in to comment.