mocode-ai 0.5.0 → 0.5.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.
- package/dist/ui/layout.js +16 -7
- package/dist/ui/render.js +4 -4
- package/package.json +1 -1
package/dist/ui/layout.js
CHANGED
|
@@ -191,11 +191,13 @@ export function contentWrite(s) {
|
|
|
191
191
|
const bottom = g.contentBottom;
|
|
192
192
|
// resize 后 contentRow 可能过时(拖终端框):
|
|
193
193
|
// - 缩小:contentRow > 新 bottom → 钳到新 bottom
|
|
194
|
-
// - 放大:contentRow < 新 bottom 且回尾 → 推进到 min(total, bottom)
|
|
194
|
+
// - 放大:contentRow < 新 bottom 且回尾 → 推进到 min(total+1, bottom)
|
|
195
|
+
// total+1 是合法「待写位」(所有行已 breakRow 提交、光标在新空行);用 total 会把续写位拉回到
|
|
196
|
+
// 最后一行 banner/content 上,首次 contentWrite 覆盖 banner(首条消息「插到 logo 下面」bug)。
|
|
195
197
|
if (contentRow > bottom)
|
|
196
198
|
contentRow = bottom;
|
|
197
199
|
else if (scrollOffset === 0 && contentRow < bottom) {
|
|
198
|
-
contentRow = Math.min(content.totalRows(), bottom);
|
|
200
|
+
contentRow = Math.min(content.totalRows() + 1, bottom);
|
|
199
201
|
}
|
|
200
202
|
const startRow = contentRow;
|
|
201
203
|
const startCol = contentCol;
|
|
@@ -353,6 +355,11 @@ export function writeBanner(lines) {
|
|
|
353
355
|
content.setLines(lines);
|
|
354
356
|
bannerH = lines.length;
|
|
355
357
|
bannerRows = lines;
|
|
358
|
+
// 续写位推进到 banner 之后:clearContent 把 contentRow 归到 1,writeBanner 灌入 bannerH 行
|
|
359
|
+
// 但不动 contentRow → 首次 contentWrite 会从屏行 1 写出(覆盖 banner)。这里同步修正,
|
|
360
|
+
// 让首条用户消息从 banner 下方开始(与 buffer 尾部对齐)。仅首次走这条,后续 rewriteBanner 不动续写位。
|
|
361
|
+
contentRow = Math.min(bannerH + 1, getGeo().contentBottom);
|
|
362
|
+
contentCol = 1;
|
|
356
363
|
if (scrollOffset === 0)
|
|
357
364
|
repaintViewport();
|
|
358
365
|
return;
|
|
@@ -1410,15 +1417,16 @@ export function paintLiveAtCursor(text) {
|
|
|
1410
1417
|
}
|
|
1411
1418
|
// resize 后 contentRow 可能过时(拖终端框):
|
|
1412
1419
|
// - 缩小:contentRow > 新 bottom → 钳到新 bottom
|
|
1413
|
-
// - 放大:contentRow < 新 bottom 且回尾 → 推进到 min(total, bottom)(内容末尾或新区底)
|
|
1414
|
-
//
|
|
1420
|
+
// - 放大:contentRow < 新 bottom 且回尾 → 推进到 min(total+1, bottom)(内容末尾或新区底)
|
|
1421
|
+
// total+1 是合法「待写位」(breakRow 后光标在新空行);用 total 会把续写位拉回最后一行,
|
|
1422
|
+
// 首次 contentWrite 覆盖 banner(首条消息「插到 logo 下面」bug)。
|
|
1415
1423
|
// 否则 cup 到旧行号→帧画在屏幕中间(旧 bottom 位置),而非内容末尾/最底部。
|
|
1416
1424
|
const g = getGeo();
|
|
1417
1425
|
const total = content.totalRows();
|
|
1418
1426
|
if (contentRow > g.contentBottom)
|
|
1419
1427
|
contentRow = g.contentBottom;
|
|
1420
1428
|
if (scrollOffset === 0 && contentRow < g.contentBottom) {
|
|
1421
|
-
contentRow = Math.min(total, g.contentBottom);
|
|
1429
|
+
contentRow = Math.min(total + 1, g.contentBottom);
|
|
1422
1430
|
}
|
|
1423
1431
|
let out = '';
|
|
1424
1432
|
if (frameRow && (frameRow !== contentRow || frameCol !== contentCol)) {
|
|
@@ -1854,9 +1862,10 @@ export function enterAltScreen() {
|
|
|
1854
1862
|
// 缩小:contentRow > 新 bottom → 钳到新 bottom
|
|
1855
1863
|
if (contentRow > g.contentBottom)
|
|
1856
1864
|
contentRow = g.contentBottom;
|
|
1857
|
-
// 放大:contentRow < 新 bottom 且回尾(offset=0)→ 推进到 min(total, bottom)
|
|
1865
|
+
// 放大:contentRow < 新 bottom 且回尾(offset=0)→ 推进到 min(total+1, bottom)
|
|
1866
|
+
// total+1 是合法「待写位」;用 total 会把续写位拉回最后一行,首次 contentWrite 覆盖 banner
|
|
1858
1867
|
if (scrollOffset === 0 && contentRow < g.contentBottom) {
|
|
1859
|
-
contentRow = Math.min(total, g.contentBottom);
|
|
1868
|
+
contentRow = Math.min(total + 1, g.contentBottom);
|
|
1860
1869
|
}
|
|
1861
1870
|
if (frameRow && frameRow > g.contentBottom)
|
|
1862
1871
|
frameRow = g.contentBottom;
|
package/dist/ui/render.js
CHANGED
|
@@ -236,10 +236,10 @@ const LOGO_W = 35; // logo 区显示宽度
|
|
|
236
236
|
const LOGO_GAP = 0; // logo 与信息区之间的间隔
|
|
237
237
|
// 块字符画 4 行:M / o / C / o / d / e,块字符上半/下半合并两个 ASCII 行
|
|
238
238
|
const LOGO_LINES = [
|
|
239
|
-
'
|
|
240
|
-
'
|
|
241
|
-
'█ █ █ █ █ █
|
|
242
|
-
'▀ ▀ ▀ ▀▀▀▀
|
|
239
|
+
' ▄ ',
|
|
240
|
+
'█▀█▀█ █▀▀█ ▄▄▄▄ ▄▄▄▄ ▄▄▄█ ▄▄▄▄',
|
|
241
|
+
'█ █ █ █ █ █ ▀ █ █ █ █ █▄▄█',
|
|
242
|
+
'▀ ▀ ▀ ▀▀▀▀ █▄▄█ █▄▄█ █▄▄█ █▄▄▄',
|
|
243
243
|
];
|
|
244
244
|
/** 取第 idx 行 logo(着色 + 补宽 + LOGO_GAP 间隔),与 info 行直接拼接(neofetch 风)。 */
|
|
245
245
|
function logoLine(idx) {
|