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

[Feature] Highlight complete row if nothing is selected #2

Open
schlagmichdoch opened this issue Nov 1, 2022 · 0 comments
Open

[Feature] Highlight complete row if nothing is selected #2

schlagmichdoch opened this issue Nov 1, 2022 · 0 comments

Comments

@schlagmichdoch
Copy link

I like your plugin a lot!
To simplify highlighting even more I would like to highlight a complete row by simply clicking once.

Current Behaviour

If we have the following line with | indicating the cursor position:
Test of a |sentence
clicking the highlight button results in:
Test of a ====|sentence

Expected Behaviour

If we have the following line with | indicating the cursor position:
- Test of a |bullet point
clicking the highlight button should result in:
==Test of a |sentence==

How to

In order to implement this we would probably do sth along the following lines:
Adding highlight:

  1. check for an empty selection
  2. if empty:
  3. (save the cursor position)
  4. select the complete line
  5. do highlight as implemented
  6. (unselect and position cursor at original cursor position +2)

Removing highlight:
In order to remove the highlight correctly, the equal signs must can be part of the selection, so it's nearly the same as adding highlight:

  1. check for an empty selection
  2. if empty:
  3. (save the cursor position)
  4. select the complete line
  5. do removal of highlight as implemented
  6. (unselect and position cursor at original cursor position -2)

To prevent the breaking of markdown syntax highlight == must be positioned behind the #, - etc. of headings, bullet points etc.
To do so it should be enough to start the selection at the first letter of the line for adding of highlight or at the first equal sign for removal of highlight:
- Test of a |bullet point
clicking the highlight button should result in:
- ==Test of a |bullet point==
clicking the highlight button again results in:
- Test of a |bullet point

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