Repository navigation
Conversation
|
Design update (commit 764753b): the border-rendered scrollbar is now thumb-only no more — the track renders as the border glyph itself ( |
|
@espetro yep, you're right. Overlay zones register I'd drop the Two options:
I want 2. Take the border move on top of it if you like the look, just not as the thing keeping copy correct. Rest:
The |
764753b to
3251030
Compare
Record the cells each scrollbar repainted while drawing the frame and hand them to ContentRegion as exclude rects, so extract_selected_text skips rail glyphs wherever a widget decided to paint them. Replaces the column-shave approach: nothing assumes the rail sits in a fixed column, and selection/highlight geometry is left alone.
3251030 to
31594a5
Compare
|
Thanks for the feedback @tontinton ; I reworked it as option 2: the paint record now carries copy correctness, and everything else is gone.
Rebased onto current |
tontinton
left a comment
There was a problem hiding this comment.
Nice, much cleaner. One catch: painted_rails() also returns rails that a modal later painted over, so with a right split open, copying from help gives trl+B instead of Ctrl+B. Only skipping cells that still show ▐ at copy time fixes it, and then you can drop the before/after snapshot too.
Drop the per-frame PAINTED_RAILS record. A modal that overpaints cells another scrollbar painted left a stale record, so copying modal text lost characters. Copy now excludes only cells that still show the thumb glyph.
|
Thanks, you were right about the stale record. I dropped the |
|
/review |
There was a problem hiding this comment.
Verdict: Merge after one fix. Reading the rail from the live buffer at copy time is the right call and resolves the stale-record bug from the last review. Please also update the PR description: it still describes the dropped PAINTED_RAILS design.
Direction: The PR takes the best approach. Checking what the user actually sees at copy time works at every scrollbar call site without moving rails or shrinking zones.
| pub line_breaks: LineBreaks, | ||
| /// Cells chrome still covers this frame (live scrollbar thumbs). Cells | ||
| /// inside are skipped no matter what the selection covers. | ||
| pub exclude: Vec<Rect>, |
There was a problem hiding this comment.
MEDIUM: The next copy path that forgets one line will leak the scrollbar glyph again, and the tests won't notice.
This field comes entirely from the buffer and area that copy already has. The new tests fill it in by hand, so deleting it from mouse.rs still passes.
Fix: drop the field and compute live_rails(buf, region.area) inside extract_selected_text.
There was a problem hiding this comment.
Done in f824afd — ContentRegion.exclude is gone and extract_selected_text computes live_rails(buf, region.area) itself, so a copy path can't forget it. Tests no longer fill the field in by hand. Also updated the PR description, which still described the dropped PAINTED_RAILS design. @tontinton
ContentRegion.exclude was filled by hand at each copy site, so a path that forgot it would leak scrollbar glyphs again with no test noticing. extract_selected_text now computes live_rails from the buffer and region area it already has, and the field is gone.
|
Thanks! Ended up fixing this a different way in a0bc4d9, so closing. |
Closes #917. Relates to #409, #248. Negative prior art: copilot-cli#4009.
Problem
Overlay-zone copy is cell-based, and modal scrollbars paint
▐into the last content column of their area, so any full-width selection in/btw, usage modal, or help modal drags scrollbar glyphs into the clipboard. Chat copy is unaffected (state-based via segment cache).Fix
At copy time,
extract_selected_textscans each region's rightmost column in the live buffer (scrollbar::live_rails) andappend_rowsskips only the cells that still show the thumb glyph. Nothing is recorded at paint time, so a rail a modal later painted over stops excluding as soon as its cells show text again, and a hidden thumb leaves nothing to skip. This covers every scrollbar call site (modals,search_modal,file_picker,lua_float) without moving the rail into the border or shrinking the selectable region.Testing
overlay_copy_skips_painted_rail_cellsdrives the real render path: draws the app with the help modal to aTestBackend, asserts the recorded rail cells hold▐and belong to theOverlayzone, then assertsextract_selected_textreturns modal text with no▐.overlay_copy_reads_rails_from_the_live_buffercovers the stale-record case: a chat split's rail runs under the help modal, and copying the modal keeps the overpainted text intact.cargo clippy -p maki-ui --all-targets -- -D warningsclean;cargo test -p maki-uigreen./btw→ select full width → paste contains no▐.