From 14621b66b8c295010286b20d7408ed558c050db1 Mon Sep 17 00:00:00 2001 From: MostlyK <135974627+MostlyKIGuess@users.noreply.github.com> Date: Tue, 3 Feb 2026 10:18:07 +0530 Subject: [PATCH] repl: Fix cursor visibility on last line after re-running cells (#48218) - This also sends the cursor to block placement anchor which is the standard thing to happen when we run cmd/ctrl + shift + enter, this is usually used for Run and Move onto next cell. - Perhaps the ability to stay on the same code will be tackled on further works where not using the shift modifier would signify stay and "just" run the cell. Like #46868 Closes #48069 Release Notes: - Fixed cursor becoming invisible on the last line of REPL cells after re-running --- crates/repl/src/session.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/repl/src/session.rs b/crates/repl/src/session.rs index 49da9d0e312c1278b909442fe74438d099ab2325..2fda4f1bedeba54a9cc07146d5f3b81706073948 100644 --- a/crates/repl/src/session.rs +++ b/crates/repl/src/session.rs @@ -95,9 +95,14 @@ impl EditorBlock { }); } - let invalidation_anchor = buffer.read(cx).read(cx).anchor_before(next_row_start); + // Re-read snapshot after potential buffer edit and create a fresh anchor for + // block placement. Using anchor_before (Bias::Left) ensures the anchor stays + // at the end of the code line regardless of whether we inserted a newline. + let buffer_snapshot = buffer.read(cx).snapshot(cx); + let block_placement_anchor = buffer_snapshot.anchor_before(end_point); + let invalidation_anchor = buffer_snapshot.anchor_before(next_row_start); let block = BlockProperties { - placement: BlockPlacement::Below(code_range.end), + placement: BlockPlacement::Below(block_placement_anchor), // Take up at least one height for status, allow the editor to determine the real height based on the content from render height: Some(1), style: BlockStyle::Sticky,