[BUG] Cursor placed after closing delimiter when formatting button tapped

Open Beginner friendly
#236 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
dart
Domain
frontend

Research direction

Start with MarkdownEditorController.wrapSelection(), especially the sel.isCollapsed path, and trace how the formatting toolbar applies the resulting selection. Reproduce the Bold-button case with no selection on the supported platforms, then verify that the cursor lands between the inserted delimiters and that existing selections still behave correctly.

Written by the indexing model from the issue text.

Description

bug

Description

When a formatting button (Bold, Italic, etc.) is tapped with no selection, it inserts delimiter pairs (e.g. ** + **) but places the cursor after the closing delimiter rather than between them. The user has to manually move the cursor back inside the delimiters before typing.

Steps to Reproduce

  1. Place cursor in empty text or at a position with no selection
  2. Tap the Bold button in the FormattingToolbar
  3. Observe cursor position

Expected Behavior

Cursor is placed between the opening and closing delimiters: **|** (where | is the cursor). The user can immediately type formatted text.

Actual Behavior

Cursor is placed after the closing delimiter: ****|.

Environment

  • QuKi-Notes version: v0.18.2
  • Device: Android, Windows

Possible Solution

In MarkdownEditorController.wrapSelection(), when sel.isCollapsed (no selection), set the resulting cursor offset to sel.start + prefix.length rather than sel.start + prefix.length + suffix.length.

Dominant language
Dart
Stars
1
Forks
0
Avg merge
1d 9h
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ScottKirvan/QuKi-Notes

All issues in ScottKirvan/QuKi-Notes

Similar issues

More Dart issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.