From 05e9b84c2f9c0effbe5ae86c19fd390ba8067e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 24 Sep 2021 11:54:59 +0800 Subject: fix --- script/proto/converter.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'script') diff --git a/script/proto/converter.lua b/script/proto/converter.lua index 5fb73c14..0ff07290 100644 --- a/script/proto/converter.lua +++ b/script/proto/converter.lua @@ -21,14 +21,13 @@ local function rawPackPosition(uri, pos) } end - -local function diffedPackPosition(uri, originPos) +local function diffedPackPosition(uri, pos) local state = files.getState(uri) + local offset = guide.positionToOffset(state, pos) + local originOffset = files.diffedOffsetBack(uri, offset) local originLines = files.getOriginLines(uri) - local originOffset = guide.positionToOffsetByLines(originLines, originPos) - local offset = files.diffedOffsetBack(uri, originOffset) - local pos = guide.offsetToPosition(state, offset) - local row, col = guide.rowColOf(pos) + local originPos = guide.offsetToPositionByLines(originLines, originOffset) + local row, col = guide.rowColOf(originPos) if col > 0 then local text = files.getOriginText(uri) if text then @@ -80,7 +79,7 @@ local function diffedUnpackPosition(uri, position) local state = files.getState(uri) local originPos = guide.positionOf(row, col) local originOffset = guide.positionToOffsetByLines(originLines, originPos) - local offset = files.diffedOffset(originOffset) + local offset = files.diffedOffset(uri, originOffset) local pos = guide.offsetToPosition(state, offset) return pos end -- cgit v1.2.3