[Bug] Wrong variable in EditorState.getNodeInOffset() function in selection service
drdna-official opened this issue · 0 comments
drdna-official commented
Bug Description
Bug found during implementation of custom blocks postioned horizontally.
Source Line 51-58 of shared.dart
final filteredNodes = List.of(sortedNodes)
..retainWhere((n) => n.rect.bottom == sortedNodes[min].rect.bottom);
min = 0;
if (filteredNodes.length > 1) {
min = _findCloseNode(
sortedNodes,
0,
filteredNodes.length - 1,
(rect) => rect.right <= offset.dx,
);
}
should be: filteredNodes instead of sortedNodes.
..retainWhere((n) => n.rect.bottom == sortedNodes[min].rect.bottom);
min = 0;
if (filteredNodes.length > 1) {
min = _findCloseNode(
filteredNodes,
0,
filteredNodes.length - 1,
(rect) => rect.right <= offset.dx,
);
}
How to Reproduce
Keep 3 paragraphNodes() in a row. While attempting to select the middle one, selection shifts to 3rd node.
Expected Behavior
Selection cursor to be on the middle node
Operating System
Windows 11
AppFlowy Editor Version(s)
2.3.4
Screenshots
No response
Additional Context
No response