From 6592314984e5891c90a109fe39e0faafe03512ab Mon Sep 17 00:00:00 2001 From: Ron Harel <55725807+ronharel02@users.noreply.github.com> Date: Mon, 12 May 2025 18:04:46 +0300 Subject: [PATCH] editor: Trim indent guides at last non-empty line (#29482) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #26274 Adjust the end position of indent guides to prevent them from extending through empty space. Also corrected old test values ​​that seemed to have adapted to the indentation's behavior. Release Notes: - Fixed indentation guides extending beyond the final scope in a file. --- crates/editor/src/editor_tests.rs | 2 +- crates/multi_buffer/src/multi_buffer.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rs index df82854d18..4038676457 100644 --- a/crates/editor/src/editor_tests.rs +++ b/crates/editor/src/editor_tests.rs @@ -16520,7 +16520,7 @@ async fn test_indent_guide_tabs(cx: &mut TestAppContext) { assert_indent_guides( 0..6, vec![ - indent_guide(buffer_id, 1, 6, 0), + indent_guide(buffer_id, 1, 5, 0), indent_guide(buffer_id, 3, 4, 1), ], None, diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs index 9e528bce17..bcbe5418a4 100644 --- a/crates/multi_buffer/src/multi_buffer.rs +++ b/crates/multi_buffer/src/multi_buffer.rs @@ -5793,7 +5793,7 @@ impl MultiBufferSnapshot { line_indent.len(tab_size) / tab_size + ((line_indent.len(tab_size) % tab_size) > 0) as u32 } else { - current_depth + 0 }; match depth.cmp(¤t_depth) {