Ghost cursor appears at top-left (0,0) on initialization
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- typescript
- Lĩnh vực
- frontend
Hướng nghiên cứu
Kiểm tra quá trình khởi tạo CanvasRenderer xung quanh lastCursorPosition và logic kết xuất con trỏ được xác định gần các dòng 1337 và 1561-1578. Tái hiện vấn đề bằng cách mở một Terminal bật con trỏ trong Chrome, sau đó xác minh rằng quá trình khởi tạo và kết xuất nội dung tiếp theo chỉ để lại một con trỏ ở vị trí thực tế thay vì một con trỏ ở (0,0).
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
When initializing a Terminal instance, a ghost cursor is rendered at the top-left corner (coordinates 0,0) in addition to the actual cursor position. This cursor persists and doesn't disappear even when the terminal receives content.
Steps to Reproduce
- Create a new Terminal instance with cursor enabled
- Call
terminal.open(container) - Observe that a cursor appears at the top-left corner (0,0)
- The ghost cursor remains even after terminal content is rendered
Expected Behavior
Only one cursor should be visible at the actual cursor position, not at (0,0).
Actual Behavior
Two cursors are visible:
- The correct cursor at the actual position
- A ghost cursor at the top-left corner (0,0)
Root Cause Analysis
After investigating the minified source code, the issue appears to be in CanvasRenderer:
- Initialization:
lastCursorPositionis initialized to{ x: 0, y: 0 }(around line 1337) - Rendering: The cursor rendering logic at line 1561-1578 checks
g === 0 && I.visible && this.cursorVisible && this.renderCursor(I.x, I.y) - Problem: When the cursor moves to a new position, the old position (0,0) is not properly cleared, leaving a ghost cursor
Workaround
TBD
Environment
- ghostty-web version: 0.4.0
- Browser: Chrome (tested)
- OS: macOS
Suggested Fix
The CanvasRenderer should either:
- Not render the cursor until a valid position is set
- Properly clear the initial (0,0) position when the cursor moves
- Initialize
lastCursorPositionto a sentinel value that prevents initial rendering
- 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
-
buffer translateToString()/getChars() return '' for empty cells, collapsing cursor-positioned textĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
coder/ghostty-web#205 ·
-
Độ 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 ·
Tất cả issue của coder/ghostty-web
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 70/100
siyuan-note/siyuan#20517 ·
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 70/100
NaturalIntelligence/fast-xml-parser#890 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
zsviczian/obsidian-excalidraw-plugin#3000 ·
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 68/100
pnpm/get.pnpm.io#68 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
nuxt-modules/better-auth#578 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày