- commit
- bc969b1230ad5b9edb99abc579ea7b13e34da41e
- parent
- d675b7ffa0a9eb22f87329b362022e403c9fe0ee
- author
- Dami <dami.etoile@gmail.com>
| M | README.md | 2 | +- |
| M | internal/ | 2 | +- |
| M | internal/ | 2 | +- |
| M | internal/ | 10 | ++++++++++ |
| M | internal/ | 4 | ++-- |
| M | internal/ | 2 | +- |
| M | internal/ | 2 | +- |
@@ -28,7 +28,7 @@ Inside the grid, 012 works like Google Sheets.
2828 | Ctrl+Shift+V | Paste values only |2929 | Paste from the terminal | Tab-separated or multi-line text fills a block of cells |3030 | Ctrl+D, Ctrl+R | Fill down, fill right; top rows that start a series (1, 2 over blanks) continue it |31-| Drag the fill handle | The ▗ at the selection's corner, shown on hover: continue a series (1, 2, 3; Jan, Feb; Mon, Tue; dates; Item 1, Item 2) or copy |31+| Drag the fill handle | The ▟ at the selection's corner, shown on hover: continue a series (1, 2, 3; Jan, Feb; Mon, Tue; dates; Item 1, Item 2) or copy |3232 | View > Freeze | Keep rows or columns on screen while the rest scrolls |3333 | Data > Sort sheet, Sort range | Sort by the active column A to Z or Z to A, or pick columns and order on a bar (Left/Right column, Space order, Alt+A add, Alt+H header row) |3434 | Alt+Down, click ▾ in a header | With a filter (Data > Create a filter): pick the column's values (Space checks, type to search) or a condition |@@ -37,7 +37,7 @@ func TestFillHandleDrag(t *testing.T) {
3737 y := gridTop + len(tt.cells) - 13838 // Hovering the corner cell shows the handle.3939 send(m, tea.MouseMotionMsg{X: cellX(0), Y: y})40- if !strings.Contains(line(m, y), "▗") {40+ if !strings.Contains(line(m, y), "▟") {4141 t.Fatalf("no handle: %q", line(m, y))4242 }4343 if h := m.hitTest(handleX(0), y); h.kind != hitFillHandle {@@ -5,7 +5,7 @@ import (
55 )66 77 // The fill handle, as in Sheets: the bottom-right corner of the selection8-// shows a small handle (▗) when the mouse is over that cell. Dragging it8+// shows a small handle (▟) when the mouse is over that cell. Dragging it99 // down, up, right or left fills the cells it passes over, continuing a1010 // series (1, 2, 3; Jan, Feb; Item 1, Item 2) or copying. While dragging,1111 // the range that will be filled is highlighted and the context line says@@ -308,6 +308,16 @@ func (m *Model) navigate(key string, a *sheet.Addr) bool {
308308 }309309 *a = clampAddr(*a)310310 a.Row = m.visibleRow(a.Row)311+ // Moving into the frozen panes by keyboard scrolls the rest back to312+ // the start, as in Sheets (Ctrl+Home shows A1 with row 2 under it).313+ if fr, fc := m.frozen(); a.Row < fr || a.Col < fc {314+ if a.Row < fr {315+ m.top = 0316+ }317+ if a.Col < fc {318+ m.left = 0319+ }320+ }311321 m.clampView()312322 return true313323 }@@ -50,9 +50,9 @@ func TestFrozenPanesStayWhileScrolling(t *testing.T) {
5050 if m.top != 28 {5151 t.Errorf("top %d, want 28 (13 scrolling rows ending at 41)", m.top)5252 }53- // Moving up into the frozen row doesn't scroll.53+ // Moving up into the frozen row scrolls back to the top, as in Sheets.5454 press(t, m, "<ctrl+up>")55- if m.cur != addr("B1") || m.top != 28 {55+ if m.cur != addr("B1") || m.top != 1 {5656 t.Errorf("ctrl+up: cur %v top %d", m.cur, m.top)5757 }5858 press(t, m, "<down>")@@ -303,7 +303,7 @@ func (b *sortBar) mouse(m *Model, e mouseEvent) tea.Cmd {
303303 // status shows the keys, the most useful ones first on narrow screens.304304 func (b *sortBar) status(m *Model) (string, string) {305305 pairs := []string{"Left/Right", "column", "Space", "order", "Enter", "sort", "Esc", "cancel"}306- desc := "Alt+A add a column Alt+H header row Tab next"306+ desc := "Alt+A add Alt+H header Tab next"307307 for {308308 keys := m.keyHints(pairs...)309309 switch {@@ -174,7 +174,7 @@ func (m *Model) cellsText(row, first int, spans []span, focus sheet.Addr, sel sh
174174 text := m.renderSpan(sp, base, colored)175175 if m.showFillHandle(a) {176176 w := m.sheet.ColWidth(a.Col)177- text = ansi.Truncate(text, w-1, "") + base.Bold(true).Render("▗")177+ text = ansi.Truncate(text, w-1, "") + base.Render("▟")178178 }179179 b.WriteString(text)180180 }