stream-monaco 0.0.6 → 0.0.7

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/dist/index.cjs CHANGED
@@ -1125,11 +1125,12 @@ var DiffEditorManager = class {
1125
1125
  this.lastKnownOriginalCode = original;
1126
1126
  }
1127
1127
  let prevM = this.lastKnownModifiedCode;
1128
+ const buffered = this.appendBufferDiff.length > 0 ? this.appendBufferDiff.join("") : "";
1128
1129
  if (this.appendBufferDiff.length > 0) try {
1129
- prevM = m.getValue();
1130
+ prevM = m.getValue() + buffered;
1130
1131
  this.lastKnownModifiedCode = prevM;
1131
1132
  } catch {
1132
- prevM = this.lastKnownModifiedCode ?? "";
1133
+ prevM = (this.lastKnownModifiedCode ?? "") + buffered;
1133
1134
  }
1134
1135
  const prevMLineCount = m.getLineCount();
1135
1136
  if (prevM !== modified) {
@@ -1729,7 +1730,8 @@ var EditorManager = class {
1729
1730
  }
1730
1731
  return;
1731
1732
  }
1732
- const prevCode = this.appendBuffer.length > 0 ? this.editorView.getValue() : this.lastKnownCode ?? this.editorView.getValue();
1733
+ const buffered = this.appendBuffer.length > 0 ? this.appendBuffer.join("") : "";
1734
+ const prevCode = this.appendBuffer.length > 0 ? this.editorView.getValue() + buffered : this.lastKnownCode ?? this.editorView.getValue();
1733
1735
  if (prevCode === newCode) return;
1734
1736
  if (newCode.startsWith(prevCode) && prevCode.length < newCode.length) {
1735
1737
  const suffix = newCode.slice(prevCode.length);
@@ -1820,6 +1822,9 @@ var EditorManager = class {
1820
1822
  text,
1821
1823
  forceMoveMarkers: true
1822
1824
  }]);
1825
+ try {
1826
+ this.lastKnownCode = model.getValue();
1827
+ } catch {}
1823
1828
  const newLineCount = model.getLineCount();
1824
1829
  if (lastLine !== newLineCount) {
1825
1830
  this.cachedLineCount = newLineCount;
package/dist/index.js CHANGED
@@ -1097,11 +1097,12 @@ var DiffEditorManager = class {
1097
1097
  this.lastKnownOriginalCode = original;
1098
1098
  }
1099
1099
  let prevM = this.lastKnownModifiedCode;
1100
+ const buffered = this.appendBufferDiff.length > 0 ? this.appendBufferDiff.join("") : "";
1100
1101
  if (this.appendBufferDiff.length > 0) try {
1101
- prevM = m.getValue();
1102
+ prevM = m.getValue() + buffered;
1102
1103
  this.lastKnownModifiedCode = prevM;
1103
1104
  } catch {
1104
- prevM = this.lastKnownModifiedCode ?? "";
1105
+ prevM = (this.lastKnownModifiedCode ?? "") + buffered;
1105
1106
  }
1106
1107
  const prevMLineCount = m.getLineCount();
1107
1108
  if (prevM !== modified) {
@@ -1701,7 +1702,8 @@ var EditorManager = class {
1701
1702
  }
1702
1703
  return;
1703
1704
  }
1704
- const prevCode = this.appendBuffer.length > 0 ? this.editorView.getValue() : this.lastKnownCode ?? this.editorView.getValue();
1705
+ const buffered = this.appendBuffer.length > 0 ? this.appendBuffer.join("") : "";
1706
+ const prevCode = this.appendBuffer.length > 0 ? this.editorView.getValue() + buffered : this.lastKnownCode ?? this.editorView.getValue();
1705
1707
  if (prevCode === newCode) return;
1706
1708
  if (newCode.startsWith(prevCode) && prevCode.length < newCode.length) {
1707
1709
  const suffix = newCode.slice(prevCode.length);
@@ -1792,6 +1794,9 @@ var EditorManager = class {
1792
1794
  text,
1793
1795
  forceMoveMarkers: true
1794
1796
  }]);
1797
+ try {
1798
+ this.lastKnownCode = model.getValue();
1799
+ } catch {}
1795
1800
  const newLineCount = model.getLineCount();
1796
1801
  if (lastLine !== newLineCount) {
1797
1802
  this.cachedLineCount = newLineCount;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "stream-monaco",
3
3
  "type": "module",
4
- "version": "0.0.6",
4
+ "version": "0.0.7",
5
5
  "packageManager": "pnpm@10.23.0",
6
6
  "description": "A framework-agnostic library for integrating Monaco Editor with Shiki highlighting, optimized for streaming updates.",
7
7
  "author": "Simon He",