Remove into SelectionEffects
from .change_selections (#33554)
In #32656 I generalized the argument to change selections to allow controling both the scroll and the nav history (and the completion trigger). To avoid conflicting with ongoing debugger cherry-picks I left the argument as an `impl Into<>`, but I think it's clearer to make callers specify what they want here. I converted a lot of `None` arguments to `SelectionEffects::no_scroll()` to be exactly compatible; but I think many people used none as an "i don't care" value in which case Default::default() might be more appropraite Closes #ISSUE Release Notes: - N/A
This commit is contained in:
parent
6e762d9c05
commit
a675ca7a1e
65 changed files with 837 additions and 625 deletions
|
@ -5238,8 +5238,8 @@ impl EditorElement {
|
|||
paint_highlight(range.start, range.end, color, edges);
|
||||
}
|
||||
|
||||
let scroll_left = layout.position_map.snapshot.scroll_position().x
|
||||
* layout.position_map.em_advance;
|
||||
let scroll_left =
|
||||
layout.position_map.snapshot.scroll_position().x * layout.position_map.em_width;
|
||||
|
||||
for (wrap_position, active) in layout.wrap_guides.iter() {
|
||||
let x = (layout.position_map.text_hitbox.origin.x
|
||||
|
@ -6676,7 +6676,7 @@ impl EditorElement {
|
|||
let position_map: &PositionMap = &position_map;
|
||||
|
||||
let line_height = position_map.line_height;
|
||||
let max_glyph_advance = position_map.em_advance;
|
||||
let max_glyph_width = position_map.em_width;
|
||||
let (delta, axis) = match delta {
|
||||
gpui::ScrollDelta::Pixels(mut pixels) => {
|
||||
//Trackpad
|
||||
|
@ -6687,15 +6687,15 @@ impl EditorElement {
|
|||
gpui::ScrollDelta::Lines(lines) => {
|
||||
//Not trackpad
|
||||
let pixels =
|
||||
point(lines.x * max_glyph_advance, lines.y * line_height);
|
||||
point(lines.x * max_glyph_width, lines.y * line_height);
|
||||
(pixels, None)
|
||||
}
|
||||
};
|
||||
|
||||
let current_scroll_position = position_map.snapshot.scroll_position();
|
||||
let x = (current_scroll_position.x * max_glyph_advance
|
||||
let x = (current_scroll_position.x * max_glyph_width
|
||||
- (delta.x * scroll_sensitivity))
|
||||
/ max_glyph_advance;
|
||||
/ max_glyph_width;
|
||||
let y = (current_scroll_position.y * line_height
|
||||
- (delta.y * scroll_sensitivity))
|
||||
/ line_height;
|
||||
|
@ -8591,7 +8591,7 @@ impl Element for EditorElement {
|
|||
start_row,
|
||||
editor_content_width,
|
||||
scroll_width,
|
||||
em_advance,
|
||||
em_width,
|
||||
&line_layouts,
|
||||
cx,
|
||||
)
|
||||
|
@ -10051,7 +10051,7 @@ fn compute_auto_height_layout(
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::{
|
||||
Editor, MultiBuffer,
|
||||
Editor, MultiBuffer, SelectionEffects,
|
||||
display_map::{BlockPlacement, BlockProperties},
|
||||
editor_tests::{init_test, update_test_language_settings},
|
||||
};
|
||||
|
@ -10176,7 +10176,7 @@ mod tests {
|
|||
window
|
||||
.update(cx, |editor, window, cx| {
|
||||
editor.cursor_shape = CursorShape::Block;
|
||||
editor.change_selections(None, window, cx, |s| {
|
||||
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
|
||||
s.select_ranges([
|
||||
Point::new(0, 0)..Point::new(1, 0),
|
||||
Point::new(3, 2)..Point::new(3, 3),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue