dsh-neotui 0.1.3 → 0.1.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.
- package/package.json +1 -1
- package/src/md.js +3 -0
- package/src/text.js +1 -0
- package/src/views.js +9 -0
package/package.json
CHANGED
package/src/md.js
CHANGED
|
@@ -161,6 +161,9 @@ function highlightLine(line, lang) {
|
|
|
161
161
|
// Returns array of lines; each line = array of segments.
|
|
162
162
|
|
|
163
163
|
export function renderMd(text, width, sink = null, opts = {}) {
|
|
164
|
+
// defensive: snapshot-derived blocks can carry non-string text; a `.replace`
|
|
165
|
+
// on an object would throw mid-frame and freeze the whole terminal
|
|
166
|
+
if (typeof text !== "string") text = String(text ?? "");
|
|
164
167
|
const hardBreaks = !!opts.hardBreaks;
|
|
165
168
|
const lines = [];
|
|
166
169
|
const pushLine = (segs = []) => {
|
package/src/text.js
CHANGED
package/src/views.js
CHANGED
|
@@ -2951,6 +2951,15 @@ export class App {
|
|
|
2951
2951
|
if (this.toastMsg && Date.now() > this.toastUntil) { this.toastMsg = null; this.dirty = true; }
|
|
2952
2952
|
} catch (e) {
|
|
2953
2953
|
this.log("render error (kept running):", e);
|
|
2954
|
+
// stderr is invisible under the alt screen — record the stack where
|
|
2955
|
+
// it can be read, then flush whatever composed before the throw so
|
|
2956
|
+
// the terminal never sits frozen on the previous frame.
|
|
2957
|
+
try {
|
|
2958
|
+
const dir = process.env.DSH_HOME ?? join(process.env.HOME ?? ".", ".dsh");
|
|
2959
|
+
mkdirSync(dir, { recursive: true });
|
|
2960
|
+
appendFileSync(join(dir, "tui-error.log"), `${new Date().toISOString()} ${e?.stack ?? e}\n`);
|
|
2961
|
+
} catch {}
|
|
2962
|
+
try { this.term?.output?.write?.(this.screen.render()); } catch {}
|
|
2954
2963
|
this.dirty = true;
|
|
2955
2964
|
}
|
|
2956
2965
|
this.timer = setTimeout(tick, 33);
|