Frames, data-edge jumps, selecting the whole sheet, extending whole columns and typing on the sparse-1M shape, and arrow keys at XFD1048576.
- commit
- 7ba2b23b8d7727ca38105c3b64c347870ffd960a
- parent
- 0273b4f3fc5196dac05a2dff29bbdeea8033e480
- author
- Dami <dami.etoile@gmail.com>
| M | internal/ | 23 | +++++++++++++++++++++++ |
@@ -13,6 +13,7 @@ import (
1313 "io"1414 "log/slog"1515 "path/filepath"16+ "strings"1617 "testing"1718 "time"1819 @@ -45,6 +46,7 @@ func uiShapes() []uiShape {
4546 stress.Charts(s, 20)4647 return s4748 }},49+ {"sparse-1M", func() *sheet.Sheet { return stress.Sparse(10000, 100, 1000) }},4850 }4951 }5052 @@ -126,6 +128,16 @@ func key(k string) tea.KeyPressMsg {
126128 return tea.KeyPressMsg{Code: tea.KeyUp, Mod: tea.ModShift}127129 case "ctrl+a":128130 return tea.KeyPressMsg{Code: 'a', Mod: tea.ModCtrl}131+ case "ctrl+down":132+ return tea.KeyPressMsg{Code: tea.KeyDown, Mod: tea.ModCtrl}133+ case "ctrl+up":134+ return tea.KeyPressMsg{Code: tea.KeyUp, Mod: tea.ModCtrl}135+ case "ctrl+space":136+ return tea.KeyPressMsg{Code: tea.KeySpace, Mod: tea.ModCtrl}137+ case "shift+right":138+ return tea.KeyPressMsg{Code: tea.KeyRight, Mod: tea.ModShift}139+ case "shift+left":140+ return tea.KeyPressMsg{Code: tea.KeyLeft, Mod: tea.ModShift}129141 case "enter":130142 return tea.KeyPressMsg{Code: tea.KeyEnter}131143 case "esc":@@ -159,6 +171,11 @@ func BenchmarkKeystroke(b *testing.B) {
159171 {"type/fanin-1000", uiShape{"fanin", func() *sheet.Sheet { return stress.FanIn(stress.Rows, 1000) }},160172 nil, []string{"7", "enter", "up"}},161173 {"type/dense-8192x26", uiShapes()[1], nil, []string{"7", "enter", "up"}},174+ {"jump/sparse-1M", uiShapes()[6], nil, []string{"ctrl+down", "ctrl+down", "ctrl+up", "ctrl+up"}},175+ {"select-sheet/sparse-1M", uiShapes()[6], []string{"ctrl+a", "ctrl+a"}, nil},176+ {"extend-column/sparse-1M", uiShapes()[6], []string{"ctrl+space"}, []string{"shift+right", "shift+left"}},177+ {"type/sparse-1M", uiShapes()[6], nil, []string{"7", "enter", "up"}},178+ {"arrow/corner", uiShape{"corner", sheet.New}, []string{"@XFD1048576"}, []string{"up", "left", "down", "right"}},162179 }163180 for _, c := range cases {164181 s := lazy(c.shape.build)@@ -167,6 +184,12 @@ func BenchmarkKeystroke(b *testing.B) {
167184 m := sized(s(), sz.w, sz.h)168185 t := newFakeTerm(sz.w, sz.h)169186 for _, k := range c.setup {187+ if a, ok := strings.CutPrefix(k, "@"); ok { // go to a cell188+ cell, _ := sheet.ParseAddr(a)189+ m.cur = cell190+ m.scrollTo(cell)191+ continue192+ }170193 m.Update(key(k))171194 }172195 i := 0