cursedbelt 5.79.3 → 5.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/looks.css +43 -5
  2. package/dist/react/activity-bar/ActivityBar.d.ts +18 -1
  3. package/dist/react/activity-bar/ActivityBar.d.ts.map +1 -1
  4. package/dist/react/activity-bar/ActivityBar.js +34 -5
  5. package/dist/react/activity-bar/ActivityBar.js.map +1 -1
  6. package/dist/react/activity-bar/activityBar.css +20 -0
  7. package/dist/react/code-editor/CodeEditor.d.ts +5 -1
  8. package/dist/react/code-editor/CodeEditor.d.ts.map +1 -1
  9. package/dist/react/code-editor/CodeEditor.js +13 -6
  10. package/dist/react/code-editor/CodeEditor.js.map +1 -1
  11. package/dist/react/code-editor/keys.d.ts +8 -0
  12. package/dist/react/code-editor/keys.d.ts.map +1 -0
  13. package/dist/react/code-editor/keys.js +16 -0
  14. package/dist/react/code-editor/keys.js.map +1 -0
  15. package/dist/react/code-editor/languages.d.ts.map +1 -1
  16. package/dist/react/code-editor/languages.js +4 -2
  17. package/dist/react/code-editor/languages.js.map +1 -1
  18. package/dist/react/code-editor/lineAbove.d.ts +5 -4
  19. package/dist/react/code-editor/lineAbove.d.ts.map +1 -1
  20. package/dist/react/code-editor/lineAbove.js +6 -10
  21. package/dist/react/code-editor/lineAbove.js.map +1 -1
  22. package/dist/react/code-editor/markdownRules.d.ts +8 -0
  23. package/dist/react/code-editor/markdownRules.d.ts.map +1 -0
  24. package/dist/react/code-editor/markdownRules.js +64 -0
  25. package/dist/react/code-editor/markdownRules.js.map +1 -0
  26. package/dist/react/code-editor/occurrences.d.ts +8 -0
  27. package/dist/react/code-editor/occurrences.d.ts.map +1 -0
  28. package/dist/react/code-editor/occurrences.js +63 -0
  29. package/dist/react/code-editor/occurrences.js.map +1 -0
  30. package/dist/react/code-editor/plainInput.d.ts +4 -0
  31. package/dist/react/code-editor/plainInput.d.ts.map +1 -0
  32. package/dist/react/code-editor/plainInput.js +36 -0
  33. package/dist/react/code-editor/plainInput.js.map +1 -0
  34. package/dist/react/code-editor/theme.d.ts.map +1 -1
  35. package/dist/react/code-editor/theme.js +5 -0
  36. package/dist/react/code-editor/theme.js.map +1 -1
  37. package/dist/react/line-keys/lineKeys.d.ts +12 -8
  38. package/dist/react/line-keys/lineKeys.d.ts.map +1 -1
  39. package/dist/react/line-keys/lineKeys.js +14 -10
  40. package/dist/react/line-keys/lineKeys.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/looks.css +43 -5
  43. package/src/looks.spec.ts +42 -3
  44. package/src/react/activity-bar/ActivityBar.spec.tsx +46 -0
  45. package/src/react/activity-bar/ActivityBar.tsx +67 -4
  46. package/src/react/activity-bar/activityBar.css +20 -0
  47. package/src/react/code-editor/CodeEditor.tsx +24 -7
  48. package/src/react/code-editor/keys.spec.ts +61 -0
  49. package/src/react/code-editor/keys.ts +17 -0
  50. package/src/react/code-editor/languages.ts +4 -2
  51. package/src/react/code-editor/lineAbove.spec.ts +1 -16
  52. package/src/react/code-editor/lineAbove.ts +6 -10
  53. package/src/react/code-editor/markdownRules.spec.ts +26 -0
  54. package/src/react/code-editor/markdownRules.ts +73 -0
  55. package/src/react/code-editor/occurrences.ts +69 -0
  56. package/src/react/code-editor/plainInput.spec.ts +23 -0
  57. package/src/react/code-editor/plainInput.ts +35 -0
  58. package/src/react/code-editor/theme.ts +5 -0
  59. package/src/react/line-keys/lineKeys.spec.tsx +19 -7
  60. package/src/react/line-keys/lineKeys.ts +14 -10
@@ -89,9 +89,10 @@ describe('lineCommandOf', () => {
89
89
  expect(key('Enter', { metaKey: true, altKey: true })).toBeNull();
90
90
  });
91
91
 
92
- test('⌘↑ / ⌘↓ (the owner\'s chord) and ⌥↑ / ⌥↓ (VS Code\'s) move a line; ⇧ stays a selection key', () => {
93
- expect(key('ArrowUp', { metaKey: true })).toBe('up');
94
- expect(key('ArrowDown', { ctrlKey: true })).toBe('down');
92
+ test('⌥↑ / ⌥↓ move a line; ⌘↑ / ⌘↓ stay the jump to the top or bottom (VS Code, forge task 3182); ⇧ stays a selection key', () => {
93
+ expect(key('ArrowUp', { metaKey: true })).toBeNull();
94
+ expect(key('ArrowDown', { metaKey: true })).toBeNull();
95
+ expect(key('ArrowDown', { ctrlKey: true })).toBeNull();
95
96
  expect(key('ArrowUp', { altKey: true })).toBe('up');
96
97
  expect(key('ArrowDown', { altKey: true })).toBe('down');
97
98
  expect(key('ArrowUp')).toBeNull();
@@ -136,23 +137,34 @@ describe('installLineKeys — on a React-controlled textarea', () => {
136
137
  expect(box.value).toBe('first\nsecond');
137
138
  });
138
139
 
139
- test('⌘↓ moves a line through React state, the caret riding with it; past the last line it does nothing', () => {
140
+ test('⌥↓ moves a line through React state, the caret riding with it; past the last line it does nothing', () => {
140
141
  off = installLineKeys();
141
142
  const view = render(<Box initial={'one\ntwo\nthree'} />);
142
143
  const box = view.getByLabelText('box') as HTMLTextAreaElement;
143
144
  box.focus();
144
145
  box.setSelectionRange(1, 1);
145
- fireEvent.keyDown(box, { key: 'ArrowDown', metaKey: true });
146
+ fireEvent.keyDown(box, { key: 'ArrowDown', altKey: true });
146
147
  expect(box.value).toBe('two\none\nthree');
147
148
  expect(box.selectionStart).toBe(5);
148
149
  fireEvent.keyDown(box, { key: 'ArrowDown', altKey: true });
149
150
  expect(box.value).toBe('two\nthree\none');
150
- const blocked = fireEvent.keyDown(box, { key: 'ArrowDown', metaKey: true });
151
+ const blocked = fireEvent.keyDown(box, { key: 'ArrowDown', altKey: true });
151
152
  expect(box.value).toBe('two\nthree\none');
152
- // Swallowed, so ⌘↓ at the last line does not also jump the caret to the end.
153
+ // Swallowed, so ⌥↓ at the last line does not also move the caret.
153
154
  expect(blocked).toBe(false);
154
155
  });
155
156
 
157
+ test('⌘↑ / ⌘↓ leave the line where it is and the key to the browser — its jump to the top or bottom', () => {
158
+ off = installLineKeys();
159
+ const view = render(<Box initial={'one\ntwo\nthree'} />);
160
+ const box = view.getByLabelText('box') as HTMLTextAreaElement;
161
+ box.focus();
162
+ box.setSelectionRange(5, 5);
163
+ expect(fireEvent.keyDown(box, { key: 'ArrowUp', metaKey: true })).toBe(true);
164
+ expect(fireEvent.keyDown(box, { key: 'ArrowDown', metaKey: true })).toBe(true);
165
+ expect(box.value).toBe('one\ntwo\nthree');
166
+ });
167
+
156
168
  test('a box that already answers ⌘↵ keeps it', () => {
157
169
  off = installLineKeys();
158
170
  const view = render(<Box claims initial="send me" />);
@@ -4,14 +4,14 @@
4
4
  * ⌘↵ (Ctrl↵) a new line BELOW the caret's line, from anywhere on it
5
5
  * ⇧⌘↵ (Ctrl⇧↵) a new line ABOVE it
6
6
  * ⇧⌘K (Ctrl⇧K) delete the line (every line the selection touches)
7
- * ⌘↑ ⌘↓ (Ctrl↑ Ctrl↓) move the line (every line the selection touches) up or down one
8
- * ⌥↑ ⌥↓ (Alt↑ Alt↓) the same — VS Code's own binding for it
7
+ * ⌥↑ ⌥↓ (Alt↑ Alt↓) move the line (every line the selection touches) up or down one
9
8
  *
10
9
  * The owner asked for these by name (2026-10-05, desk's context components first, "in apps with
11
- * multi line text boxes"; ⌘↑ / ⌘↓ the same day, in his words "like vscode does it"). ⌘↑ / ⌘↓ is
12
- * the owner's chord, and it costs the box the Mac's jump-to-top/bottom (⌘↑ is still that in a
13
- * single-line `<input>`, which this never touches); ⌥↑ / ⌥↓ is what VS Code itself binds, so
14
- * hands trained there find it too. They are one document listener rather than an `onKeyDown` on each
10
+ * multi line text boxes"). ⌘↑ / ⌘↓ is NOT a line key: it is VS Code's — and the Mac's — jump to the
11
+ * top or bottom, the line staying where it is (the owner, 2026-10-14, forge task 3182: "holding
12
+ * command and pushing up should jump to the top of the file … make all commands and keystrokes
13
+ * work like it does in VS code"). It moved the line from 2026-10-05 to then; the browser has it
14
+ * back. They are one document listener rather than an `onKeyDown` on each
15
15
  * `<textarea>` because desk alone draws a dozen of them by hand: a prop is a thing the next box
16
16
  * forgets, an install at boot is not.
17
17
  *
@@ -28,7 +28,7 @@
28
28
  *
29
29
  * CodeMirror boxes (cb's `CodeEditor`) are `contenteditable`, not `<textarea>`, and are left to
30
30
  * CodeMirror's own keymap: `Mod-Enter` and `Shift-Mod-k` are already in its `defaultKeymap`, and
31
- * `CodeEditor` adds the line above and ⌘↑ / ⌘↓ (⌥↑ / ⌥↓ is `defaultKeymap`'s `moveLineUp`/`Down`).
31
+ * `CodeEditor` adds the line above (⌥↑ / ⌥↓ is `defaultKeymap`'s `moveLineUp`/`Down`).
32
32
  */
33
33
 
34
34
  export type LineCommand = 'below' | 'above' | 'delete' | 'up' | 'down';
@@ -114,11 +114,15 @@ function moveLines(value: string, start: number, end: number, from: number, to:
114
114
  return { from, to: nextEnd, text: `${next}\n${block}`, caret: start + shift, end: end + shift };
115
115
  }
116
116
 
117
- /** Which command a key event asks for, or null. ⌘ on a Mac, Ctrl elsewhere — either is taken. */
117
+ /**
118
+ * Which command a key event asks for, or null. ⌘ on a Mac, Ctrl elsewhere — either is taken —
119
+ * except on an arrow, which moves a line on ⌥ alone: ⌘↑ / ⌘↓ stays the browser's jump to the top
120
+ * or bottom, as in VS Code.
121
+ */
118
122
  export function lineCommandOf(event: Pick<KeyboardEvent, 'key' | 'metaKey' | 'ctrlKey' | 'shiftKey' | 'altKey'>): LineCommand | null {
119
123
  const arrow = event.key === 'ArrowUp' ? 'up' : event.key === 'ArrowDown' ? 'down' : null;
120
124
  // ⇧ with an arrow extends a selection, in every one of these chords; that stays the browser's.
121
- if (arrow) return event.shiftKey || (event.metaKey || event.ctrlKey) === event.altKey ? null : arrow;
125
+ if (arrow) return event.altKey && !event.shiftKey && !event.metaKey && !event.ctrlKey ? arrow : null;
122
126
  if (!(event.metaKey || event.ctrlKey) || event.altKey) return null;
123
127
  if (event.key === 'Enter') return event.shiftKey ? 'above' : 'below';
124
128
  if (event.shiftKey && (event.key === 'k' || event.key === 'K')) return 'delete';
@@ -154,7 +158,7 @@ function onKeyDown(event: KeyboardEvent): void {
154
158
  if (command === 'delete' && field.value === '') return;
155
159
  event.preventDefault();
156
160
  // A move past the first or last line does nothing — and still swallows the key, as VS Code
157
- // does, rather than letting ⌘↑ jump the caret to the top of the box.
161
+ // does, rather than letting ⌥↑ jump the caret to the start of the paragraph.
158
162
  const edit = lineEdit(field.value, field.selectionStart, field.selectionEnd, command);
159
163
  if (edit) applyLineEdit(field, edit);
160
164
  }