aboutsummaryrefslogtreecommitdiff
path: root/cmd/krino/undo.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 20:11:26 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-09-14 20:11:26 +0200
commit97b07968a0a239c862309bcdffe31848dfbf128c (patch)
treeb662f247c33ea93c0544dc8be40250dcf2a62fc7 /cmd/krino/undo.go
parentaa24cfb344b1b3eaef7217d996359023cd72ba28 (diff)
downloadkrino-97b07968a0a239c862309bcdffe31848dfbf128c.tar.gz
krino-97b07968a0a239c862309bcdffe31848dfbf128c.zip
plan 8: escape terminal controls in everything krino prints
Diffstat (limited to 'cmd/krino/undo.go')
-rw-r--r--cmd/krino/undo.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/cmd/krino/undo.go b/cmd/krino/undo.go
index 5e18a7e..b7a139f 100644
--- a/cmd/krino/undo.go
+++ b/cmd/krino/undo.go
@@ -375,12 +375,12 @@ func reviewUndoPerFile(in io.Reader, out io.Writer, files []engine.UndoFile, p p
approved = map[int]bool{}
yesRest := false
for i, f := range files {
- fmt.Fprintf(out, "\n[%d/%d] %s/%s\n", i+1, len(files), f.Dir, f.File)
+ fmt.Fprintf(out, "\n[%d/%d] %s/%s\n", i+1, len(files), display(f.Dir), display(f.File))
for _, s := range f.Steps {
fmt.Fprintf(out, " %s\n", undoActionCell(s))
}
if f.Refused != "" {
- fmt.Fprintf(out, " refused: %s\n", f.Refused)
+ fmt.Fprintf(out, " refused: %s\n", display(f.Refused))
continue
}
if yesRest {
@@ -459,15 +459,15 @@ const undoStepWidth = len("undo-displace")
// no root-relative form to render here the way actionCell has.
func undoActionCell(s engine.UndoStep) string {
if s.Refused != "" {
- return padCell(s.Action, undoStepWidth) + " refused: " + s.Refused
+ return padCell(s.Action, undoStepWidth) + " refused: " + display(s.Refused)
}
switch s.Action {
case "undo-mkdir":
- return padCell(s.Action, undoStepWidth) + " " + xdg.Abbrev(s.Src)
+ return padCell(s.Action, undoStepWidth) + " " + display(xdg.Abbrev(s.Src))
case "undo-copy":
- return padCell(s.Action, undoStepWidth) + " " + xdg.Abbrev(s.Src) + " → trash"
+ return padCell(s.Action, undoStepWidth) + " " + display(xdg.Abbrev(s.Src)) + " → trash"
}
- return padCell(s.Action, undoStepWidth) + " → " + xdg.Abbrev(s.Dst)
+ return padCell(s.Action, undoStepWidth) + " → " + display(xdg.Abbrev(s.Dst))
}
// printUndoPlan renders an undo plan the way krino undo shows it, below the
@@ -497,9 +497,9 @@ type undoRow struct {
func undoRows(files []engine.UndoFile) []undoRow {
var rows []undoRow
for i, f := range files {
- label := f.Dir + "/" + f.File
+ label := display(f.Dir + "/" + f.File)
if f.Refused != "" {
- rows = append(rows, undoRow{num: strconv.Itoa(i + 1), file: label, action: "refused: " + f.Refused})
+ rows = append(rows, undoRow{num: strconv.Itoa(i + 1), file: label, action: "refused: " + display(f.Refused)})
continue
}
for j, s := range f.Steps {