blots-editor 0.0.3 → 0.0.4

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.
@@ -29,7 +29,7 @@ export function Editor({ value: line, lineNumberRightSpacing = 1, cursorOffset =
29
29
  return Math.max(0, lineNumberRightSpacing);
30
30
  }, [lineNumberRightSpacing]);
31
31
  const currentLineNumberLength = useMemo(() => {
32
- return stringWidth(String(value.length - 1));
32
+ return Math.max(stringWidth(String(value.length - 1)), 1);
33
33
  }, [stringWidth, cursor.line]);
34
34
  const { setCursorPosition } = useCursor();
35
35
  const boxRef = useRef(null);
@@ -185,7 +185,7 @@ export function Editor({ value: line, lineNumberRightSpacing = 1, cursorOffset =
185
185
  setCursorPosition({ x: x, y: y });
186
186
  return (React.createElement(Box, { ref: boxRef, height: "100%", width: "100%", backgroundColor: "#1e1e1e", flexDirection: "column" }, value.map((each, number) => {
187
187
  return (React.createElement(Box, { key: number, flexDirection: "row" },
188
- React.createElement(Box, { width: Math.max(currentLineNumberLength - 1, 1), justifyContent: "flex-end", marginRight: checkedLineNumberRightSpacing },
188
+ React.createElement(Box, { width: currentLineNumberLength, justifyContent: "flex-end", marginRight: checkedLineNumberRightSpacing },
189
189
  React.createElement(Text, { bold: true }, number)),
190
190
  React.createElement(Text, null, each)));
191
191
  })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blots-editor",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "A lightweight Markdown editor for the terminal, built on ink-cartridge",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",