summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md2
-rw-r--r--script/files.lua6
2 files changed, 5 insertions, 3 deletions
diff --git a/changelog.md b/changelog.md
index cbe37f1c..55d3c18b 100644
--- a/changelog.md
+++ b/changelog.md
@@ -2,6 +2,8 @@
## 1.12.2
* `CHG` performance optimization
+* `FIX` modifying the code before loading finish makes confusion
+* `FIX` signature: not works
## 1.12.1
`2021-1-27`
diff --git a/script/files.lua b/script/files.lua
index 7e14bd9c..52f2b18a 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -438,7 +438,7 @@ function m.offset(uri, position)
if start <= 0 or start > #text then
offset = #text + 2
else
- offset = utf8.offset(text, position.character + 1, start) or (#text + 1)
+ offset = utf8.offset(text, position.character + 1, start) or (#text + 2)
end
if file._diffInfo then
offset = smerger.getOffset(file._diffInfo, offset)
@@ -467,7 +467,7 @@ function m.offsetOfWord(uri, position)
if start <= 0 or start > #text then
offset = #text + 2
else
- offset = utf8.offset(text, position.character + 1, start) or (#text + 1)
+ offset = utf8.offset(text, position.character + 1, start) or (#text + 2)
end
if offset > #text
or text:sub(offset-1, offset):match '[%w_][^%w_]' then
@@ -476,7 +476,7 @@ function m.offsetOfWord(uri, position)
if file._diffInfo then
offset = smerger.getOffset(file._diffInfo, offset)
end
- return offset
+ return offset - 1
end
--- 将应用差异前的offset转换为应用差异后的offset