[ play ] improvements to unicode completion

This commit is contained in:
2025-07-26 07:17:31 -07:00
parent 8386331752
commit bfaaec867e
3 changed files with 8 additions and 4 deletions

View File

@@ -11,5 +11,8 @@ export const ABBREV: Record<string, string> = {
"\\>": "⟩",
"\\_0": "₀",
"\\_1": "₁",
"\\_2": "₂",
"\\_3": "₃",
"\\neg": "¬",
"\\bN": ""
};

View File

@@ -32,9 +32,9 @@ export function activate(context: vscode.ExtensionContext) {
const lastChange = changes[changes.length - 1];
const text = lastChange.text;
console.log("lastChange", lastChange)
// Check if the last change is a potential shortcut trigger
if (!text || !" ')\\".includes(text)) return;
if (!text || !( " ')\\".includes(text) || text.startsWith('\n'))) return;
const document = editor.document;
const position = lastChange.range.end;

View File

@@ -169,9 +169,10 @@ export class CMEditor implements AbstractEditor {
])),
EditorView.updateListener.of((update) => {
let doc = update.state.doc;
console.log('update', update)
update.changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
if (" ')\\_".includes(inserted.toString())) {
console.log('inserted', inserted)
if (" ')\\_".includes(inserted.toString()) || inserted.lines > 1) {
console.log("changes", update.changes, update.changes.desc);
let line = doc.lineAt(fromA);
let e = fromA - line.from;