improve: cursor selection at the beginning of a line #202

Co-authored-by: Hufe921 <huangyunfeihufe@hotmail.com>
This commit is contained in:
zhoujingfu
2023-06-13 22:57:33 +08:00
committed by GitHub
co-authored by Hufe921
parent 16c2e9a6d7
commit a1335850a3
+4 -1
View File
@@ -332,7 +332,10 @@ export class Position {
// 是否在头部 // 是否在头部
if (isHead) { if (isHead) {
const headIndex = positionList.findIndex(p => p.pageNo === positionNo && p.rowNo === lastLetterList[j].rowNo) const headIndex = positionList.findIndex(p => p.pageNo === positionNo && p.rowNo === lastLetterList[j].rowNo)
curPositionIndex = ~headIndex ? headIndex - 1 : index // 头部元素为空元素时无需选中
curPositionIndex = ~headIndex
? positionList[headIndex].value === ZERO ? headIndex : headIndex - 1
: index
} else { } else {
curPositionIndex = index curPositionIndex = index
} }