Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Use ':' instead of ',' to separate files, rows and columns
Kirill Bulatove9606982e6ed
diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rsindex b6d44397a9c..915bd14786d 100644--- a/crates/editor/src/editor.rs+++ b/crates/editor/src/editor.rs@@ -98,6 +98,7 @@ const MAX_SELECTION_HISTORY_LEN: usize = 1024;const COPILOT_DEBOUNCE_TIMEOUT: Duration = Duration::from_millis(75);pub const FORMAT_TIMEOUT: Duration = Duration::from_secs(2);+pub const FILE_ROW_COLUMN_DELIMITER: char = ':';#[derive(Clone, Deserialize, PartialEq, Default)]pub struct SelectNext {diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rsindex d2b9c20803e..a99f9c3d08e 100644--- a/crates/editor/src/items.rs+++ b/crates/editor/src/items.rs@@ -2,6 +2,7 @@ use crate::{display_map::ToDisplayPoint, link_go_to_definition::hide_link_definition,movement::surrounding_word, persistence::DB, scroll::ScrollAnchor, Anchor, Autoscroll, Editor,Event, ExcerptId, ExcerptRange, MultiBuffer, MultiBufferSnapshot, NavigationData, ToPoint as _,+ FILE_ROW_COLUMN_DELIMITER,};use anyhow::{Context, Result};use collections::HashSet;@@ -1112,7 +1113,11 @@ impl View for CursorPosition {fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {if let Some(position) = self.position {let theme = &cx.global::<Settings>().theme.workspace.status_bar;- let mut text = format!("{},{}", position.row + 1, position.column + 1);+ let mut text = format!(+ "{}{FILE_ROW_COLUMN_DELIMITER}{}",+ position.row + 1,+ position.column + 1+ );if self.selected_count > 0 {write!(text, " ({} selected)", self.selected_count).unwrap();}diff --git a/crates/go_to_line/src/go_to_line.rs b/crates/go_to_line/src/go_to_line.rsindex 90287e92707..d6db6859060 100644--- a/crates/go_to_line/src/go_to_line.rs+++ b/crates/go_to_line/src/go_to_line.rs@@ -1,6 +1,9 @@use std::sync::Arc;-use editor::{display_map::ToDisplayPoint, scroll::autoscroll::Autoscroll, DisplayPoint, Editor};+use editor::{+ display_map::ToDisplayPoint, scroll::autoscroll::Autoscroll, DisplayPoint, Editor,+ FILE_ROW_COLUMN_DELIMITER,+};use gpui::{actions, elements::*, geometry::vector::Vector2F, AnyViewHandle, AppContext, Axis, Entity,View, ViewContext, ViewHandle,@@ -97,14 +100,14 @@ impl GoToLine {editor::Event::Blurred => cx.emit(Event::Dismissed),editor::Event::BufferEdited { .. } => {let line_editor = self.line_editor.read(cx).text(cx);- let mut components = line_editor.trim().split(&[',', ':'][..]);+ let mut components = line_editor+ .splitn(2, FILE_ROW_COLUMN_DELIMITER)+ .map(str::trim)+ .fuse();let row = components.next().and_then(|row| row.parse::<u32>().ok());let column = components.next().and_then(|row| row.parse::<u32>().ok());if let Some(point) = row.map(|row| {- Point::new(- row.saturating_sub(1),- column.map(|column| column.saturating_sub(1)).unwrap_or(0),- )+ Point::new(row.saturating_sub(1), column.unwrap_or(0).saturating_sub(1))}) {self.active_editor.update(cx, |active_editor, cx| {let snapshot = active_editor.snapshot(cx).display_snapshot;@@ -147,7 +150,7 @@ impl View for GoToLine {let theme = &cx.global::<Settings>().theme.picker;let label = format!(- "{},{} of {} lines",+ "{}{FILE_ROW_COLUMN_DELIMITER}{} of {} lines",self.cursor_point.row + 1,self.cursor_point.column + 1,self.max_point.row + 1