Co-Authored-By: Claude <noreply@anthropic.com>
- commit
- d7fd93f36280ce94da44255f78415269dd2fcc38
- parent
- ab4a7d9f00c669e6a40df761ff49b5a7b716a8fa
- author
- Dami <dami.etoile@gmail.com>
| M | internal/ | 4 | ++++ |
| M | internal/ | 2 | +- |
| M | internal/ | 3 | ++- |
@@ -307,6 +307,10 @@ func (s *Sheet) SpillAnchor(a Addr) (Addr, bool) {
307307 return found, ok308308 }309309 310+// HasSpills reports whether a formula on the sheet spills or would, so311+// what draws the sheet can skip looking for spilled cells.312+func (s *Sheet) HasSpills() bool { return len(s.spills) > 0 }313+310314 // SpillArea returns the cells the formula at a spills into, the anchor311315 // first, when it spills.312316 func (s *Sheet) SpillArea(a Addr) (Rect, bool) {@@ -185,7 +185,7 @@ func (m *Model) formulaBar() string {
185185 case modePoint:186186 return box + m.entry.prefix + m.th.Selection.Render(m.pointRef()) + m.entry.suffix187187 }188- if anchor, ok := m.sheet.SpillAnchor(m.cur); ok {188+ if anchor, ok := m.sheet.SpillAnchor(m.cur); ok && m.sheet.HasSpills() {189189 // A spilled cell shows the formula it spills from, dimmed, as190190 // Sheets does.191191 return box + m.th.Muted.Render(m.sheet.Cell(anchor).Input)@@ -147,6 +147,7 @@ func (m *Model) gridRow(row int) string {
147147 // roles for the pointer, the selection, search matches and errors.148148 func (m *Model) cellsText(row, first int, spans []rowtext.Span, focus sheet.Addr, sel sheet.Rect, selecting bool) string {149149 var b strings.Builder150+ spills := m.sheet.HasSpills()150151 for i, sp := range spans {151152 a := sheet.Addr{Col: first + i, Row: row}152153 base, colored := m.th.Cell, true@@ -163,7 +164,7 @@ func (m *Model) cellsText(row, first int, spans []rowtext.Span, focus sheet.Addr
163164 base = m.th.Muted164165 case m.sheet.Value(a).Kind == sheet.Error:165166 base = m.th.ErrorCell166- case sp.Text != "" && m.sheet.Cell(sheet.Addr{Col: sp.Owner, Row: row}).Spilled():167+ case spills && sp.Text != "" && m.sheet.Cell(sheet.Addr{Col: sp.Owner, Row: row}).Spilled():167168 base = m.th.Spilled168169 default:169170 colored = false