0c4f4cde1f46e3653a860e0823e39c9baefe571e

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Render input cursor as full-width reverse video

Replaces the half-block marker with the reversed character under the
cursor (a reversed space at end of line), so it spans a full cell and
the character stays visible.

Diff

 1diff --git a/internal/ui/app.go b/internal/ui/app.go
 2index 65a720d9665f149f7456ac72d912df14f06fc5be..c045746573c5bc83f4717ef318f3d91939be96be 100644
 3--- a/internal/ui/app.go
 4+++ b/internal/ui/app.go
 5@@ -26,6 +26,7 @@ var (
 6 	narrationStyle  = lipgloss.NewStyle()                                   // default
 7 	playerSaidStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("42"))  // green
 8 	hintStyle       = lipgloss.NewStyle().Foreground(lipgloss.Color("245")) // gray
 9+	cursorStyle     = lipgloss.NewStyle().Reverse(true)                     // input cursor
10 )
11 
12 type phase int
13diff --git a/internal/ui/render.go b/internal/ui/render.go
14index 24015192b0fa598893665aabe6965c12044d0348..35f97ccc464a2e3da919b3c5562913e143d9f3b5 100644
15--- a/internal/ui/render.go
16+++ b/internal/ui/render.go
17@@ -45,7 +45,14 @@ func inputLine(buf string, cursor int) string {
18 	if cursor > len(r) {
19 		cursor = len(r)
20 	}
21-	return "> " + sanitizeRomajiOnly(string(r[:cursor])) + "▌" + sanitizeRomajiOnly(string(r[cursor:]))
22+	at, after := " ", ""
23+	if cursor < len(r) {
24+		at = string(r[cursor])
25+		after = string(r[cursor+1:])
26+	}
27+	return "> " + sanitizeRomajiOnly(string(r[:cursor])) +
28+		cursorStyle.Render(sanitizeRomajiOnly(at)) +
29+		sanitizeRomajiOnly(after)
30 }
31 
32 func statusLine(status, phaseWord string, recElapsed, recCap int) string {