Skip to content

Commit

Permalink
Fix #2167: Update color escape sequence on copy
Browse files Browse the repository at this point in the history
  • Loading branch information
derailed committed Nov 29, 2023
1 parent 1b7c31a commit 2a8524b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/view/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ func clipboardWrite(text string) error {
return clipboard.WriteAll(text)
}

func sanitizeEsc(s string) string {
return strings.ReplaceAll(s, "[]", "]")
}

func cpCmd(flash *model.Flash, v *tview.TextView) func(*tcell.EventKey) *tcell.EventKey {
return func(evt *tcell.EventKey) *tcell.EventKey {
if err := clipboardWrite(v.GetText(true)); err != nil {
if err := clipboardWrite(sanitizeEsc(v.GetText(true))); err != nil {
flash.Err(err)
return evt
}
Expand Down

0 comments on commit 2a8524b

Please sign in to comment.