Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

refactoring: Use helper instead of adjusting selection manually (#15262)

Thorsten Ball18daf17d0e89
diff --git a/crates/editor/src/tasks.rs b/crates/editor/src/tasks.rs
index 518231af655..eb5131e2528 100644
--- a/crates/editor/src/tasks.rs
+++ b/crates/editor/src/tasks.rs
@@ -3,7 +3,7 @@ use crate::Editor;
use gpui::{Task as AsyncTask, WindowContext};
use project::Location;
use task::{TaskContext, TaskVariables, VariableName};
-use text::{Point, ToOffset, ToPoint};
+use text::{ToOffset, ToPoint};
use workspace::Workspace;
fn task_context_with_editor(
@@ -14,11 +14,7 @@ fn task_context_with_editor(
return AsyncTask::ready(None);
};
let (selection, buffer, editor_snapshot) = {
- let mut selection = editor.selections.newest::<Point>(cx);
- if editor.selections.line_mode {
- selection.start = Point::new(selection.start.row, 0);
- selection.end = Point::new(selection.end.row + 1, 0);
- }
+ let selection = editor.selections.newest_adjusted(cx);
let Some((buffer, _, _)) = editor
.buffer()
.read(cx)