~skuzzymiglet/greedy

de54bca9c3482223524e7bdf26acffe81f85160b — skuzzymiglet 2 months ago 73a22d2 v0.0.0
Runewise truncation in the title (to avoid ?? characters)
1 files changed, 3 insertions(+), 2 deletions(-)

M speedread.go
M speedread.go => speedread.go +3 -2
@@ 66,8 66,9 @@ func speedread(content []string, config config, title string) (endPos int, err e
		// tagline
		// Truncate title to 50% screen width
		truncTitle := title
		if len(title) >= (w/2)-3 {
			truncTitle = title[:(w/2)-3] + "..."
		titleRunes := []rune(title)
		if len(titleRunes) >= (w/2)-3 {
			truncTitle = string(titleRunes[:(w/2)-3]) + "..." // Runewise trimming
		}
		fmt.Fprint(&tagline, truncTitle)
		fmt.Fprintf(&tagline, "[%d wpm]", config.wpm)