@blankdotpage/cake 0.1.73 → 0.1.74
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/cake/extensions/list/list.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../../src/cake/extensions/list/list.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAC;AA0qC5B,+CAA+C;AAC/C,MAAM,MAAM,uBAAuB,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE,CAAC;AAErE,iDAAiD;AACjD,MAAM,MAAM,yBAAyB,GAAG;IAAE,IAAI,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAEzE,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,uBAAuB,GAAG,yBAAyB,CAAC;AAE9E,eAAO,MAAM,sBAAsB,EAAE,aA8HpC,CAAC"}
|
|
@@ -585,19 +585,23 @@ function handleToggleList(state, isBullet) {
|
|
|
585
585
|
if (selection.start === selection.end && startLine === endLine && lines[startLine] === "") {
|
|
586
586
|
const marker = isBullet ? "- " : "1. ";
|
|
587
587
|
newLines[startLine] = marker;
|
|
588
|
-
// Calculate new
|
|
589
|
-
let
|
|
588
|
+
// Calculate new source position after the inserted marker.
|
|
589
|
+
let newCursorSourcePos = 0;
|
|
590
590
|
for (let i = 0; i < startLine; i++) {
|
|
591
|
-
|
|
591
|
+
newCursorSourcePos += lines[i].length + 1; // +1 for newline
|
|
592
592
|
}
|
|
593
|
-
|
|
593
|
+
newCursorSourcePos += marker.length;
|
|
594
594
|
const newSource = newLines.join("\n");
|
|
595
|
+
const next = runtime.createState(newSource);
|
|
596
|
+
// Bias backward so the caret stays on the newly created empty list line
|
|
597
|
+
// instead of normalizing to the following line at the shared boundary.
|
|
598
|
+
const nextCursor = next.map.sourceToCursor(newCursorSourcePos, "backward");
|
|
595
599
|
return {
|
|
596
600
|
source: newSource,
|
|
597
601
|
selection: {
|
|
598
|
-
start:
|
|
599
|
-
end:
|
|
600
|
-
affinity:
|
|
602
|
+
start: nextCursor.cursorOffset,
|
|
603
|
+
end: nextCursor.cursorOffset,
|
|
604
|
+
affinity: nextCursor.affinity,
|
|
601
605
|
},
|
|
602
606
|
};
|
|
603
607
|
}
|