@codemirror/autocomplete 6.16.0 → 6.16.1

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.16.1 (2024-05-29)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug where multiple backslashes before a brace in a snippet were all removed.
6
+
1
7
  ## 6.16.0 (2024-04-12)
2
8
 
3
9
  ### New features
package/dist/index.cjs CHANGED
@@ -1420,14 +1420,14 @@ class Snippet {
1420
1420
  positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));
1421
1421
  line = line.slice(0, m.index) + name + line.slice(m.index + m[0].length);
1422
1422
  }
1423
- for (let esc; esc = /\\([{}])/.exec(line);) {
1424
- line = line.slice(0, esc.index) + esc[1] + line.slice(esc.index + esc[0].length);
1423
+ line = line.replace(/\\([{}])/g, (_, brace, index) => {
1425
1424
  for (let pos of positions)
1426
- if (pos.line == lines.length && pos.from > esc.index) {
1425
+ if (pos.line == lines.length && pos.from > index) {
1427
1426
  pos.from--;
1428
1427
  pos.to--;
1429
1428
  }
1430
- }
1429
+ return brace;
1430
+ });
1431
1431
  lines.push(line);
1432
1432
  }
1433
1433
  return new Snippet(lines, positions);
package/dist/index.d.cts CHANGED
@@ -522,7 +522,7 @@ interface CloseBracketConfig {
522
522
  /**
523
523
  The opening brackets to close. Defaults to `["(", "[", "{", "'",
524
524
  '"']`. Brackets may be single characters or a triple of quotes
525
- (as in `"''''"`).
525
+ (as in `"'''"`).
526
526
  */
527
527
  brackets?: string[];
528
528
  /**
package/dist/index.d.ts CHANGED
@@ -522,7 +522,7 @@ interface CloseBracketConfig {
522
522
  /**
523
523
  The opening brackets to close. Defaults to `["(", "[", "{", "'",
524
524
  '"']`. Brackets may be single characters or a triple of quotes
525
- (as in `"''''"`).
525
+ (as in `"'''"`).
526
526
  */
527
527
  brackets?: string[];
528
528
  /**
package/dist/index.js CHANGED
@@ -1418,14 +1418,14 @@ class Snippet {
1418
1418
  positions.push(new FieldPos(found, lines.length, m.index, m.index + name.length));
1419
1419
  line = line.slice(0, m.index) + name + line.slice(m.index + m[0].length);
1420
1420
  }
1421
- for (let esc; esc = /\\([{}])/.exec(line);) {
1422
- line = line.slice(0, esc.index) + esc[1] + line.slice(esc.index + esc[0].length);
1421
+ line = line.replace(/\\([{}])/g, (_, brace, index) => {
1423
1422
  for (let pos of positions)
1424
- if (pos.line == lines.length && pos.from > esc.index) {
1423
+ if (pos.line == lines.length && pos.from > index) {
1425
1424
  pos.from--;
1426
1425
  pos.to--;
1427
1426
  }
1428
- }
1427
+ return brace;
1428
+ });
1429
1429
  lines.push(line);
1430
1430
  }
1431
1431
  return new Snippet(lines, positions);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/autocomplete",
3
- "version": "6.16.0",
3
+ "version": "6.16.1",
4
4
  "description": "Autocompletion for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",