Skip to content

Commit e95b0a5

Browse files
committed
fix: Fix logging typo, add TODO comment for process width updates, block final send for deletel operation
1 parent 9fb2354 commit e95b0a5

File tree

7 files changed

+14
-7
lines changed

7 files changed

+14
-7
lines changed

internal/ui/metadata/model.go:35

Whitespace-only changes.

src/internal/file_operations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func pasteDir(src, dst string, p *processbar.Process, cut bool, processBarModel
212212
p.State = processbar.Failed
213213
pSendErr := processBarModel.SendUpdateProcessMsg(*p, true)
214214
if pSendErr != nil {
215-
slog.Error("Error sending process udpate", "error", pSendErr)
215+
slog.Error("Error sending process update", "error", pSendErr)
216216
}
217217
return err
218218
}

src/internal/file_operations_compress.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func zipSources(sources []string, target string, processBar *processbar.Model) e
4040
p.DoneTime = time.Now()
4141
pSendErr := processBar.SendUpdateProcessMsg(p, true)
4242
if pSendErr != nil {
43-
slog.Error("Error sending process udpate", "error", pSendErr)
43+
slog.Error("Error sending process update", "error", pSendErr)
4444
}
4545
return errors.New("file already exists")
4646
}
@@ -107,7 +107,7 @@ func zipSources(sources []string, target string, processBar *processbar.Model) e
107107
p.DoneTime = time.Now()
108108
pSendErr := processBar.SendUpdateProcessMsg(p, true)
109109
if pSendErr != nil {
110-
slog.Error("Error sending process udpate", "error", pSendErr)
110+
slog.Error("Error sending process update", "error", pSendErr)
111111
}
112112
return nil
113113
}

src/internal/file_operations_extract.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func extractCompressFile(src, dest string, processBar *processbar.Model) error {
3636
p.DoneTime = time.Now()
3737
pSendErr := processBar.SendUpdateProcessMsg(p, true)
3838
if pSendErr != nil {
39-
slog.Error("Error sending process udpate", "error", pSendErr)
39+
slog.Error("Error sending process update", "error", pSendErr)
4040
}
4141

4242
return err

src/internal/handle_file_operations.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func deleteOperation(processBarModel *processbar.Model, items []string, useTrash
133133
deleteFunc = trashMacOrLinux
134134
}
135135
for _, item := range items {
136-
err := deleteFunc(item)
136+
err = deleteFunc(item)
137137

138138
if err != nil {
139139
p.State = processbar.Failed
@@ -149,7 +149,10 @@ func deleteOperation(processBarModel *processbar.Model, items []string, useTrash
149149
p.State = processbar.Successful
150150
}
151151
p.DoneTime = time.Now()
152-
processBarModel.TrySendingUpdateProcessMsg(p)
152+
err = processBarModel.SendUpdateProcessMsg(p, true)
153+
if err != nil {
154+
slog.Error("Failed to send final delete operation update", "error", err)
155+
}
153156
return p.State
154157
}
155158

src/internal/ui/metadata/model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (m *Model) SetDimensions(width int, height int) {
3232
func (m *Model) SetMetadata(metadata Metadata) {
3333
m.metadata = metadata
3434
// Note : Dont always reset render to 0
35-
// We would have udpate requests coming in during user scrolling through metadata
35+
// We would have update requests coming in during user scrolling through metadata
3636
m.ResetRenderIfInvalid()
3737
}
3838

src/internal/ui/processbar/model.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ func (m *Model) Render(processBarFocussed bool) string {
115115
}
116116
renderedHeight += 3
117117

118+
// Note : We will be updating this on each Render, although harmless from performance
119+
// perspective. We are rendering modified version of the data.
120+
// TODO: We could, save pointer of process in map and update progressbar of each
121+
// map on each SetWidth. This would be cleaner and more efficient.
118122
curProcess := processes[i]
119123
curProcess.Progress.Width = m.viewWidth() - 3
120124

0 commit comments

Comments
 (0)