Fix history search appending to typed text instead of replacing (#60938)#61039
Merged
adienes merged 3 commits intoJuliaLang:masterfrom Feb 17, 2026
Merged
Conversation
When using Ctrl+R to search REPL history with existing text typed, the search result was incorrectly appending to the typed text instead of replacing it. Fixed by: 1. Clearing last_buffer instead of copying current buffer (LineEdit.jl line 2713) 2. Clearing last_buffer in history_move (REPL.jl line 918) 3. Using replace_line instead of edit_insert for result (LineEdit.jl line 2732) Fixes JuliaLang#60938
3a788e1 to
78a56a1
Compare
adienes
approved these changes
Feb 16, 2026
Member
|
thanks! actually, before approving fully, I noticed another thing: when that is we'd want to observe rather than (same goes for |
When using Ctrl+R to search history with existing text typed: - Accepting result (Enter): Replaces typed text with search result - Canceling (Ctrl+C/Esc): Restores original typed text The fix clears the input buffer before inserting the search result, but only when result is not empty (i.e., user accepted a selection). Fixes JuliaLang#60938
Contributor
Author
|
The previous version broke Ctrl+C cancellation. Updated the fix to:
Now both scenarios work correctly:
|
adienes
approved these changes
Feb 16, 2026
Member
|
thank you! |
KristofferC
pushed a commit
that referenced
this pull request
Mar 3, 2026
…) (#61039) Fixes #60938 When typing text and then using Ctrl+R to search history, the selected result was appending to the typed text instead of replacing it. For example: - Type `prin` - Press Ctrl+R, select `println("test")` - Got: `prinprintln("test")` ❌ - Expected: `println("test")` ✅ **Changes:** - LineEdit.jl line 2713: Clear `last_buffer` instead of copying current input - REPL.jl line 918: Same fix for consistency - LineEdit.jl line 2732: Use `replace_line` instead of `edit_insert` The issue was that the current buffer was being saved and then concatenated with the search result instead of being replaced by it. --- *No AI tools were used in developing this fix.* --------- Co-authored-by: Andy Dienes <51664769+adienes@users.noreply.github.com> (cherry picked from commit 719df26)
56 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #60938
When typing text and then using Ctrl+R to search history, the selected result was appending to the typed text instead of replacing it.
For example:
prinprintln("test")prinprintln("test")❌println("test")✅Changes:
last_bufferinstead of copying current inputreplace_lineinstead ofedit_insertThe issue was that the current buffer was being saved and then concatenated with the search result instead of being replaced by it.
No AI tools were used in developing this fix.