Shrink ignores what cannot be seen; blank lines at a block's end go

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
ackandClaude Fable 5.1 committed 2026-10-14 01:48:56 +02:00
1 parent bb41047e85
commit 56ab259cd4
5 files changed
+158 -11

No files matched your search

+10
View File
@@ -17,6 +17,7 @@ import {
MAX_PAGE_HIDES,
} from './page_model.js';
import { RelayConnection } from './relay_connection.js';
import { trimTrailingBlankLines } from './text_layout.js';
/** @typedef {import('./crypto.js').Identity} Identity */
/** @typedef {import('./page_model.js').Layer} Layer */
@@ -525,6 +526,15 @@ export class Session {
shrinkPage() {
const page = this.page;
if (!this.mayMakePages() || page.number === 0) return false;
// The blank lines at the end of one's own text blocks go first (Andy,
// 2026-10-14); another's blocks are theirs, trimmed when they finish
// typing. Each trim is a gesture of its own to undo; a block being
// typed in is left to the editor.
for (const block of this.ownLayer.texts.values()) {
if (!this.beginTextEdit(block.id, 'shrink')) continue;
if (trimTrailingBlankLines(block)) this.setText(block);
this.endTextEdit(block.id, 'shrink');
}
const sheet = page.contentSheet();
if (!sheet || (sheet.left === page.baseLeft && sheet.top === page.baseTop &&
sheet.width === page.baseWidth && sheet.height === page.baseHeight)) return false;