Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion buffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* editor.View.render();
*/
function Buffee($, { h, w, s = 4 } = {}) {
this.v = '15.10.0-alpha.1';
this.v = '16.0.1-alpha.1';
this.$ = $;
// head.y and anchor.y are ABSOLUTE line numbers (Model indices, not viewport-relative).
// This allows selections to span beyond the viewport.
Expand Down Expand Up @@ -415,6 +415,7 @@ function Buffee($, { h, w, s = 4 } = {}) {
},
cmdMap = {
z: () => this.History?.[sh ? 'redo' : 'undo'](),
a: () => { const e = Model.end; Span.cursor({y: 0, x: 0}); if (e.y || e.x) Span.select(e); render(); },
};

if (arrowCode) {
Expand Down
6 changes: 6 additions & 0 deletions dev/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
* Project Devlog

** 16.0.1-alpha.1 [2026-01-14] gz: 2547 / 2.49 KB (+11), br: 2354 / 2.30 KB (+9), min: 5671 / 5.54 KB (22)
- fix: select all on empty doc keeps cursor mode

** 16.0.0-alpha.1 [2026-01-13] gz: 2536 / 2.48 KB (+13), br: 2345 / 2.29 KB (+12), min: 5649 / 5.52 KB (47)
- feat: add Select All (Cmd+A)

** 15.10.0-alpha.1 [2026-01-13] gz: 2523 / 2.46 KB (0), br: 2333 / 2.28 KB (0), min: 5602 / 5.47 KB (0)
- api: add Model.end returning last coordinate {y, x}
- api: Span.select() accepts optional position for head
Expand Down
2 changes: 1 addition & 1 deletion dist/buffee.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions test/specs/spec-selection.dsl
Original file line number Diff line number Diff line change
Expand Up @@ -695,3 +695,52 @@ const $vp9 = fixture.node.querySelectorAll(".buffee-zsel > pre")[9];
expect($vp9.style.left).toBe("0ch");
expect($vp9.style.width).toBe("4ch");


# Select All (Cmd+A)

## should select all text with Cmd+A on single line
### Select All on single line
TYPE "Hello World"
left with meta
fixture.press('a').withMetaKey().once();
EXPECT selection at 0,0-0,11

## should select all text with Cmd+A on multiple lines
### Select All on multiple lines
TYPE "First line"
enter
TYPE "Second line"
enter
TYPE "Third line"
fixture.press('a').withMetaKey().once();
EXPECT selection at 0,0-2,10

## should select all from cursor in middle of document
### Select All from middle position
TYPE "Line 1"
enter
TYPE "Line 2"
enter
TYPE "Line 3"
up
right 3 times
fixture.press('a').withMetaKey().once();
EXPECT selection at 0,0-2,6

## should select all on empty document
### Select All on empty document
fixture.press('a').withMetaKey().once();
// Empty document: cursor at 0,0, selection from 0,0 to 0,0
expect(fixture.editor.Span.dir).toBe(0);
EXPECT cursor at 0,0

## should replace all text after Select All
### Select All then type replaces everything
TYPE "Old content"
enter
TYPE "More old content"
fixture.press('a').withMetaKey().once();
TYPE "New"
expect(fixture).toHaveLines('New');
EXPECT cursor at 0,3

Loading