@codemirror/language 0.19.7 → 0.19.8

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
+ ## 0.19.8 (2022-03-03)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix an issue that could cause indentation logic to use the wrong line content when indenting multiple lines at once.
6
+
1
7
  ## 0.19.7 (2021-12-02)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -822,9 +822,11 @@ class IndentContext {
822
822
  */
823
823
  lineAt(pos, bias = 1) {
824
824
  let line = this.state.doc.lineAt(pos);
825
- let { simulateBreak } = this.options;
825
+ let { simulateBreak, simulateDoubleBreak } = this.options;
826
826
  if (simulateBreak != null && simulateBreak >= line.from && simulateBreak <= line.to) {
827
- if (bias < 0 ? simulateBreak < pos : simulateBreak <= pos)
827
+ if (simulateDoubleBreak && simulateBreak == pos)
828
+ return { text: "", from: pos };
829
+ else if (bias < 0 ? simulateBreak < pos : simulateBreak <= pos)
828
830
  return { text: line.text.slice(simulateBreak - line.from), from: simulateBreak };
829
831
  else
830
832
  return { text: line.text.slice(0, simulateBreak - line.from), from: line.from };
package/dist/index.js CHANGED
@@ -818,9 +818,11 @@ class IndentContext {
818
818
  */
819
819
  lineAt(pos, bias = 1) {
820
820
  let line = this.state.doc.lineAt(pos);
821
- let { simulateBreak } = this.options;
821
+ let { simulateBreak, simulateDoubleBreak } = this.options;
822
822
  if (simulateBreak != null && simulateBreak >= line.from && simulateBreak <= line.to) {
823
- if (bias < 0 ? simulateBreak < pos : simulateBreak <= pos)
823
+ if (simulateDoubleBreak && simulateBreak == pos)
824
+ return { text: "", from: pos };
825
+ else if (bias < 0 ? simulateBreak < pos : simulateBreak <= pos)
824
826
  return { text: line.text.slice(simulateBreak - line.from), from: simulateBreak };
825
827
  else
826
828
  return { text: line.text.slice(0, simulateBreak - line.from), from: line.from };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/language",
3
- "version": "0.19.7",
3
+ "version": "0.19.8",
4
4
  "description": "Language support infrastructure for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",