Skip to content

Commit 18daf17

Browse files
authored
refactoring: Use helper instead of adjusting selection manually (#15262)
I added `newest_adjusted` recently and now just bumped into the old code that didn't use it. Release Notes: - N/A
1 parent 856d963 commit 18daf17

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

crates/editor/src/tasks.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::Editor;
33
use gpui::{Task as AsyncTask, WindowContext};
44
use project::Location;
55
use task::{TaskContext, TaskVariables, VariableName};
6-
use text::{Point, ToOffset, ToPoint};
6+
use text::{ToOffset, ToPoint};
77
use workspace::Workspace;
88

99
fn task_context_with_editor(
@@ -14,11 +14,7 @@ fn task_context_with_editor(
1414
return AsyncTask::ready(None);
1515
};
1616
let (selection, buffer, editor_snapshot) = {
17-
let mut selection = editor.selections.newest::<Point>(cx);
18-
if editor.selections.line_mode {
19-
selection.start = Point::new(selection.start.row, 0);
20-
selection.end = Point::new(selection.end.row + 1, 0);
21-
}
17+
let selection = editor.selections.newest_adjusted(cx);
2218
let Some((buffer, _, _)) = editor
2319
.buffer()
2420
.read(cx)

0 commit comments

Comments
 (0)