Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: selection reason should be ui event when clicking #359

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@
}

currentSelection.value = selection;
editorState.selection = selection;
editorState.updateSelectionWithReason(
selection,
reason: SelectionUpdateReason.uiEvent,
);
}

void _updateSelection() {
Expand Down Expand Up @@ -239,16 +242,18 @@
clearSelection();
return;
}
if (selectable.cursorStyle == CursorStyle.verticalLine) {
editorState.selection = Selection.collapsed(
selectable.getPositionInOffset(offset),
);
} else {
editorState.selection = Selection(
start: selectable.start(),
end: selectable.end(),
);
}
final selection = selectable.cursorStyle == CursorStyle.verticalLine
? Selection.collapsed(
selectable.getPositionInOffset(offset),
)
: Selection(
start: selectable.start(),
end: selectable.end(),

Check warning on line 251 in lib/src/editor/editor_component/service/selection/desktop_selection_service.dart

View check run for this annotation

Codecov / codecov/patch

lib/src/editor/editor_component/service/selection/desktop_selection_service.dart#L249-L251

Added lines #L249 - L251 were not covered by tests
);
editorState.updateSelectionWithReason(
selection,
reason: SelectionUpdateReason.uiEvent,
);
}

void _onDoubleTapDown(TapDownDetails details) {
Expand Down