@blankdotpage/cake 0.1.23 → 0.1.24
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;AAyjC5B,+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,aA0HpC,CAAC"}
|
|
@@ -709,14 +709,40 @@ function handleMarkerSwitch(state, insertedChar) {
|
|
|
709
709
|
const { source, selection, map } = state;
|
|
710
710
|
// If there's a selection, try to convert lines to list
|
|
711
711
|
if (selection.start !== selection.end) {
|
|
712
|
-
//
|
|
713
|
-
|
|
712
|
+
// Only handle list markers
|
|
713
|
+
if (insertedChar !== "-" && insertedChar !== "*" && insertedChar !== "+") {
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
// Check if selection covers full lines (starts at line start, ends at line end)
|
|
714
717
|
const { startLine, endLine } = getSelectionLineRange(source, selection, map);
|
|
715
|
-
|
|
716
|
-
|
|
718
|
+
const lines = getSourceLines(source);
|
|
719
|
+
let startLineOffset = 0;
|
|
720
|
+
for (let i = 0; i < startLine; i++) {
|
|
721
|
+
startLineOffset += lines[i].length + 1;
|
|
722
|
+
}
|
|
723
|
+
let endLineOffset = startLineOffset;
|
|
724
|
+
for (let i = startLine; i <= endLine; i++) {
|
|
725
|
+
endLineOffset += lines[i].length + (i < endLine ? 1 : 0);
|
|
726
|
+
}
|
|
727
|
+
const selStart = Math.min(selection.start, selection.end);
|
|
728
|
+
const selEnd = Math.max(selection.start, selection.end);
|
|
729
|
+
const selStartSource = map.cursorToSource(selStart, "backward");
|
|
730
|
+
const selEndSource = map.cursorToSource(selEnd, "forward");
|
|
731
|
+
const startsAtLineStart = selStartSource === startLineOffset;
|
|
732
|
+
const endsAtLineEnd = selEndSource === endLineOffset;
|
|
733
|
+
// For multi-line selections, always use toggle-bullet-list behavior
|
|
734
|
+
// (like Cmd+Shift+8) - this handles both full and partial line selections
|
|
735
|
+
// by converting all touched lines to list items
|
|
736
|
+
if (startLine !== endLine) {
|
|
717
737
|
return { type: "toggle-bullet-list" };
|
|
718
738
|
}
|
|
719
|
-
|
|
739
|
+
// For single-line full selections, use toggle-bullet-list
|
|
740
|
+
// to ensure consistent behavior with Cmd+Shift+8 (maintains selection, toggles off)
|
|
741
|
+
if (startsAtLineStart && endsAtLineEnd) {
|
|
742
|
+
return { type: "toggle-bullet-list" };
|
|
743
|
+
}
|
|
744
|
+
// For single-line partial selections, don't convert to list - let default behavior handle it
|
|
745
|
+
return null;
|
|
720
746
|
}
|
|
721
747
|
if (insertedChar !== "-" && insertedChar !== "*" && insertedChar !== "+") {
|
|
722
748
|
return null;
|