always place cursor at end of file when switching to edit mode

Removes the unreliable viewport-centre cursor heuristic. Switching to
edit mode now always positions the cursor at text.length and scrolls to
the bottom, whether arriving from a regular tap or a long-press. The
long-press scroll-to-end on initial load (view mode) is unchanged.

Cleans up _cursorAtEnd flag, _editorKey / GlobalKey, _getOffsetAtViewportCenter,
and the public WrappedCodeFieldState / findRenderEditable that were only
needed for the removed feature.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
randogoth 2026-06-19 19:01:21 +03:00
parent db13702e54
commit 14d6b3c44d
2 changed files with 15 additions and 20 deletions

View file

@ -43,7 +43,9 @@ class _WrappedCodeFieldState extends State<WrappedCodeField> {
@override
void dispose() {
_focusNode.dispose();
if (widget.focusNode == null) {
_focusNode.dispose();
}
super.dispose();
}