summaryrefslogtreecommitdiff
path: root/pkg/ui/views
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2025-04-17 14:31:19 +0200
committerSanto Cariotti <santo@dcariotti.me>2025-04-17 14:31:19 +0200
commit56c7e99b59a52f19598d33a46aea0516bd4d609f (patch)
treeada29fd017bbd1f915a4fdf1f8416f2cf2dda16f /pkg/ui/views
parentb94b1ad37b88e9c97f64e4541e5fa3ba2d713589 (diff)
Split moves by '\n'
Diffstat (limited to 'pkg/ui/views')
-rw-r--r--pkg/ui/views/game.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkg/ui/views/game.go b/pkg/ui/views/game.go
index 7331f28..eb65c96 100644
--- a/pkg/ui/views/game.go
+++ b/pkg/ui/views/game.go
@@ -158,14 +158,14 @@ func (m GameModel) View() string {
}
// TODO: a faster solution withoout strings.Split and strings.Join
- moves := strings.Split(movesListStr, "[")
+ moves := strings.Split(movesListStr, "\n")
+ start := 0
if len(moves) > 10 {
- start := len(moves) - 10
- movesListStr = "[" + strings.Join(moves[start:], "[")
- } else {
- movesListStr = strings.Join(moves, "[")
+ start = len(moves) - 10 - 1
}
+ movesListStr = strings.Join(moves[start:], "\n")
+
var errorStr string
if m.err != nil {
errorStr = m.err.Error()