diff --git a/tui/actions.go b/tui/actions.go index ad3944e33..613cfe809 100644 --- a/tui/actions.go +++ b/tui/actions.go @@ -221,8 +221,10 @@ func (ui *UI) deleteSelected(shouldEmpty bool) { ui.app.QueueUpdateDraw(func() { ui.pages.RemovePage(acting) + x, y := ui.table.GetOffset() ui.showDir() ui.table.Select(min(row, ui.table.GetRowCount()-1), 0) + ui.table.SetOffset(min(x, ui.table.GetRowCount()-1), y) }) if ui.done != nil { diff --git a/tui/marked.go b/tui/marked.go index 3c350eea5..f41ebc6bc 100644 --- a/tui/marked.go +++ b/tui/marked.go @@ -93,8 +93,10 @@ func (ui *UI) deleteMarked(shouldEmpty bool) { ui.app.QueueUpdateDraw(func() { ui.pages.RemovePage(acting) ui.markedRows = make(map[int]struct{}) + x, y := ui.table.GetOffset() ui.showDir() ui.table.Select(min(currentRow, ui.table.GetRowCount()-1), 0) + ui.table.SetOffset(min(x, ui.table.GetRowCount()-1), y) }) if ui.done != nil {