дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-03 16:51:16 +02:00
@codemirror/view 6.44 contains the upstream fix for tooltip positioning in Safari/WebKit; bump to ^6.44.2 and rebase the local patch onto it. Co-authored-by: nntndfrk <[email protected]>
93 рядки
4.8 KiB
Diff
93 рядки
4.8 KiB
Diff
diff --git a/dist/index.cjs b/dist/index.cjs
|
|
index a16387f..19fd403 100644
|
|
--- a/dist/index.cjs
|
|
+++ b/dist/index.cjs
|
|
@@ -6699,6 +6699,14 @@ class ViewState {
|
|
}
|
|
gaps.push(gap);
|
|
};
|
|
+ let head = this.scrollTarget ? this.scrollTarget.range.head : -1, targetX = null;
|
|
+ if (head >= 0 && !wrapping) {
|
|
+ // Unwrapped lines all centre on the target's x, taken from the target's own line (long or not). The
|
|
+ // target's fraction of another line is 1 above it and negative below it, so every long line above
|
|
+ // the caret was drawn from its end, then back after the scroll.
|
|
+ let line = this.state.doc.lineAt(head), structure = lineStructure(line.from, line.to, this.stateDeco);
|
|
+ targetX = (structure.total ? findFraction(structure, head) * structure.total : 0) * this.heightOracle.charWidth;
|
|
+ }
|
|
let checkLine = (line) => {
|
|
if (line.length < doubleMargin || line.type != exports.BlockType.Text)
|
|
return;
|
|
@@ -6735,11 +6743,10 @@ class ViewState {
|
|
}
|
|
let pxLeft = this.pixelViewport.left + horizOffset, pxRight = this.pixelViewport.right + horizOffset;
|
|
let left, right;
|
|
- if (target != null) {
|
|
- let targetFrac = findFraction(structure, target);
|
|
- let spaceFrac = ((pxRight - pxLeft) / 2 + marginWidth) / totalWidth;
|
|
- left = targetFrac - spaceFrac;
|
|
- right = targetFrac + spaceFrac;
|
|
+ if (targetX != null) {
|
|
+ let space = (pxRight - pxLeft) / 2 + marginWidth;
|
|
+ left = (targetX - space) / totalWidth;
|
|
+ right = (targetX + space) / totalWidth;
|
|
}
|
|
else {
|
|
left = (pxLeft - marginWidth) / totalWidth;
|
|
@@ -9840,7 +9847,9 @@ const hideNativeSelection = state.Prec.highest(EditorView.theme({
|
|
"& :focus": {
|
|
caretColor: "initial !important",
|
|
...drawMainRange ? {
|
|
- "&::selection, & ::selection": {
|
|
+ // Not `& ::selection` too: a pseudo-class with a universal descendant restyles the
|
|
+ // whole subtree of every element that gains or loses focus.
|
|
+ "&::selection": {
|
|
backgroundColor: "Highlight !important"
|
|
}
|
|
} : {}
|
|
diff --git a/dist/index.js b/dist/index.js
|
|
index 66dd7d5..77eb3b9 100644
|
|
--- a/dist/index.js
|
|
+++ b/dist/index.js
|
|
@@ -6694,6 +6694,14 @@ class ViewState {
|
|
}
|
|
gaps.push(gap);
|
|
};
|
|
+ let head = this.scrollTarget ? this.scrollTarget.range.head : -1, targetX = null;
|
|
+ if (head >= 0 && !wrapping) {
|
|
+ // Unwrapped lines all centre on the target's x, taken from the target's own line (long or not). The
|
|
+ // target's fraction of another line is 1 above it and negative below it, so every long line above
|
|
+ // the caret was drawn from its end, then back after the scroll.
|
|
+ let line = this.state.doc.lineAt(head), structure = lineStructure(line.from, line.to, this.stateDeco);
|
|
+ targetX = (structure.total ? findFraction(structure, head) * structure.total : 0) * this.heightOracle.charWidth;
|
|
+ }
|
|
let checkLine = (line) => {
|
|
if (line.length < doubleMargin || line.type != BlockType.Text)
|
|
return;
|
|
@@ -6730,11 +6738,10 @@ class ViewState {
|
|
}
|
|
let pxLeft = this.pixelViewport.left + horizOffset, pxRight = this.pixelViewport.right + horizOffset;
|
|
let left, right;
|
|
- if (target != null) {
|
|
- let targetFrac = findFraction(structure, target);
|
|
- let spaceFrac = ((pxRight - pxLeft) / 2 + marginWidth) / totalWidth;
|
|
- left = targetFrac - spaceFrac;
|
|
- right = targetFrac + spaceFrac;
|
|
+ if (targetX != null) {
|
|
+ let space = (pxRight - pxLeft) / 2 + marginWidth;
|
|
+ left = (targetX - space) / totalWidth;
|
|
+ right = (targetX + space) / totalWidth;
|
|
}
|
|
else {
|
|
left = (pxLeft - marginWidth) / totalWidth;
|
|
@@ -9835,7 +9842,9 @@ const hideNativeSelection = /*@__PURE__*/Prec.highest(/*@__PURE__*/EditorView.th
|
|
"& :focus": {
|
|
caretColor: "initial !important",
|
|
...drawMainRange ? {
|
|
- "&::selection, & ::selection": {
|
|
+ // Not `& ::selection` too: a pseudo-class with a universal descendant restyles the
|
|
+ // whole subtree of every element that gains or loses focus.
|
|
+ "&::selection": {
|
|
backgroundColor: "Highlight !important"
|
|
}
|
|
} : {}
|