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

[Bug] Deleting the last empty entry crashes the Editor #948

Open
saif-ellafi opened this issue Oct 28, 2024 · 0 comments
Open

[Bug] Deleting the last empty entry crashes the Editor #948

saif-ellafi opened this issue Oct 28, 2024 · 0 comments

Comments

@saif-ellafi
Copy link
Contributor

saif-ellafi commented Oct 28, 2024

Bug Description

In my AppFlowyEditor, if I have an empty entry, and I press delete (i.e. delete the empty line), then the Editor crashes.
The Editor also crashes if the editor is fully blank. In MacOS, I am allowed to delete an empty line by pressing backspace. This also happens when I delete a Table and the table was the last thing I had in the Editor.

The MacOS version issue may be the one fixed here: #927 - not sure about the deleting table version of this issue

════════ Exception caught by gesture ═══════════════════════════════════════════
Invalid argument(s): 0
════════════════════════════════════════════════════════════════════════════════
Restarted application in 1,761ms.
flutter: unhandled element <style/>; Picture key: Svg loader
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RangeError (start): Invalid value: Only valid value is 0: -1
#0      RangeError.checkValidRange (dart:core/errors.dart:360:7)
errors.dart:360
#1      _StringBase.substring (dart:core-patch/string_patch.dart:418:27)
string_patch.dart:418
#2      TextEditingDeltaDeletion.textDeleted (package:flutter/src/services/text_editing_delta.dart:314:37)
text_editing_delta.dart:314
#3      TextEditingDeltaDeletion.debugFillProperties (package:flutter/src/services/text_editing_delta.dart:333:63)
text_editing_delta.dart:333
#4      DiagnosticableNode.builder.<anonymous closure> (package:flutter/src/foundation/diagnostics.dart:2837:17)
diagnostics.dart:2837
#5      DiagnosticableNode.builder (package:flutter/src/foundation/diagnostics.dart:2840:8)
diagnostics.dart:2840
#6      DiagnosticableNode.getProperties (package:flutter/src/foundation/diagnostics.dart:2854:105)
diagnostics.dart:2854

Even worse, if the last thing I delete is a Table, then the Editor crashes, but also the app does not resume, and needs a full app restart to use it. This is the error when the last entry fully deleted is a table:

════════ Exception caught by gesture ═══════════════════════════════════════════
The following ArgumentError was thrown while handling a gesture:
Invalid argument(s): 0

When the exception was thrown, this was the stack:
#0      int.clamp (dart:core-patch/integers.dart:280:7)
integers.dart:280
#1      EditorStateSelection._findCloseNode (package:appflowy_editor/src/editor/editor_component/service/selection/shared.dart:98:16)
shared.dart:98
#2      EditorStateSelection.getNodeInOffset (package:appflowy_editor/src/editor/editor_component/service/selection/shared.dart:41:15)
shared.dart:41
#3      _DesktopSelectionServiceWidgetState.getNodeInOffset (package:appflowy_editor/src/editor/editor_component/service/selection/desktop_selection_service.dart:156:24)
desktop_selection_service.dart:156
#4      _DesktopSelectionServiceWidgetState._onTapDown (package:appflowy_editor/src/editor/editor_component/service/selection/desktop_selection_service.dart:210:18)
desktop_selection_service.dart:210

How to Reproduce

  • Add a table, being that table the only thing in the editor, then delete it. then press delete again.
    OR
  • delete the last empty line in an Editor and tap on it again (reproduceable on MacOS only so far)

Expected Behavior

Should not crash.

Operating System

All systems, but the "just delete" I can't reproduce on Windows, but yes on MacOS. Strange!

AppFlowy Editor Version(s)

4.0.0

Screenshots

No response

Additional Context

No response

@saif-ellafi saif-ellafi changed the title [Bug] Deleting the last empty entry crashes the Edotpr [Bug] Deleting the last empty entry crashes the Editor Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant