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.

debugger beta: Fix inline value provider panic (#32502)

Anthony Eid7a14987c020b
diff --git a/crates/project/src/debugger/dap_store.rs b/crates/project/src/debugger/dap_store.rs
index 368b6da25c4..d3e37e77a64 100644
--- a/crates/project/src/debugger/dap_store.rs
+++ b/crates/project/src/debugger/dap_store.rs
@@ -576,7 +576,12 @@ impl DapStore {
const LIMIT: usize = 100;
if value.len() > LIMIT {
- value.truncate(LIMIT);
+ let mut index = LIMIT;
+ // If index isn't a char boundary truncate will cause a panic
+ while !value.is_char_boundary(index) {
+ index -= 1;
+ }
+ value.truncate(index);
value.push_str("...");
}