LunaCON: patch up off-by-one line numbering problem. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4381 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-03-16 15:06:20 +00:00
parent c797298b6a
commit 2d35d93f38

View file

@ -3083,6 +3083,13 @@ function getlinecol(pos) -- local
local line = bsearch(g_newlineidxs, pos) local line = bsearch(g_newlineidxs, pos)
assert(line and g_newlineidxs[line]<=pos and pos<g_newlineidxs[line+1]) assert(line and g_newlineidxs[line]<=pos and pos<g_newlineidxs[line+1])
local col = pos-g_newlineidxs[line] local col = pos-g_newlineidxs[line]
if (col == 0) then
-- XXX: we probably have an off-by-one error somewhere and it would
-- need to be fixed instead of doing these ugly workarounds.
line = line-1
col = pos-g_newlineidxs[line]
end
assert(col >= 1)
return line+1, col-1 return line+1, col-1
end end