summaryrefslogtreecommitdiff
path: root/pkg/ui/views
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2025-04-17 12:00:15 +0200
committerSanto Cariotti <santo@dcariotti.me>2025-04-17 12:00:15 +0200
commit3466cbc4ea6295369e15002ffdbf3e918429be1e (patch)
treeae39716896917d682a735384e297790b64531784 /pkg/ui/views
parent6df768cc9782c94ae72edd0ec4c3ba3f1c4db632 (diff)
Show only the last 10 moves
Diffstat (limited to 'pkg/ui/views')
-rw-r--r--pkg/ui/views/game.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/ui/views/game.go b/pkg/ui/views/game.go
index 9f7f2a3..c6e9580 100644
--- a/pkg/ui/views/game.go
+++ b/pkg/ui/views/game.go
@@ -157,6 +157,15 @@ func (m GameModel) View() string {
}
}
+ // TODO: a faster solution withoout strings.Split and strings.Join
+ moves := strings.Split(movesListStr, "[")
+ if len(moves) > 10 {
+ start := len(moves) - 10
+ movesListStr = "[" + strings.Join(moves[start:], "[")
+ } else {
+ movesListStr = strings.Join(moves, "[")
+ }
+
var errorStr string
if m.err != nil {
errorStr = m.err.Error()