From 337eefece8f059678687487684580a0c73938be7 Mon Sep 17 00:00:00 2001 From: Daniel Milde Date: Wed, 24 Apr 2024 16:07:35 +0200 Subject: refactor: small fixes --- tui/format.go | 4 ++-- tui/marked.go | 1 - tui/tui.go | 4 ++-- tui/tui_test.go | 4 ++-- tui/utils.go | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tui/format.go b/tui/format.go index 03d4460..5f48d99 100644 --- a/tui/format.go +++ b/tui/format.go @@ -21,7 +21,7 @@ const ( defaultColorBold = "[::b]" ) -func (ui *UI) formatFileRow(item fs.Item, maxUsage int64, maxSize int64, marked, ignored bool) string { +func (ui *UI) formatFileRow(item fs.Item, maxUsage, maxSize int64, marked, ignored bool) string { var part int switch { @@ -94,7 +94,7 @@ func (ui *UI) formatFileRow(item fs.Item, maxUsage int64, maxSize int64, marked, return row } -func (ui *UI) formatSize(size int64, reverseColor bool, transparentBg bool) string { +func (ui *UI) formatSize(size int64, reverseColor, transparentBg bool) string { var color string if reverseColor { if ui.UseColors { diff --git a/tui/marked.go b/tui/marked.go index fb5ac91..db9d3e9 100644 --- a/tui/marked.go +++ b/tui/marked.go @@ -52,7 +52,6 @@ func (ui *UI) deleteMarked(shouldEmpty bool) { go func() { for _, one := range markedItems { - ui.app.QueueUpdateDraw(func() { modal.SetText( // nolint: staticcheck // Why: fixed string diff --git a/tui/tui.go b/tui/tui.go index c895d3e..23d0599 100644 --- a/tui/tui.go +++ b/tui/tui.go @@ -207,8 +207,8 @@ func (ui *UI) SetSelectedBackgroundColor(color tcell.Color) { // SetCurrentItemNameMaxLen sets the maximum length of the path of the currently processed item // to be shown in the progress modal -func (ui *UI) SetCurrentItemNameMaxLen(len int) { - ui.currentItemNameMaxLen = len +func (ui *UI) SetCurrentItemNameMaxLen(maxLen int) { + ui.currentItemNameMaxLen = maxLen } // UseOldSizeBar uses the old size bar (# chars) instead of the new one (unicode block elements) diff --git a/tui/tui_test.go b/tui/tui_test.go index 0e80d7a..33a600d 100644 --- a/tui/tui_test.go +++ b/tui/tui_test.go @@ -192,7 +192,7 @@ func TestDirSelected(t *testing.T) { fin := testdir.CreateTestDir() defer fin() - ui := getAnalyzedPathMockedApp(t, true, true, false) + ui := getAnalyzedPathMockedApp(t, true, false, false) ui.done = make(chan struct{}) ui.fileItemSelected(0, 0) @@ -814,7 +814,7 @@ func getDevicesInfoMock() device.DevicesInfoGetter { return mock } -func getAnalyzedPathMockedApp(t *testing.T, useColors, apparentSize bool, mockedAnalyzer bool) *UI { +func getAnalyzedPathMockedApp(t *testing.T, useColors, apparentSize, mockedAnalyzer bool) *UI { simScreen := testapp.CreateSimScreen() defer simScreen.Fini() diff --git a/tui/utils.go b/tui/utils.go index 351f679..6403dbd 100644 --- a/tui/utils.go +++ b/tui/utils.go @@ -47,7 +47,7 @@ func getUsageGraph(part int) string { } func getUsageGraphOld(part int) string { - part = part / 10 + part /= 10 graph := "[" for i := 0; i < 10; i++ { if part > i { -- cgit v1.2.3