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

Improve how formatting is applied in the editor #1600

Merged
merged 5 commits into from
Nov 12, 2023
Merged

Conversation

vkbo
Copy link
Owner

@vkbo vkbo commented Nov 12, 2023

Summary:

This PR:

  • Rewrites the Auto Select feature to no longer use Qt's "Text Under Cursor" selector. Instead, it will now iterate backwards and forwards from the cursor position until it finds the first character in either direction that isn't considered a Unicode alphanumeric character as per Python's string implementation. This generates more meaningful selections than the Qt implementation which would select the punctuation if you activated it with the cursor between a word and its immediate punctuation.
  • Changes the logic when you toggle a bold, italic or strike through Markdown format. When the cursor is at the end of the word, it will be left after the word + markup when the toggle is complete. If the cursor position was at the beginning or inside the word, the cursor remains in the same position after. Applying a shortcode behaves the same way, although they cannot be toggled, only added.
  • When an auto select is performed in the process, the word is no longer selected after the change. Before, it would remain selected.
  • When no selection is made, and the auto select does not find anything to select, the format is inserted around the cursor itself.

Related Issue(s):

Closes #1333
Closes #1598

Reviewer's Checklist:

  • The header of all files contain a reference to the repository license
  • The overall test coverage is increased or remains the same as before
  • All tests are passing
  • All flake8 checks are passing and the style guide is followed
  • Documentation (as docstrings) is complete and understandable
  • Only files that have been actively changed are committed

@vkbo vkbo added this to the Release 2.2 RC 1 milestone Nov 12, 2023
@vkbo vkbo changed the title Applying formatting Improve how formatting is applied in the editor Nov 12, 2023
@vkbo vkbo merged commit e7ea9d4 into dev Nov 12, 2023
9 checks passed
@vkbo vkbo deleted the applying_formatting branch November 12, 2023 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant