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.

tasks: Fix $ZED_SELECTED_TEXT ignoring line_mode (#12120)

Thorsten Ball1771eded548d
diff --git a/crates/editor/src/tasks.rs b/crates/editor/src/tasks.rs
index 90f8b799c94..7fe695b2516 100644
--- a/crates/editor/src/tasks.rs
+++ b/crates/editor/src/tasks.rs
@@ -7,6 +7,7 @@ use gpui::WindowContext;
use language::{BasicContextProvider, ContextProvider};
use project::{Location, WorktreeId};
use task::{TaskContext, TaskVariables, VariableName};
+use text::Point;
use util::ResultExt;
use workspace::Workspace;
@@ -56,7 +57,11 @@ fn task_context_with_editor(
cx: &mut WindowContext<'_>,
) -> Option<TaskContext> {
let (selection, buffer, editor_snapshot) = {
- let selection = editor.selections.newest::<usize>(cx);
+ 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 (buffer, _, _) = editor
.buffer()
.read(cx)