diff --git a/core/syntaxHighlighting/SyntaxHighlighter.ts b/core/syntaxHighlighting/SyntaxHighlighter.ts
index d826984f7..3a3541d71 100644
--- a/core/syntaxHighlighting/SyntaxHighlighter.ts
+++ b/core/syntaxHighlighting/SyntaxHighlighter.ts
@@ -4,7 +4,7 @@ import path from "path";
import satori from "satori";
// import puppeteer, { Browser, ScreenshotOptions } from "puppeteer";
import { BundledTheme, codeToHtml } from "shiki";
-import { kebabOfStr } from "../util/text";
+import { escapeForSVG, kebabOfStr } from "../util/text";
interface SyntaxHighlighterOptions {
themesDir?: string;
@@ -259,7 +259,7 @@ export class SyntaxHighlighter {
// await tempPage.close();
const svg = ``;
console.log(svg);
@@ -323,7 +323,7 @@ export class SyntaxHighlighter {
const spans = Array.from(line.childNodes)
.map((node) => {
if (node.nodeType === 3) {
- return `${node.textContent}`;
+ return `${escapeForSVG(node.textContent ?? "")}`;
}
const el = node as HTMLElement;
@@ -331,7 +331,7 @@ export class SyntaxHighlighter {
const colorMatch = style.match(/color:\s*(#[0-9a-fA-F]{6})/);
const fill = colorMatch ? ` fill="${colorMatch[1]}"` : "";
const content = el.textContent || "";
- return `${content}`;
+ return `${escapeForSVG(content)}`;
})
.join("");
diff --git a/extensions/vscode/src/activation/NextEditWindowManager.ts b/extensions/vscode/src/activation/NextEditWindowManager.ts
index 08777072c..abf186738 100644
--- a/extensions/vscode/src/activation/NextEditWindowManager.ts
+++ b/extensions/vscode/src/activation/NextEditWindowManager.ts
@@ -474,27 +474,15 @@ export class NextEditWindowManager {
// Get the position with offset
const offsetPosition = this.getOffsetPosition(editor, position);
- const line = editor.document.lineAt(offsetPosition.line);
- const endPos = line.range.end;
- const zeroPos = new vscode.Position(0, 0);
- const onePos = new vscode.Position(0, 1);
- console.log("Line info:", {
- lineNumber: offsetPosition.line,
- lineLength: line.text.length,
- offsetChar: offsetPosition.character,
- endPos: endPos.character,
- });
const range = new vscode.Range(offsetPosition, offsetPosition);
// Validate the range before applying
if (!this.isValidRange(editor, range)) {
console.error("Invalid range detected, skipping decoration");
- // return;
+ return;
}
- console.log("Applying decoration at range:", range.start, "to", range.end);
// Apply the decoration at the offset position
- // editor.setDecorations(decoration, []);
editor.setDecorations(this.currentDecoration, [
{
range: new vscode.Range(offsetPosition, offsetPosition),