ntk 3.7.1 → 3.7.2

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.
@@ -47,7 +47,12 @@ export class TextLayout {
47
47
  // ---- normalize spans, resolve fonts eagerly ----
48
48
  // unknown span fields ride along untouched (widgets attach markers like
49
49
  // MarkdownView's _deco/_href and read them back from line runs)
50
- const spans = (typeof content === 'string' ? [{ text: content }] : content).map((s) => {
50
+ // An empty span list is a legitimate thing to lay out — MarkdownView
51
+ // reaches it for a blank paragraph while a document is being typed —
52
+ // and every line still needs a style to take its metrics from, so
53
+ // stand one in rather than crashing on the first empty line.
54
+ const given = typeof content === 'string' ? [{ text: content }] : content;
55
+ const spans = (given.length ? given : [{ text: '' }]).map((s) => {
51
56
  const merged = {
52
57
  ...s,
53
58
  text: String(s.text ?? ''),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ntk",
3
- "version": "3.7.1",
3
+ "version": "3.7.2",
4
4
  "description": "Desktop UI toolkit for X11 with canvas-like 2d and OpenGL rendering",
5
5
  "author": "Andrey Sidorov <sidorares@yandex.ru>",
6
6
  "license": "MIT",