Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
fix(peelword): handle spaces after quotes better
Browse files Browse the repository at this point in the history
  • Loading branch information
tecosaur committed Jul 16, 2023
1 parent a937ade commit ede2593
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/interaction/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -643,12 +643,17 @@ function peelword(input::AbstractString; allowdot::Bool=true)
else # Starts with " and at least two " in `input`.
start = findfirst(!isspace, input)::Int
stop = nextind(input, start)
maxstop = lastindex(input)
word = Char[]
while input[stop] != '"' && stop <= lastindex(input)
while input[stop] != '"' && stop <= maxstop
push!(word, input[stop + Int(input[stop] == '\\')])
stop = nextind(input, stop, 1 + Int(input[stop] == '\\'))
end
(String(word), input[stop+1:end])
stop = nextind(input, stop)
if stop <= maxstop && isspace(input[stop])
stop = nextind(input, stop)
end
(String(word), input[stop:end])
end
end

Expand Down

0 comments on commit ede2593

Please sign in to comment.