rope: fast random access of lines
- Dominant language
- Go
- Stars
- 10
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
Do ropes support accessing a random line without reading each rune from the start and count newlines?
I have not studies the theory, but here this is mentioned at least:
https://xi-editor.io/docs/rope_science_02.html#line-endings
rope.IndexFunc indicates that no faster method is implemented.
Maybe this is not needed in the current implementation, as you just store the current offset, slice there, read each rune and draw until the screen is full. This needs just a screenfull of reads.
I'm thinking how to implement wrapped lines, where a line within view could be very long and you want to jump to the beginning of the next after drawing the leading runes in the viewport.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the rope implementation around rope.IndexFunc and the linked Rope Science discussion on line endings. Check how the editor currently tracks offsets and draws visible text, including wrapped lines. Done would require a decided, tested approach for random line access and wrapped-line navigation, but the issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100