Open lillianrubyrose opened 1 month ago
Tried on Mac OSX & Debian x64 Wayland and were not able to reproduce.
Configuring tab_size
to 25
in settings does not crashes the Zed & changes the tab size to 25 correctly.
Zed Version: 0.146.0 (main)
Tried on Mac OSX & Debian x64 Wayland and were not able to reproduce.
Configuring
tab_size
to25
in settings does not crashes the Zed & changes the tab size to 25 correctly.Zed Version: 0.146.0 (main)
After a little more playing around with it the crash only occurs when the file has tab characters in it. It wasn't clear from the original issue, my fault for not playing with it further, sorry!
It does work correctly if a file is formatted with space characters. (The Zed settings.json for example)
Easiest repro I can think of: Set hard_tabs = true
in a Rust project's rustfmt.toml
then cargo fmt --all
and open a formatted file. Always causes the crash for me.
Zed: v0.147.0 (Zed Dev 777ddefa73c03e169414cba1146eaa9ed21eeb48)
Thanks @lilyrrose for the detailed report, got it and I think I know where the root cause is. working on it.
The problem is in src/display_map/tab_map.rs
where we have on line 542:
return Some(Chunk {
text: &SPACES[..len as usize],
is_tab: true,
..self.chunk.clone()
});
This SPACE is defined on line 458:
// Handles a tab width <= 16
const SPACES: &str = " ";
text: &" ".repeat(len as usize)
looks great but I did not figure out how to do it without referencing a temporary value. Any suggestions?tab_size
for that. The solution 2 is not ideal but will prevent the current crash.
Any suggestions?
Check for existing issues
Describe the bug / provide steps to reproduce it
Set "tab_size" to anything above 16.
Environment
Zed: v0.145.0 (Zed Preview) OS: Linux Wayland arch unknown Memory: 30.5 GiB Architecture: x86_64
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.Zed.log