terminal: scrollback lines longer than 4096 bytes are cut off
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- cli, desktop-dev
Research direction
Start with terminal_sb_line_extract in extensions/terminal/terminal.c, where the fixed 4097-byte scrollback buffer truncates long UTF-8 rows. Review how the buffer is sized from the terminal column count, including the proposed cols * 4 * VTERM_MAX_CHARS_PER_CELL + 1 calculation and combining-character handling. Run verify after changing the allocation or bounds logic and confirm that long CJK and emoji rows remain intact in scrollback.
Written by the indexing model from the issue text.
Description
Lines stored in the scrollback of M-x terminal are cut off without a sign once they are longer than 4096 bytes in UTF-8.
terminal_sb_line_extract (extensions/terminal/terminal.c) writes into terminal->sb_line_buf, 4097 bytes, and stops at if (pos + N > max) break; when it is full: the rest of the row is dropped.
To reproduce: a terminal wider than about 1024 columns (a maximized window on a large display with a small font) full of CJK text (3 bytes each) or emoji (4 bytes): only the first 1024 to 1365 glyphs of each row that scrolls off are kept in the history.
Fix: size the buffer from cols (cols * 4 * VTERM_MAX_CHARS_PER_CELL + 1 once combining characters are kept, see the issue on combining characters), or allocate it when cols is larger than the fixed buffer.
Found by the review of #2522 (a pre-existing issue, not changed there).
An agent can fix this and check it with verify.
- Dominant language
- Common Lisp
- Stars
- 3.1k
- Forks
- 261
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 117
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lem-project/lem
-
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
lem-project/lem#2525 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
lem-project/lem#2488 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
lem-project/lem#2369 ·
Maintainers usually reply within 1 day
-
unix-paste-bugOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
lem-project/lem#2360 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 83/100
lem-project/lem#2321 · 2 reactions ·
Maintainers usually reply within 1 day
Similar issues
-
convert says pages may not match Word's even when the output is never laid out (DOCX, ODT, TXT…)Openbugfix
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
fix(board): the terminal board's line above the list shows each key hint once and fits the widthOpenusersim
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
WenyuChiou/agent-board#2312 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
GitHub registry install via `gh` credentials rewrites `\u0000`–`\u001f` escapes in source files to `^@`–`^_`Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 2 days
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
ajithakdev/claude-desktop-rpm#43 ·
Maintainers usually reply within 1 day