@codemirror/view 6.38.0 → 6.38.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,11 @@
1
+ ## 6.38.1 (2025-07-15)
2
+
3
+ ### Bug fixes
4
+
5
+ Make the keymap not dispatch Alt key combos on macOS by key code, because those are generally used to type special characters.
6
+
7
+ Fix a layout bug that could occur with very narrow editors.
8
+
1
9
  ## 6.38.0 (2025-06-27)
2
10
 
3
11
  ### New features
package/dist/index.cjs CHANGED
@@ -5095,7 +5095,7 @@ class HeightOracle {
5095
5095
  heightForLine(length) {
5096
5096
  if (!this.lineWrapping)
5097
5097
  return this.lineHeight;
5098
- let lines = 1 + Math.max(0, Math.ceil((length - this.lineLength) / (this.lineLength - 5)));
5098
+ let lines = 1 + Math.max(0, Math.ceil((length - this.lineLength) / Math.max(1, this.lineLength - 5)));
5099
5099
  return lines * this.lineHeight;
5100
5100
  }
5101
5101
  setDoc(doc) { this.doc = doc; return this; }
@@ -6066,7 +6066,7 @@ class ViewState {
6066
6066
  refresh = true;
6067
6067
  if (refresh || oracle.lineWrapping && Math.abs(contentWidth - this.contentDOMWidth) > oracle.charWidth) {
6068
6068
  let { lineHeight, charWidth, textHeight } = view.docView.measureTextSize();
6069
- refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, contentWidth / charWidth, lineHeights);
6069
+ refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, Math.max(5, contentWidth / charWidth), lineHeights);
6070
6070
  if (refresh) {
6071
6071
  view.docView.minWidth = 0;
6072
6072
  result |= 16 /* UpdateFlag.Geometry */;
@@ -8802,6 +8802,8 @@ function runHandlers(map, event, view, scope) {
8802
8802
  else if (isChar && (event.altKey || event.metaKey || event.ctrlKey) &&
8803
8803
  // Ctrl-Alt may be used for AltGr on Windows
8804
8804
  !(browser.windows && event.ctrlKey && event.altKey) &&
8805
+ // Alt-combinations on macOS tend to be typed characters
8806
+ !(browser.mac && event.altKey && !event.ctrlKey) &&
8805
8807
  (baseName = w3cKeyname.base[event.keyCode]) && baseName != name) {
8806
8808
  if (runFor(scopeObj[prefix + modifiers(baseName, event, true)])) {
8807
8809
  handled = true;
package/dist/index.js CHANGED
@@ -5091,7 +5091,7 @@ class HeightOracle {
5091
5091
  heightForLine(length) {
5092
5092
  if (!this.lineWrapping)
5093
5093
  return this.lineHeight;
5094
- let lines = 1 + Math.max(0, Math.ceil((length - this.lineLength) / (this.lineLength - 5)));
5094
+ let lines = 1 + Math.max(0, Math.ceil((length - this.lineLength) / Math.max(1, this.lineLength - 5)));
5095
5095
  return lines * this.lineHeight;
5096
5096
  }
5097
5097
  setDoc(doc) { this.doc = doc; return this; }
@@ -6061,7 +6061,7 @@ class ViewState {
6061
6061
  refresh = true;
6062
6062
  if (refresh || oracle.lineWrapping && Math.abs(contentWidth - this.contentDOMWidth) > oracle.charWidth) {
6063
6063
  let { lineHeight, charWidth, textHeight } = view.docView.measureTextSize();
6064
- refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, contentWidth / charWidth, lineHeights);
6064
+ refresh = lineHeight > 0 && oracle.refresh(whiteSpace, lineHeight, charWidth, textHeight, Math.max(5, contentWidth / charWidth), lineHeights);
6065
6065
  if (refresh) {
6066
6066
  view.docView.minWidth = 0;
6067
6067
  result |= 16 /* UpdateFlag.Geometry */;
@@ -8797,6 +8797,8 @@ function runHandlers(map, event, view, scope) {
8797
8797
  else if (isChar && (event.altKey || event.metaKey || event.ctrlKey) &&
8798
8798
  // Ctrl-Alt may be used for AltGr on Windows
8799
8799
  !(browser.windows && event.ctrlKey && event.altKey) &&
8800
+ // Alt-combinations on macOS tend to be typed characters
8801
+ !(browser.mac && event.altKey && !event.ctrlKey) &&
8800
8802
  (baseName = base[event.keyCode]) && baseName != name) {
8801
8803
  if (runFor(scopeObj[prefix + modifiers(baseName, event, true)])) {
8802
8804
  handled = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.38.0",
3
+ "version": "6.38.1",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",