buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned text
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- typescript
- Lĩnh vực
- api
Hướng nghiên cứu
Bắt đầu từ lib/buffer.ts, nơi getChars() trả về chuỗi rỗng cho các ô có codepoint === 0, và từ phần triển khai translateToString được xây dựng trên hàm đó. Hãy dùng TerminalCore.getSelection() làm tham chiếu, vì hàm này đã thay ô trống bằng một khoảng trắng. Công việc được xem là hoàn thành khi bước tái hiện trong issue cho ra "a b" từ translateToString(true) và việc cắt bỏ khoảng trắng cuối dòng vẫn hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
IBufferLine.translateToString() (and IBufferCell.getChars()) return '' for empty cells (codepoint === 0), so text that an application positioned with cursor movement collapses: every blank run is removed and the remaining characters are glued together. xterm.js returns a space for an empty cell (translateToString(trimRight) keeps the layout). TerminalCore.getSelection() already does the right thing (k += " " for codepoint === 0), so the two disagree on the same screen.
This is separate from #200 (multi-codepoint graphemes truncated); the blank-cell case affects plain ASCII. Seen on [email protected]; lib/buffer.ts on main has the same codepoint === 0 ? '' in getChars().
Minimal reproduction
<div id="t"></div>
<script type="module">
import { init, Terminal } from 'ghostty-web';
await init();
const term = new Terminal({ cols: 40, rows: 5 });
term.open(document.getElementById('t'));
// "a", move right 5 columns (CUF), "b": what vim/htop/tmux status bars do all the time
term.write('a\x1b[5Cb', () => {
const line = term.buffer.active.getLine(0);
console.log(JSON.stringify(line.translateToString(true))); // actual: "ab" expected: "a b"
term.select(0, 0, 7);
console.log(JSON.stringify(term.getSelection())); // "a b" (selection is correct)
});
</script>
Anything built on the public buffer API (search, serialize, accessibility mirrors, "copy line", tests) sees the collapsed text.
Suggested fix
getChars() returns ' ' for codepoint === 0 (width 1), or translateToString substitutes ' ' for empty cells before trimEnd().
Found while comparing renderers for https://github.com/erisera-code/clawser.
- Ngôn ngữ chính
- TypeScript
- Star
- 2.9k
- Fork
- 182
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của coder/ghostty-web
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
coder/ghostty-web#204 ·
-
Alt+<printable key> sends the bare key with no ESC prefix (readline/emacs/tmux meta bindings lost)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
coder/ghostty-web#203 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
coder/ghostty-web#199 ·
-
Public buffer getChars and translateToString truncate multi-codepoint graphemesCó thể đã có người làm @schickling-assistant đã nhận 12 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
coder/ghostty-web#200 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
coder/ghostty-web#198 ·
Tất cả issue của coder/ghostty-web
Issue tương tự
-
documentation good first issue hacktoberfest help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
libredb/libredb-studio#1756 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
state:triage-needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
lingdojo/kana-dojo#32365 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
friction
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
kentcdodds/kody#3706 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
copperheadhq/copperhead#378 ·
Maintainer thường phản hồi trong vòng 1 ngày