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.
- package/dist/looks.css +43 -5
- package/dist/react/activity-bar/ActivityBar.d.ts +18 -1
- package/dist/react/activity-bar/ActivityBar.d.ts.map +1 -1
- package/dist/react/activity-bar/ActivityBar.js +34 -5
- package/dist/react/activity-bar/ActivityBar.js.map +1 -1
- package/dist/react/activity-bar/activityBar.css +20 -0
- package/dist/react/code-editor/CodeEditor.d.ts +5 -1
- package/dist/react/code-editor/CodeEditor.d.ts.map +1 -1
- package/dist/react/code-editor/CodeEditor.js +13 -6
- package/dist/react/code-editor/CodeEditor.js.map +1 -1
- package/dist/react/code-editor/keys.d.ts +8 -0
- package/dist/react/code-editor/keys.d.ts.map +1 -0
- package/dist/react/code-editor/keys.js +16 -0
- package/dist/react/code-editor/keys.js.map +1 -0
- package/dist/react/code-editor/languages.d.ts.map +1 -1
- package/dist/react/code-editor/languages.js +4 -2
- package/dist/react/code-editor/languages.js.map +1 -1
- package/dist/react/code-editor/lineAbove.d.ts +5 -4
- package/dist/react/code-editor/lineAbove.d.ts.map +1 -1
- package/dist/react/code-editor/lineAbove.js +6 -10
- package/dist/react/code-editor/lineAbove.js.map +1 -1
- package/dist/react/code-editor/markdownRules.d.ts +8 -0
- package/dist/react/code-editor/markdownRules.d.ts.map +1 -0
- package/dist/react/code-editor/markdownRules.js +64 -0
- package/dist/react/code-editor/markdownRules.js.map +1 -0
- package/dist/react/code-editor/occurrences.d.ts +8 -0
- package/dist/react/code-editor/occurrences.d.ts.map +1 -0
- package/dist/react/code-editor/occurrences.js +63 -0
- package/dist/react/code-editor/occurrences.js.map +1 -0
- package/dist/react/code-editor/plainInput.d.ts +4 -0
- package/dist/react/code-editor/plainInput.d.ts.map +1 -0
- package/dist/react/code-editor/plainInput.js +36 -0
- package/dist/react/code-editor/plainInput.js.map +1 -0
- package/dist/react/code-editor/theme.d.ts.map +1 -1
- package/dist/react/code-editor/theme.js +5 -0
- package/dist/react/code-editor/theme.js.map +1 -1
- package/dist/react/line-keys/lineKeys.d.ts +12 -8
- package/dist/react/line-keys/lineKeys.d.ts.map +1 -1
- package/dist/react/line-keys/lineKeys.js +14 -10
- package/dist/react/line-keys/lineKeys.js.map +1 -1
- package/package.json +1 -1
- package/src/looks.css +43 -5
- package/src/looks.spec.ts +42 -3
- package/src/react/activity-bar/ActivityBar.spec.tsx +46 -0
- package/src/react/activity-bar/ActivityBar.tsx +67 -4
- package/src/react/activity-bar/activityBar.css +20 -0
- package/src/react/code-editor/CodeEditor.tsx +24 -7
- package/src/react/code-editor/keys.spec.ts +61 -0
- package/src/react/code-editor/keys.ts +17 -0
- package/src/react/code-editor/languages.ts +4 -2
- package/src/react/code-editor/lineAbove.spec.ts +1 -16
- package/src/react/code-editor/lineAbove.ts +6 -10
- package/src/react/code-editor/markdownRules.spec.ts +26 -0
- package/src/react/code-editor/markdownRules.ts +73 -0
- package/src/react/code-editor/occurrences.ts +69 -0
- package/src/react/code-editor/plainInput.spec.ts +23 -0
- package/src/react/code-editor/plainInput.ts +35 -0
- package/src/react/code-editor/theme.ts +5 -0
- package/src/react/line-keys/lineKeys.spec.tsx +19 -7
- 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('⌘↑ / ⌘↓
|
|
93
|
-
expect(key('ArrowUp', { metaKey: true })).
|
|
94
|
-
expect(key('ArrowDown', {
|
|
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('
|
|
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',
|
|
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',
|
|
151
|
+
const blocked = fireEvent.keyDown(box, { key: 'ArrowDown', altKey: true });
|
|
151
152
|
expect(box.value).toBe('two\nthree\none');
|
|
152
|
-
// Swallowed, so
|
|
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
|
-
*
|
|
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"
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
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
|
|
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
|
-
/**
|
|
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.
|
|
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
|
|
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
|
}
|