Skip to content

Commit 51e2287

Browse files
authored
Fix ghost column when no sticky columns (#20)
When no sticky columns are present, an extra "ghost" column appears because of a fault in the code that determines which columns to render for the bottom left portion of `SplitScroll`. When the bottom left portion has zero width, it claims it should render columns `0..1`, while the correct result is `0..0`. I applied the same fix for sticky rows. See faulty behavior in video: https://github.com/user-attachments/assets/73838349-44ba-4c21-8fc9-0e922a2f6f44
1 parent de95269 commit 51e2287

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

egui_table/src/table.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ impl<'a> TableSplitScrollDelegate<'a> {
618618
// Used to find the visible range of columns and rows:
619619
let viewport = ui.clip_rect().translate(offset);
620620

621-
let col_range = if self.table.columns.is_empty() {
621+
let col_range = if self.table.columns.is_empty() || viewport.left() == viewport.right() {
622622
0..0
623623
} else if self.do_full_sizing_pass {
624624
// We do the UI for all columns during a sizing pass, so we can auto-size ALL columns
@@ -635,7 +635,7 @@ impl<'a> TableSplitScrollDelegate<'a> {
635635
col_idx_at(viewport.min.x)..col_idx_at(viewport.max.x) + 1
636636
};
637637

638-
let row_range = if self.table.num_rows == 0 {
638+
let row_range = if self.table.num_rows == 0 || viewport.top() == viewport.bottom() {
639639
0..0
640640
} else {
641641
// Only paint the visible rows:

0 commit comments

Comments
 (0)