mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-11 21:00:35 +00:00
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
This commit is contained in:
parent
856d9632e4
commit
18daf17d0e
1 changed files with 2 additions and 6 deletions
|
@ -3,7 +3,7 @@ use crate::Editor;
|
||||||
use gpui::{Task as AsyncTask, WindowContext};
|
use gpui::{Task as AsyncTask, WindowContext};
|
||||||
use project::Location;
|
use project::Location;
|
||||||
use task::{TaskContext, TaskVariables, VariableName};
|
use task::{TaskContext, TaskVariables, VariableName};
|
||||||
use text::{Point, ToOffset, ToPoint};
|
use text::{ToOffset, ToPoint};
|
||||||
use workspace::Workspace;
|
use workspace::Workspace;
|
||||||
|
|
||||||
fn task_context_with_editor(
|
fn task_context_with_editor(
|
||||||
|
@ -14,11 +14,7 @@ fn task_context_with_editor(
|
||||||
return AsyncTask::ready(None);
|
return AsyncTask::ready(None);
|
||||||
};
|
};
|
||||||
let (selection, buffer, editor_snapshot) = {
|
let (selection, buffer, editor_snapshot) = {
|
||||||
let mut selection = editor.selections.newest::<Point>(cx);
|
let selection = editor.selections.newest_adjusted(cx);
|
||||||
if editor.selections.line_mode {
|
|
||||||
selection.start = Point::new(selection.start.row, 0);
|
|
||||||
selection.end = Point::new(selection.end.row + 1, 0);
|
|
||||||
}
|
|
||||||
let Some((buffer, _, _)) = editor
|
let Some((buffer, _, _)) = editor
|
||||||
.buffer()
|
.buffer()
|
||||||
.read(cx)
|
.read(cx)
|
||||||
|
|
Loading…
Reference in a new issue