Compare commits
6 Commits
remove-asy
...
v0.206.1-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94d19baf4e | ||
|
|
70cb2f5d55 | ||
|
|
15baa8f5ed | ||
|
|
c68345f502 | ||
|
|
72007a075a | ||
|
|
c68602612f |
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -21217,7 +21217,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "zed"
|
||||
version = "0.206.0"
|
||||
version = "0.206.1"
|
||||
dependencies = [
|
||||
"acp_tools",
|
||||
"activity_indicator",
|
||||
|
||||
@@ -26,7 +26,7 @@ use sum_tree::{Bias, Dimensions, SumTree, Summary, TreeMap};
|
||||
use text::{BufferId, Edit};
|
||||
use ui::ElementId;
|
||||
|
||||
const NEWLINES: &[u8] = &[b'\n'; u8::MAX as usize];
|
||||
const NEWLINES: &[u8] = &[b'\n'; u128::BITS as usize];
|
||||
const BULLETS: &str = "********************************************************************************************************************************";
|
||||
|
||||
/// Tracks custom blocks such as diagnostics that should be displayed within buffer.
|
||||
@@ -1726,12 +1726,13 @@ impl<'a> Iterator for BlockChunks<'a> {
|
||||
|
||||
let start_in_block = self.output_row - block_start;
|
||||
let end_in_block = cmp::min(self.max_output_row, block_end) - block_start;
|
||||
let line_count = end_in_block - start_in_block;
|
||||
// todo: We need to split the chunk here?
|
||||
let line_count = cmp::min(end_in_block - start_in_block, u128::BITS);
|
||||
self.output_row += line_count;
|
||||
|
||||
return Some(Chunk {
|
||||
text: unsafe { std::str::from_utf8_unchecked(&NEWLINES[..line_count as usize]) },
|
||||
chars: (1 << line_count) - 1,
|
||||
chars: 1u128.unbounded_shl(line_count) - 1,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
@@ -1746,6 +1747,7 @@ impl<'a> Iterator for BlockChunks<'a> {
|
||||
if self.transforms.item().is_some() {
|
||||
return Some(Chunk {
|
||||
text: "\n",
|
||||
chars: 1,
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
@@ -1773,7 +1775,7 @@ impl<'a> Iterator for BlockChunks<'a> {
|
||||
let chars_count = prefix.chars().count();
|
||||
let bullet_len = chars_count;
|
||||
prefix = &BULLETS[..bullet_len];
|
||||
chars = (1 << bullet_len) - 1;
|
||||
chars = 1u128.unbounded_shl(bullet_len as u32) - 1;
|
||||
tabs = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -551,7 +551,7 @@ impl TabChunks<'_> {
|
||||
self.chunk = Chunk {
|
||||
text: &SPACES[0..(to_next_stop as usize)],
|
||||
is_tab: true,
|
||||
chars: (1u128 << to_next_stop) - 1,
|
||||
chars: 1u128.unbounded_shl(to_next_stop) - 1,
|
||||
..Default::default()
|
||||
};
|
||||
self.inside_leading_tab = to_next_stop > 0;
|
||||
@@ -623,7 +623,7 @@ impl<'a> Iterator for TabChunks<'a> {
|
||||
return Some(Chunk {
|
||||
text: &SPACES[..len as usize],
|
||||
is_tab: true,
|
||||
chars: (1 << len) - 1,
|
||||
chars: 1u128.unbounded_shl(len) - 1,
|
||||
tabs: 0,
|
||||
..self.chunk.clone()
|
||||
});
|
||||
|
||||
@@ -9323,7 +9323,7 @@ impl Element for EditorElement {
|
||||
.language_settings(cx)
|
||||
.whitespace_map;
|
||||
|
||||
let tab_char = whitespace_map.tab();
|
||||
let tab_char = whitespace_map.tab.clone();
|
||||
let tab_len = tab_char.len();
|
||||
let tab_invisible = window.text_system().shape_line(
|
||||
tab_char,
|
||||
@@ -9339,7 +9339,7 @@ impl Element for EditorElement {
|
||||
None,
|
||||
);
|
||||
|
||||
let space_char = whitespace_map.space();
|
||||
let space_char = whitespace_map.space.clone();
|
||||
let space_len = space_char.len();
|
||||
let space_invisible = window.text_system().shape_line(
|
||||
space_char,
|
||||
|
||||
@@ -898,6 +898,7 @@ fn surrounding_filename(
|
||||
} else {
|
||||
// Otherwise, we skip the quote
|
||||
inside_quotes = true;
|
||||
token_end += ch.len_utf8();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -1545,6 +1546,10 @@ mod tests {
|
||||
("'fˇile.txt'", Some("file.txt")),
|
||||
("ˇ'file.txt'", Some("file.txt")),
|
||||
("ˇ'fi\\ le.txt'", Some("fi le.txt")),
|
||||
// Quoted multibyte characters
|
||||
(" ˇ\"常\"", Some("常")),
|
||||
(" \"ˇ常\"", Some("常")),
|
||||
("ˇ\"常\"", Some("常")),
|
||||
];
|
||||
|
||||
for (input, expected) in test_cases {
|
||||
|
||||
@@ -7,7 +7,7 @@ use ec4rs::{
|
||||
property::{FinalNewline, IndentSize, IndentStyle, MaxLineLen, TabWidth, TrimTrailingWs},
|
||||
};
|
||||
use globset::{Glob, GlobMatcher, GlobSet, GlobSetBuilder};
|
||||
use gpui::{App, Modifiers};
|
||||
use gpui::{App, Modifiers, SharedString};
|
||||
use itertools::{Either, Itertools};
|
||||
|
||||
pub use settings::{
|
||||
@@ -59,6 +59,12 @@ pub struct AllLanguageSettings {
|
||||
pub(crate) file_types: FxHashMap<Arc<str>, GlobSet>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WhitespaceMap {
|
||||
pub space: SharedString,
|
||||
pub tab: SharedString,
|
||||
}
|
||||
|
||||
/// The settings for a particular language.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LanguageSettings {
|
||||
@@ -118,7 +124,7 @@ pub struct LanguageSettings {
|
||||
/// Whether to show tabs and spaces in the editor.
|
||||
pub show_whitespaces: settings::ShowWhitespaceSetting,
|
||||
/// Visible characters used to render whitespace when show_whitespaces is enabled.
|
||||
pub whitespace_map: settings::WhitespaceMap,
|
||||
pub whitespace_map: WhitespaceMap,
|
||||
/// Whether to start a new line with a comment when a previous line is a comment as well.
|
||||
pub extend_comment_on_newline: bool,
|
||||
/// Inlay hint related settings.
|
||||
@@ -503,6 +509,8 @@ impl settings::Settings for AllLanguageSettings {
|
||||
let prettier = settings.prettier.unwrap();
|
||||
let indent_guides = settings.indent_guides.unwrap();
|
||||
let tasks = settings.tasks.unwrap();
|
||||
let whitespace_map = settings.whitespace_map.unwrap();
|
||||
|
||||
LanguageSettings {
|
||||
tab_size: settings.tab_size.unwrap(),
|
||||
hard_tabs: settings.hard_tabs.unwrap(),
|
||||
@@ -536,7 +544,10 @@ impl settings::Settings for AllLanguageSettings {
|
||||
show_edit_predictions: settings.show_edit_predictions.unwrap(),
|
||||
edit_predictions_disabled_in: settings.edit_predictions_disabled_in.unwrap(),
|
||||
show_whitespaces: settings.show_whitespaces.unwrap(),
|
||||
whitespace_map: settings.whitespace_map.unwrap(),
|
||||
whitespace_map: WhitespaceMap {
|
||||
space: SharedString::new(whitespace_map.space.unwrap().to_string()),
|
||||
tab: SharedString::new(whitespace_map.tab.unwrap().to_string()),
|
||||
},
|
||||
extend_comment_on_newline: settings.extend_comment_on_newline.unwrap(),
|
||||
inlay_hints: InlayHintSettings {
|
||||
enabled: inlay_hints.enabled.unwrap(),
|
||||
|
||||
@@ -49,6 +49,7 @@ merge_from_overwrites!(
|
||||
bool,
|
||||
f64,
|
||||
f32,
|
||||
char,
|
||||
std::num::NonZeroUsize,
|
||||
std::num::NonZeroU32,
|
||||
String,
|
||||
|
||||
@@ -261,7 +261,7 @@ pub struct LanguageSettingsContent {
|
||||
/// Visible characters used to render whitespace when show_whitespaces is enabled.
|
||||
///
|
||||
/// Default: "•" for spaces, "→" for tabs.
|
||||
pub whitespace_map: Option<WhitespaceMap>,
|
||||
pub whitespace_map: Option<WhitespaceMapContent>,
|
||||
/// Whether to start a new line with a comment when a previous line is a comment as well.
|
||||
///
|
||||
/// Default: true
|
||||
@@ -354,23 +354,9 @@ pub enum ShowWhitespaceSetting {
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, JsonSchema, MergeFrom, PartialEq)]
|
||||
pub struct WhitespaceMap {
|
||||
pub space: Option<String>,
|
||||
pub tab: Option<String>,
|
||||
}
|
||||
|
||||
impl WhitespaceMap {
|
||||
pub fn space(&self) -> SharedString {
|
||||
self.space
|
||||
.as_ref()
|
||||
.map_or_else(|| SharedString::from("•"), |s| SharedString::from(s))
|
||||
}
|
||||
|
||||
pub fn tab(&self) -> SharedString {
|
||||
self.tab
|
||||
.as_ref()
|
||||
.map_or_else(|| SharedString::from("→"), |s| SharedString::from(s))
|
||||
}
|
||||
pub struct WhitespaceMapContent {
|
||||
pub space: Option<char>,
|
||||
pub tab: Option<char>,
|
||||
}
|
||||
|
||||
/// The behavior of `editor::Rewrap`.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
description = "The fast, collaborative code editor."
|
||||
edition.workspace = true
|
||||
name = "zed"
|
||||
version = "0.206.0"
|
||||
version = "0.206.1"
|
||||
publish.workspace = true
|
||||
license = "GPL-3.0-or-later"
|
||||
authors = ["Zed Team <hi@zed.dev>"]
|
||||
|
||||
@@ -1 +1 @@
|
||||
dev
|
||||
preview
|
||||
Reference in New Issue
Block a user