From 726153b9be84c0cd58f3ecf546642001cd2c4c7a Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Fri, 29 May 2026 19:33:37 -0400 Subject: [PATCH] Trim trailing spaces from copied note line (in case user added trailing spaces for Markdown formatting) --- clip/arguments.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clip/arguments.go b/clip/arguments.go index 3b911b0..281eabf 100644 --- a/clip/arguments.go +++ b/clip/arguments.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "os" + "strings" "github.com/rwinkhart/go-boilerplate/back" "github.com/rwinkhart/libmutton/crypt" @@ -33,7 +34,8 @@ func CopyShortcut(realPath string, field int, rcwPassword []byte) error { return errors.New("field is empty") } - if field == 2 { // TOTP mode + switch field { + case 2: // TOTP fmt.Println(back.AnsiWarning + "[Starting]" + back.AnsiReset + " TOTP clipboard refresher") errorChan := make(chan error, 1) go TOTPCopier(decSlice[2], errorChan, nil) // "done" is not needed because the process runs until the program is killed @@ -41,7 +43,10 @@ func CopyShortcut(realPath string, field int, rcwPassword []byte) error { return errors.New("error encountered in TOTP refresh process: " + err.Error()) } select {} // block indefinitely - } else { // other + case 4: + decSlice[field] = strings.TrimRight(decSlice[field], " ") + fallthrough + default: // copy field to clipboard; launch clipboard clearing process if err = CopyBytes(true, []byte(decSlice[field])); err != nil { return err