Inactive tabs had the key chip look and read as keys; they're now plain names, the shown sheet in the accent, with a divider before the file name as tmux draws pane borders. Tabs to the left come back into view when there's room.
- commit
- f005d11e4dd76a5646d351f67f6906be48ddcb43
- parent
- 9088bd06b240e6aa4c14bb5896a7ee58b12d7d57
- author
- Dami <dami.etoile@gmail.com>
| M | internal/ | 4 | ++-- |
| M | internal/ | 13 | +++++++++++-- |
| M | internal/ | 2 | +- |
| M | internal/ | 11 | ++++++----- |
@@ -257,7 +257,7 @@ func (m *Model) statusLine() string {
257257 }258258 259259 // statusLayout is the status line and where its sheet tabs are. From the260-// left: the tabs, the file name and its state, then selection statistics260+// left: the tabs, a divider, the file name and its state, then selection statistics261261 // or the ways in to everything else on the right. When space runs out,262262 // the right side gives up detail first, then the file name, then tabs263263 // scroll.@@ -289,7 +289,7 @@ func (m *Model) statusLayout() (string, []tabSpan) {
289289 for _, need := range []int{m.allTabs(), min(m.allTabs(), m.width/2), m.minTabs()} {290290 for _, info := range infos {291291 if info != "" {292- info = " " + info292+ info = m.th.frozenLine.Render(" │ ") + info // like a tmux pane border293293 }294294 for _, right := range m.statusRights() {295295 room := m.width - ansi.StringWidth(info)@@ -376,7 +376,7 @@ func (m *Model) tabStrip(room int) (string, []tabSpan) {
376376 for i, s := range sheets {377377 widths[i] = ansi.StringWidth(tabLabel(s))378378 }379- const add, arrow = 4, 2 // " + " and "‹ ", each with a space before the next part379+ const add, arrow = 3, 2 // " + ", and "‹" or "›" with the space after it380380 fits := func(first int) (last int, ok bool) {381381 w := add382382 if first > 0 {@@ -402,6 +402,15 @@ func (m *Model) tabStrip(room int) (string, []tabSpan) {
402402 first++403403 last, ok = fits(first)404404 }405+ // Show tabs to the left again when there's room, e.g. once the406+ // screen is wider.407+ for first > 0 {408+ l, ok := fits(first - 1)409+ if !ok || l < last {410+ break411+ }412+ first, last = first-1, l413+ }405414 m.tabLeft = first406415 if last < active {407416 last = active // a name too long for the room is cut below@@ -436,7 +445,7 @@ func (m *Model) tabStrip(room int) (string, []tabSpan) {
436445 if last < len(sheets)-1 {437446 part(hitTabNext, 0, m.th.muted.Render("›"))438447 }439- addStyle := m.th.tab448+ addStyle := m.th.muted440449 if m.hover.kind == hitTabAdd {441450 addStyle = m.th.tabHover442451 }@@ -38,7 +38,7 @@ func sheetNames(m *Model) string {
3838 3939 func TestTabKeys(t *testing.T) {4040 m := newModel()41- if s := status(m); !strings.HasPrefix(s, " Sheet1 + untitled") {41+ if s := status(m); !strings.HasPrefix(s, " Sheet1 + │ untitled") {4242 t.Fatalf("status %q", s)4343 }4444 press(t, m, "<down>", "<down>", "<f11>") // plain F11 does nothing@@ -48,9 +48,10 @@ type theme struct {
4848 // frozenLine divides frozen rows and columns from the scrolling ones,4949 // like a tmux pane border.5050 frozenLine lipgloss.Style51- // Sheet tabs on the status line: tabActive is the sheet shown (also52- // set apart by bold text), tabHover a tab under the mouse or where a53- // dragged tab would go.51+ // Sheet tabs on the status line, like lazygit's panel tabs: plain52+ // names (so they don't read as key chips), the sheet shown in the53+ // accent and bold, and a tab under the mouse, or where a dragged tab54+ // would go, bold and underlined.5455 tab lipgloss.Style5556 tabActive lipgloss.Style5657 tabHover lipgloss.Style@@ -160,9 +161,9 @@ func newTheme(dark bool) theme {
160161 copied: lipgloss.NewStyle().Foreground(lipgloss.Magenta).161162 UnderlineStyle(lipgloss.UnderlineDashed).UnderlineSpaces(true),162163 frozenLine: lipgloss.NewStyle().Foreground(lipgloss.BrightBlack),163- tab: lipgloss.NewStyle().Background(headerBg).Foreground(headerFg),164+ tab: lipgloss.NewStyle(),164165 tabActive: accent.Bold(true),165- tabHover: lipgloss.NewStyle().Background(headerBg).Foreground(lipgloss.Cyan).Bold(true),166+ tabHover: lipgloss.NewStyle().Foreground(bar).Bold(true).Underline(true),166167 filterOn: lipgloss.NewStyle().Background(headerBg).Foreground(filterFg).Bold(true),167168 168169 menuBar: lipgloss.NewStyle(),