Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ext/REPLExt/REPLExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,13 @@ function LineEdit.complete_line(c::PkgCompletionProvider, s; hint::Bool = false)
# Convert to new completion interface format
named_completions = map(LineEdit.NamedCompletion, ret)
# Convert UnitRange to Region (Pair{Int,Int}) to match new completion interface
# range represents character positions in full string, convert to 0-based byte positions
if isempty(range)
# range represents character positions in partial string, convert to 0-based byte positions
if length(range) == 0 && first(range) > last(range)
# Empty backward range like 4:3 means insert at cursor position
# The cursor is at position last(range), so insert after it
pos = thisind(partial, last(range) + 1) - 1
region = pos => pos
elseif isempty(range)
region = 0 => 0
else
# Convert 1-based character positions to 0-based byte positions
Expand Down
6 changes: 6 additions & 0 deletions test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,12 @@ temp_pkg_dir() do project_path
@test "Example" in c
pkg"free Example"

# Test for issue #59829 - completion with only trailing space should work
# When typing "rm <TAB>" with Example installed, should complete to "rm Example"
c, r = test_complete("rm ")
@test "Example" in c
@test apply_completion("rm ") == "rm Example"

# Test deduplication of already-specified packages (issue #4098)
# After typing "rm Example ", typing "E" should not suggest Example again
c, r = test_complete("rm Example E")
Expand Down