src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

commit ff76969e987eddc90e3c6f5b6fa02bb0cc490387
parent 0b8cdcdc7886a5f40a7cc1f6c7829703465c558d
Author: dwrz <dwrz@dwrz.net>
Date:   Sat, 20 May 2023 19:15:18 +0000

Fix text truncate

Diffstat:
Mpkg/text/truncate.go | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/pkg/text/truncate.go b/pkg/text/truncate.go @@ -3,6 +3,9 @@ package text import "strings" func Truncate(text string, width int) string { + if width <= 0 { + return "" + } if len(text) < width { return text }