-
Notifications
You must be signed in to change notification settings - Fork 391
Make whitespace inside selections visible #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lhecker
merged 19 commits into
microsoft:main
from
pheonick:feature/toggle-render-whitespace
Jun 19, 2025
+126
−102
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
4ae9a24
rendering tabs and spaces
pheonick 71549e8
coloring tabs and spaces
pheonick 5ac1949
pipeline formatting check fix
pheonick 9679e1e
reimplement for selection only
pheonick 40aa64a
Merge branch 'main' into feature/toggle-render-whitespace
pheonick 6c45a2c
Merge branch 'main' into feature/toggle-render-whitespace
pheonick 42c7ec9
Merge branch 'main' into feature/toggle-render-whitespace
pheonick ed6936f
Merge branch 'main' into feature/toggle-render-whitespace
pheonick bea3070
search for cut off tabs, spaces and tabs in selection, replace with r…
pheonick ff32e49
corrected tab colors
pheonick 7ba7d46
check cut off character is in selection and is a tab, don't cut into …
pheonick 91471a5
clean up
pheonick 464edaf
tab size doesn't matter
pheonick aa87466
fix for word wrap bugs
pheonick 881e8df
Merge remote-tracking branch 'origin/main' into feature/toggle-render…
lhecker 1c06507
Parse C1 control codes, Deduplicate logic
lhecker 93ac3b2
Fix horizontal scrolling
lhecker 40e85d2
simplify fn calls
pheonick 84181d3
Run rustfmt
lhecker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1743,7 +1743,6 @@ impl TextBuffer { | |
} | ||
|
||
let mut selection_off = 0..0; | ||
let mut selection_pos = 0..0; | ||
|
||
// Figure out the selection range on this line, if any. | ||
if cursor_beg.visual_pos.y == visual_line | ||
|
@@ -1753,21 +1752,21 @@ impl TextBuffer { | |
let mut cursor = cursor_beg; | ||
|
||
// By default, we assume the entire line is selected. | ||
let mut selection_pos_beg = 0; | ||
let mut selection_pos_end = COORD_TYPE_SAFE_MAX; | ||
selection_off.start = cursor_beg.offset; | ||
selection_off.end = cursor_end.offset; | ||
selection_pos.start = 0; | ||
selection_pos.end = COORD_TYPE_SAFE_MAX; | ||
|
||
// The start of the selection is within this line. We need to update selection_beg. | ||
if selection_beg <= cursor_end.logical_pos | ||
&& selection_beg >= cursor_beg.logical_pos | ||
{ | ||
cursor = self.cursor_move_to_logical_internal( | ||
cursor, | ||
Point { x: selection_beg.x.max(origin.x), y: selection_beg.y }, | ||
Point { x: selection_beg.x, y: selection_beg.y }, | ||
); | ||
selection_off.start = cursor.offset; | ||
selection_pos.start = cursor.visual_pos.x; | ||
selection_pos_beg = cursor.visual_pos.x; | ||
} | ||
|
||
// The end of the selection is within this line. We need to update selection_end. | ||
|
@@ -1776,18 +1775,18 @@ impl TextBuffer { | |
{ | ||
cursor = self.cursor_move_to_logical_internal( | ||
cursor, | ||
Point { x: selection_end.x.min(origin.x + text_width), y: selection_end.y }, | ||
Point { x: selection_end.x, y: selection_end.y }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ut supra |
||
); | ||
selection_off.end = cursor.offset; | ||
selection_pos.end = cursor.visual_pos.x; | ||
selection_pos_end = cursor.visual_pos.x; | ||
} | ||
|
||
pheonick marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let left = destination.left + self.margin_width - origin.x; | ||
let top = destination.top + y; | ||
let rect = Rect { | ||
left: left + selection_pos.start, | ||
left: left + selection_pos_beg.max(origin.x), | ||
top, | ||
right: left + selection_pos.end, | ||
right: left + selection_pos_end.min(origin.x + text_width), | ||
bottom: top + 1, | ||
}; | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this just...