cat / 012
clone

a spreadsheet for the terminal: lotus 1-2-3 looks, google sheets keys and formulas, one go binary

! opens the shell prompt only on a notebook sheet; elsewhere it starts an entry

Dami committed 0ca888c
Data > Shell and the palette open the prompt from any sheet.
commit
0ca888c95d9a206408b07fe0452c4f9267492b8b
parent
9e32828d82420cddbb8491b3fa33c1ca4a5c8ce9
author
Dami <dami.etoile@gmail.com>
kind
fix risk score 2.0 of 3, Jev's estimate
8 files changed, +55 -18
Mdocs/reference/keys.md2+-
Mdocs/terminal/nushell.md4++--
Me2e/notebook_test.go9++++++---
Me2e/testdata/screens/palette-wide.html2+-
Minternal/ui/monochrome_test.go2+-
Minternal/ui/notebook.go12++++++++++--
Minternal/ui/notebook_test.go16++++++++--------
Ainternal/ui/nukey_test.go26++++++++++++++++++++++++++
M docs/reference/keys.md +1 -1
M docs/terminal/nushell.md +2 -2
M e2e/notebook_test.go +6 -3
M e2e/testdata/screens/palette-wide.html +1 -1
@@ -7,7 +7,7 @@
77 <span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">3</span><span style="background:var(--vt-palette-8)"> </span> Rent 1450 <span style="color:var(--vt-palette-8)">│</span> <span style="color:var(--vt-palette-8)">Select</span> <span style="color:var(--vt-palette-8)">chart</span> <span style="color:var(--vt-palette-8)">│</span>88 <span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">4</span><span style="background:var(--vt-palette-8)"> </span> Groceries 612.4 <span style="color:var(--vt-palette-8)">│</span> <span style="color:var(--vt-palette-3);font-weight:bold">Sel</span>ect columns <span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">Ctrl+Space</span><span style="background:var(--vt-palette-8)"> </span> <span style="color:var(--vt-palette-8)">│</span>99 <span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">5</span><span style="background:var(--vt-palette-8)"> </span> Transit 96 <span style="color:var(--vt-palette-8)">│</span> <span style="color:var(--vt-palette-8)">Move</span> <span style="color:var(--vt-palette-8)">sheet</span> <span style="color:var(--vt-palette-8)">left</span> <span style="color:var(--vt-palette-8)">Edit</span> <span style="color:var(--vt-palette-8)">›</span> <span style="color:var(--vt-palette-8)">Sheet</span> <span style="color:var(--vt-palette-8)">│</span>10-<span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">6</span><span style="background:var(--vt-palette-8)"> </span> Savings r <span style="color:var(--vt-palette-1);text-decoration:underline wavy var(--vt-palette-1)">#DIV/0!</span> <span style="color:var(--vt-palette-8)">│</span> <span style="color:var(--vt-palette-3);font-weight:bold">S</span>h<span style="color:var(--vt-palette-3);font-weight:bold">el</span>l <span style="color:var(--vt-palette-8)">Data</span> <span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">!</span><span style="background:var(--vt-palette-8)"> </span> <span style="color:var(--vt-palette-8)">│</span>10+<span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">6</span><span style="background:var(--vt-palette-8)"> </span> Savings r <span style="color:var(--vt-palette-1);text-decoration:underline wavy var(--vt-palette-1)">#DIV/0!</span> <span style="color:var(--vt-palette-8)">│</span> <span style="color:var(--vt-palette-3);font-weight:bold">S</span>h<span style="color:var(--vt-palette-3);font-weight:bold">el</span>l <span style="color:var(--vt-palette-8)">Data</span> <span style="color:var(--vt-palette-8)">│</span>1111 <span style="background:var(--vt-palette-6)"> </span><span style="color:var(--vt-palette-0);background:var(--vt-palette-6);font-weight:bold">7</span><span style="background:var(--vt-palette-6)"> </span> Total <span style="background:var(--vt-palette-6)"> </span><span style="color:var(--vt-palette-0);background:var(--vt-palette-6)">2158.4</span><span style="background:var(--vt-palette-6)"> </span> <span style="color:var(--vt-palette-8)">│</span> De<span style="color:var(--vt-palette-3);font-weight:bold">sel</span>ect <span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">Esc</span><span style="background:var(--vt-palette-8)"> </span> <span style="color:var(--vt-palette-8)">│</span>1212 <span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">8</span><span style="background:var(--vt-palette-8)"> </span> <span style="color:var(--vt-palette-8)">│</span> In<span style="color:var(--vt-palette-3);font-weight:bold">se</span>rt columns <span style="color:var(--vt-palette-3);font-weight:bold">l</span>eft <span style="color:var(--vt-palette-8)">Insert</span> <span style="color:var(--vt-palette-8)">│</span>1313 <span style="background:var(--vt-palette-8)"> </span><span style="color:var(--vt-palette-15);background:var(--vt-palette-8)">9</span><span style="background:var(--vt-palette-8)"> </span> <span style="color:var(--vt-palette-8)">│</span> <span style="color:var(--vt-palette-8)">Stop</span> <span style="color:var(--vt-palette-8)">shell</span> <span style="color:var(--vt-palette-8)">command</span> <span style="color:var(--vt-palette-8)">Data</span> <span style="color:var(--vt-palette-8)">›</span> <span style="color:var(--vt-palette-8)">Shell</span> <span style="color:var(--vt-palette-8)">regio…</span> <span style="color:var(--vt-palette-8)">│</span>
M internal/ui/monochrome_test.go +1 -1
M internal/ui/notebook.go +10 -2
M internal/ui/notebook_test.go +8 -8
@@ -48,7 +48,7 @@ func TestShellMakesRegions(t *testing.T) {
4848 "ls": lsOut,4949 "$r1 | where size > 1kb": "[[name, size]; [a.txt, 2kb], [c.txt, 5kb]]",5050 })51- press(t, m, "!")51+ shell(t, m)5252 if _, ok := m.overlay.(*nuprompt.Prompt); !ok || m.indicator() != "NU" {5353 t.Fatalf("no prompt: %T %q", m.overlay, m.indicator())5454 }
@@ -99,7 +99,7 @@ func TestShellMakesRegions(t *testing.T) {
9999 100100 func TestShellFails(t *testing.T) {101101 m, _ := notebookModel(t, map[string]string{})102- press(t, m, "!", "lss", "<enter>")102+ shell(t, m, "lss", "<enter>")103103 if got := input(m, "A1"); got != "r1 lss failed" {104104 t.Errorf("label %q", got)105105 }
@@ -113,7 +113,7 @@ func TestShellFails(t *testing.T) {
113113 }114114 // Named: name = pipeline, and redefining it.115115 m.shell.runner.(*fakeNu).out["ls"] = lsOut116- press(t, m, "!", "files = ls", "<enter>")116+ shell(t, m, "files = ls", "<enter>")117117 if _, r, ok := m.book().Region("files"); !ok || r.Command != "ls" {118118 t.Fatalf("no region files: %+v", r)119119 }
@@ -128,7 +128,7 @@ func TestShellFails(t *testing.T) {
128128 129129 func TestShellCompletes(t *testing.T) {130130 m, _ := notebookModel(t, map[string]string{"ls": lsOut})131- press(t, m, "!", "ls", "<enter>", "$")131+ shell(t, m, "ls", "<enter>", "$")132132 p := m.overlay.(*nuprompt.Prompt)133133 if got := p.Shown(); len(got) != 1 || got[0].Text != "$r1" {134134 t.Fatalf("completions of $: %+v", got)
@@ -158,7 +158,7 @@ func TestShellCompletes(t *testing.T) {
158158 159159 func TestShellTrust(t *testing.T) {160160 m, nu := notebookModel(t, map[string]string{"ls": lsOut})161- press(t, m, "!", "ls", "<enter>", "<esc>")161+ shell(t, m, "ls", "<enter>", "<esc>")162162 if m.book().MacroOrigin() != "here" {163163 t.Errorf("origin %q", m.book().MacroOrigin())164164 }
@@ -189,7 +189,7 @@ func TestShellTrust(t *testing.T) {
189189 190190 func TestShellGuardsAndFreeze(t *testing.T) {191191 m, _ := notebookModel(t, map[string]string{"ls": lsOut})192- press(t, m, "!", "ls", "<enter>", "<esc>")192+ shell(t, m, "ls", "<enter>", "<esc>")193193 m.cur = addr("A3")194194 press(t, m, "x", "<enter>")195195 if got := input(m, "A3"); got != "a.txt" {
@@ -214,7 +214,7 @@ func TestShellGuardsAndFreeze(t *testing.T) {
214214 // Sorting a region's table keeps the order through the next run.215215 func TestShellSortsRegion(t *testing.T) {216216 m, _ := notebookModel(t, map[string]string{"ls": lsOut})217- press(t, m, "!", "ls", "<enter>", "<esc>")217+ shell(t, m, "ls", "<enter>", "<esc>")218218 m.cur = addr("B3")219219 run(m, m.runCommand("data.sort_range_za"))220220 if got := input(m, "A3"); got != "c.txt" {
@@ -230,7 +230,7 @@ func TestShellSortsRegion(t *testing.T) {
230230 // Opening a saved notebook shows its regions not run, and F9 runs them.231231 func TestShellReopened(t *testing.T) {232232 m, _ := notebookModel(t, map[string]string{"ls": lsOut, "$r1 | first": "{name: a.txt, size: 2kb}"})233- press(t, m, "!", "ls", "<enter>", "$r1 | first", "<enter>", "<esc>")233+ shell(t, m, "ls", "<enter>", "$r1 | first", "<enter>", "<esc>")234234 s := roundTripSheet(t, m.sheet)235235 m2, nu := notebookModel(t, map[string]string{"ls": lsOut, "$r1 | first": "{name: a.txt, size: 2kb}"})236236 m2.reset(s, "nb.012")
A internal/ui/nukey_test.go +26 -0