Fix crash and wrong columnar selection when mousing over block lines
This commit is contained in:
+13
-13
@@ -337,7 +337,7 @@ pub enum SelectPhase {
|
||||
},
|
||||
BeginColumnar {
|
||||
position: DisplayPoint,
|
||||
overshoot: u32,
|
||||
goal_column: u32,
|
||||
},
|
||||
Extend {
|
||||
position: DisplayPoint,
|
||||
@@ -345,7 +345,7 @@ pub enum SelectPhase {
|
||||
},
|
||||
Update {
|
||||
position: DisplayPoint,
|
||||
overshoot: u32,
|
||||
goal_column: u32,
|
||||
scroll_position: Vector2F,
|
||||
},
|
||||
End,
|
||||
@@ -1498,17 +1498,17 @@ impl Editor {
|
||||
} => self.begin_selection(*position, *add, *click_count, cx),
|
||||
SelectPhase::BeginColumnar {
|
||||
position,
|
||||
overshoot,
|
||||
} => self.begin_columnar_selection(*position, *overshoot, cx),
|
||||
goal_column,
|
||||
} => self.begin_columnar_selection(*position, *goal_column, cx),
|
||||
SelectPhase::Extend {
|
||||
position,
|
||||
click_count,
|
||||
} => self.extend_selection(*position, *click_count, cx),
|
||||
SelectPhase::Update {
|
||||
position,
|
||||
overshoot,
|
||||
goal_column,
|
||||
scroll_position,
|
||||
} => self.update_selection(*position, *overshoot, *scroll_position, cx),
|
||||
} => self.update_selection(*position, *goal_column, *scroll_position, cx),
|
||||
SelectPhase::End => self.end_selection(cx),
|
||||
}
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ impl Editor {
|
||||
fn begin_columnar_selection(
|
||||
&mut self,
|
||||
position: DisplayPoint,
|
||||
overshoot: u32,
|
||||
goal_column: u32,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
if !self.focused {
|
||||
@@ -1631,7 +1631,7 @@ impl Editor {
|
||||
self.select_columns(
|
||||
tail.to_display_point(&display_map),
|
||||
position,
|
||||
overshoot,
|
||||
goal_column,
|
||||
&display_map,
|
||||
cx,
|
||||
);
|
||||
@@ -1640,7 +1640,7 @@ impl Editor {
|
||||
fn update_selection(
|
||||
&mut self,
|
||||
position: DisplayPoint,
|
||||
overshoot: u32,
|
||||
goal_column: u32,
|
||||
scroll_position: Vector2F,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
@@ -1648,7 +1648,7 @@ impl Editor {
|
||||
|
||||
if let Some(tail) = self.columnar_selection_tail.as_ref() {
|
||||
let tail = tail.to_display_point(&display_map);
|
||||
self.select_columns(tail, position, overshoot, &display_map, cx);
|
||||
self.select_columns(tail, position, goal_column, &display_map, cx);
|
||||
} else if let Some(mut pending) = self.selections.pending_anchor().clone() {
|
||||
let buffer = self.buffer.read(cx).snapshot(cx);
|
||||
let head;
|
||||
@@ -1749,14 +1749,14 @@ impl Editor {
|
||||
&mut self,
|
||||
tail: DisplayPoint,
|
||||
head: DisplayPoint,
|
||||
overshoot: u32,
|
||||
goal_column: u32,
|
||||
display_map: &DisplaySnapshot,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) {
|
||||
let start_row = cmp::min(tail.row(), head.row());
|
||||
let end_row = cmp::max(tail.row(), head.row());
|
||||
let start_column = cmp::min(tail.column(), head.column() + overshoot);
|
||||
let end_column = cmp::max(tail.column(), head.column() + overshoot);
|
||||
let start_column = cmp::min(tail.column(), goal_column);
|
||||
let end_column = cmp::max(tail.column(), goal_column);
|
||||
let reversed = start_column < tail.column();
|
||||
|
||||
let selection_ranges = (start_row..=end_row)
|
||||
|
||||
Reference in New Issue
Block a user