fix: [Bug] Code block jump skip blank line

This commit is contained in:
Lucas.Xu 2023-03-08 14:48:33 +08:00
parent 90da54d12f
commit 5a252bcb18

View File

@ -449,12 +449,12 @@ Position? _goUp(EditorState editorState) {
final rect = rects.reduce(
(current, next) => current.bottom >= next.bottom ? current : next,
);
offset = rect.topRight.translate(0, -rect.height);
offset = rect.center.translate(0, -rect.height);
} else {
final rect = rects.reduce(
(current, next) => current.top <= next.top ? current : next,
);
offset = rect.topLeft.translate(0, -rect.height);
offset = rect.center.translate(0, -rect.height);
}
return editorState.service.selectionService.getPositionInOffset(offset);
}
@ -470,12 +470,12 @@ Position? _goDown(EditorState editorState) {
final rect = rects.reduce(
(current, next) => current.bottom >= next.bottom ? current : next,
);
offset = rect.bottomRight.translate(0, rect.height);
offset = rect.center.translate(0, rect.height);
} else {
final rect = rects.reduce(
(current, next) => current.top <= next.top ? current : next,
);
offset = rect.bottomLeft.translate(0, rect.height);
offset = rect.center.translate(0, rect.height);
}
return editorState.service.selectionService.getPositionInOffset(offset);
}