summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlexander Drottsgård <[email protected]>2025-07-17 14:40:15 +0200
committerGitHub <[email protected]>2025-07-17 07:40:15 -0500
commit20cb7a76af7485e81ccfa149b04785670a245c99 (patch)
tree962a090be4cde74556e1637b6467653f4b89977d
parenta493aec1749de627130618769497373592789d47 (diff)
downloadopencode-20cb7a76af7485e81ccfa149b04785670a245c99.tar.gz
opencode-20cb7a76af7485e81ccfa149b04785670a245c99.zip
feat(tui): highlight current session in sessions modal (#1093)
-rw-r--r--packages/tui/internal/components/dialog/session.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/packages/tui/internal/components/dialog/session.go b/packages/tui/internal/components/dialog/session.go
index a0eac8eb7..307897bc5 100644
--- a/packages/tui/internal/components/dialog/session.go
+++ b/packages/tui/internal/components/dialog/session.go
@@ -28,6 +28,7 @@ type SessionDialog interface {
type sessionItem struct {
title string
isDeleteConfirming bool
+ isCurrentSession bool
}
func (s sessionItem) Render(
@@ -42,7 +43,11 @@ func (s sessionItem) Render(
if s.isDeleteConfirming {
text = "Press again to confirm delete"
} else {
- text = s.title
+ if s.isCurrentSession {
+ text = "● " + s.title
+ } else {
+ text = s.title
+ }
}
truncatedStr := truncate.StringWithTail(text, uint(width-1), "...")
@@ -56,6 +61,14 @@ func (s sessionItem) Render(
Foreground(t.BackgroundElement()).
Width(width).
PaddingLeft(1)
+ } else if s.isCurrentSession {
+ // Different style for current session when selected
+ itemStyle = baseStyle.
+ Background(t.Primary()).
+ Foreground(t.BackgroundElement()).
+ Width(width).
+ PaddingLeft(1).
+ Bold(true)
} else {
// Normal selection
itemStyle = baseStyle.
@@ -70,6 +83,12 @@ func (s sessionItem) Render(
itemStyle = baseStyle.
Foreground(t.Error()).
PaddingLeft(1)
+ } else if s.isCurrentSession {
+ // Highlight current session when not selected
+ itemStyle = baseStyle.
+ Foreground(t.Primary()).
+ PaddingLeft(1).
+ Bold(true)
} else {
itemStyle = baseStyle.
PaddingLeft(1)
@@ -194,6 +213,7 @@ func (s *sessionDialog) updateListItems() {
item := sessionItem{
title: sess.Title,
isDeleteConfirming: s.deleteConfirmation == i,
+ isCurrentSession: s.app.Session != nil && s.app.Session.ID == sess.ID,
}
items = append(items, item)
}
@@ -229,6 +249,7 @@ func NewSessionDialog(app *app.App) SessionDialog {
items = append(items, sessionItem{
title: sess.Title,
isDeleteConfirming: false,
+ isCurrentSession: app.Session != nil && app.Session.ID == sess.ID,
})
}