Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit 3817cda

Browse files
committed
fixed unicode crash at end-of-buffer
1 parent 59d1bbd commit 3817cda

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/julia-server.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,9 @@ function convertmsgtojson(msgs, code)
327327

328328
# determine line and column from the file
329329
@assert msg.startpos <= msg.endpos
330-
if msg.endpos > length(code)
331-
@warn "endpos $(msg.endpos) is higher than code length $(length(code))"
332-
msg.endpos = length(code)
330+
if msg.endpos > lastindex(code)
331+
@warn "endpos $(msg.endpos) is higher than code length $(lastindex(code))"
332+
msg.endpos = lastindex(code)
333333
end
334334
endpos = get_last_charpos(code, msg.endpos)
335335
startline, startcolumn = find_line_column_string(code, msg.startpos)

0 commit comments

Comments
 (0)