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] Incorrect calculation of skip value in moveVertical #789

Closed
Jei-sKappa opened this issue May 5, 2024 · 2 comments · Fixed by #790
Closed

[Bug] Incorrect calculation of skip value in moveVertical #789

Jei-sKappa opened this issue May 5, 2024 · 2 comments · Fixed by #790

Comments

@Jei-sKappa
Copy link
Contributor

Bug Description

When going up starting from a single line node to a multiline node the caret goes in the first line of the multiline node instead of the last. The reason is that the current calculation of the skip value does not take into account the editorStyle's global set in the AppFlowyEditor parameters. (Previously it uses only the padding of the node).

How to Reproduce

Press the up key in a single line node when above it there is a multiline node.

Expected Behavior

The caret should go in the last line of the multiline node.

Operating System

MacOS

AppFlowy Editor Version(s)

2.3.4 (ref: d9e6178)

Screenshots

No response

Additional Context

No response

@LucasXu0
Copy link
Collaborator

LucasXu0 commented May 6, 2024

Hi, @Jei-sKappa. I can't reproduce the issue you mentioned on the latest main branch.

cursor_up.mp4

@Jei-sKappa
Copy link
Contributor Author

Hi @LucasXu0
Sorry, I forgot to mention that you should add a little bit of padding in AppFlowyEditor.editorStyle.
If you are running the example app. This is my updated _buildDesktopEditorStyle function:

  // showcase 1: customize the editor style.
  EditorStyle _buildDesktopEditorStyle() {
    return EditorStyle.desktop(
      cursorWidth: 2.0,
      cursorColor: Colors.blue,
      selectionColor: Colors.grey.shade300,
      textStyleConfiguration: TextStyleConfiguration(
        text: GoogleFonts.poppins(
          fontSize: 16,
          color: Colors.black,
        ),
        code: GoogleFonts.architectsDaughter(),
        bold: GoogleFonts.poppins(
          fontWeight: FontWeight.w500,
        ),
      ),
      padding: const EdgeInsets.symmetric(
        horizontal: 200.0,
        vertical: 2, // <-- Added vertical padding
      ),
    );
  }

If somehow with this update you still can't reproduce the bug try adding a little bit more vertical padding.
Otherwise let me know and i'll record a short video showcasing the bug.
Hope it helps!

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

Successfully merging a pull request may close this issue.

2 participants