Skip to content

Commit 07ac194

Browse files
committed
refactor: remove obsolete TabState fields and methods
- Remove unused path field - Remove skip_scroll_adjustment (viewport handles this) - Remove adjust_scroll method (viewport.resolve() handles this)
1 parent ba1eb5d commit 07ac194

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

src/tab.rs

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ use std::sync::{Arc, Mutex};
1313
pub struct TabState {
1414
/// Display name (filename)
1515
pub name: String,
16-
/// Full path to the file (used for tooltips, title displays)
17-
#[allow(dead_code)]
18-
pub path: PathBuf,
1916
/// Current view mode
2017
pub mode: ViewMode,
2118
/// Total number of lines in the source
@@ -34,10 +31,6 @@ pub struct TabState {
3431
pub follow_mode: bool,
3532
/// Last line number that was filtered (for incremental filtering)
3633
pub last_filtered_line: usize,
37-
/// Skip scroll adjustment on next render (set by mouse scroll)
38-
/// TODO: Remove in Phase 6 - viewport handles this now
39-
#[allow(dead_code)]
40-
pub skip_scroll_adjustment: bool,
4134
/// Per-tab reader
4235
pub reader: Arc<Mutex<dyn LogReader + Send>>,
4336
/// Per-tab file watcher
@@ -46,8 +39,7 @@ pub struct TabState {
4639
pub filter_receiver: Option<Receiver<FilterProgress>>,
4740
/// Whether the current filter operation is incremental
4841
pub is_incremental_filter: bool,
49-
/// Viewport for anchor-based scroll/selection management (Phase 2+)
50-
#[allow(dead_code)]
42+
/// Viewport for anchor-based scroll/selection management
5143
pub viewport: Viewport,
5244
/// Original line when filter mode started (for restoring on Esc)
5345
pub filter_origin_line: Option<usize>,
@@ -95,7 +87,6 @@ impl TabState {
9587

9688
Ok(Self {
9789
name,
98-
path,
9990
mode: ViewMode::Normal,
10091
total_lines,
10192
line_indices,
@@ -105,7 +96,6 @@ impl TabState {
10596
filter_pattern: None,
10697
follow_mode: false,
10798
last_filtered_line: 0,
108-
skip_scroll_adjustment: false,
10999
reader,
110100
watcher,
111101
filter_receiver: None,
@@ -126,7 +116,6 @@ impl TabState {
126116

127117
Ok(Self {
128118
name: "<stdin>".to_string(),
129-
path: PathBuf::from("-"),
130119
mode: ViewMode::Normal,
131120
total_lines,
132121
line_indices,
@@ -136,7 +125,6 @@ impl TabState {
136125
filter_pattern: None,
137126
follow_mode: false,
138127
last_filtered_line: 0,
139-
skip_scroll_adjustment: false,
140128
reader: Arc::new(Mutex::new(stream_reader)),
141129
watcher: None,
142130
filter_receiver: None,
@@ -179,33 +167,6 @@ impl TabState {
179167
self.sync_from_viewport();
180168
}
181169

182-
/// Ensure the selected line is visible in the viewport
183-
/// TODO: Remove in Phase 6 - viewport.resolve() handles this now
184-
#[allow(dead_code)]
185-
pub fn adjust_scroll(&mut self, viewport_height: usize) {
186-
// Skip adjustment if mouse scroll just happened (prevents interference)
187-
if self.skip_scroll_adjustment {
188-
self.skip_scroll_adjustment = false;
189-
return;
190-
}
191-
192-
// Add some padding at the edges for better UX
193-
let padding = 3.min(viewport_height / 4);
194-
195-
// If selection is above viewport, scroll up
196-
if self.selected_line < self.scroll_position + padding {
197-
self.scroll_position = self.selected_line.saturating_sub(padding);
198-
}
199-
// If selection is below viewport, scroll down
200-
else if self.selected_line >= self.scroll_position + viewport_height - padding {
201-
self.scroll_position = self.selected_line + padding + 1 - viewport_height;
202-
}
203-
204-
// Ensure scroll position is valid
205-
let max_scroll = self.line_indices.len().saturating_sub(viewport_height);
206-
self.scroll_position = self.scroll_position.min(max_scroll);
207-
}
208-
209170
/// Scroll down by page
210171
pub fn page_down(&mut self, page_size: usize) {
211172
self.viewport

0 commit comments

Comments
 (0)