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

When going to a bookmark when "mark_whole_line": true, the line is selected #13

Open
reagle opened this issue Aug 22, 2018 · 10 comments
Open
Assignees

Comments

@reagle
Copy link

reagle commented Aug 22, 2018

When going to a bookmark when "mark_whole_line": true, the line is selected counter to defaults.

@dusk125
Copy link
Owner

dusk125 commented Aug 22, 2018

Currently, this is expected behavior; when I created this option, I wasn't concerned with the selection when marking an entire line.
How would you like this to behave?

@reagle
Copy link
Author

reagle commented Aug 22, 2018

Principle of least astonishment: line should not be selected, as is the case with default bookmarks and default option of "mark_whole_line": false. Otherwise, if I plan to type, if line is selected I might over-write the whole line.

@dusk125
Copy link
Owner

dusk125 commented Aug 22, 2018

Fair enough, would adding the bookmark to the beginning of the line, with no selection, be acceptable?

The original idea for "mark_whole_line" was to only allow one mark per line; so the bookmark could be toggled from anywhere on the line. Maybe a rename of this option would be appropriate as well.

Thoughts?

@reagle
Copy link
Author

reagle commented Aug 22, 2018

Thanks for the explanation. Based on the prose description, rather than the configuration variable name, which I only read of later, I thought that one could Mark anywhere in a line, but you could only Mark once per line. Going to the bookmark would restore the cursor to the place in the line where the bookmark was made. But toggling the bookmark anywhere in the line could turn it off. This was just my initial impression. If you want to keep the current functionality, I would just tweak the prose description. Another option would be to place the Mark at the first non-white space character in the line, without selecting the line. Or, selection could actually be another configuration variable.

@dusk125
Copy link
Owner

dusk125 commented Dec 22, 2018

In v1.2.0 (released today), I changed "mark_whole_line" to "marking_mode" which can have one of two values (right now).
Those values are:

  1. selection - This mode adds one bookmark for an entire selection. Overlapping selections combine into a larger bookmark (this is native Sublime behavior).
  2. line - This mode adds an individual bookmark for each line in a selection.

I hope these new options make more sense than the previous one. If you have any other ideas for these modes, please let me know here.
If you're satisfied with these new modes, please close this issue.

Thanks and Happy Holidays!

@dusk125 dusk125 closed this as completed Dec 22, 2018
@dusk125
Copy link
Owner

dusk125 commented Dec 22, 2018

Whoops... I hit the wrong button....

@dusk125 dusk125 reopened this Dec 22, 2018
@dusk125 dusk125 self-assigned this Dec 22, 2018
@reagle
Copy link
Author

reagle commented Mar 18, 2019

Hi, returning to this plugin and issue after a few months. I appreciate that mark_mode permits one to specify whether you can have one mark or many per line (that was a concern). However, my primary concern was that when cycling to the previous or next mark, the text or line is selected. This pollutes my copy/paste buffer. Default ST behavior is to move the cursor to the mark, not select it as well.

@reagle
Copy link
Author

reagle commented Mar 18, 2019

To clarify, right now two things are coupled: more than one mark per line and ability to mark a selection (including no selection).

  • I like one mark per line, but setting "marking_mode": "line" results in the whole line being selected when I cycle to a mark.
  • When I cycle to a mark, I don't want the text to be selected. This can be achieved with "marking_mode": "selection" but this also means there can be more than one mark on a single line.

@reagle
Copy link
Author

reagle commented Feb 12, 2020

I still haven't been able to figure this out. When mode == "line" you add a Region to the layer's marks (eg [(4993, 5021)]). The problem is that when you cycle to one of these marks, it highlights the whole line, which is different than the behavior of mode == "selection", which adds a Selection (eg <sublime.Selection object at 0x109b2ad90>). In the first case, if you start typing, it overwrites the whole line. In the second, if you start typing, it inserts where the cursor is.

@reagle
Copy link
Author

reagle commented Feb 12, 2020

I forked the code and added some comments to try to understand, a question, as well as a hack that goes to the beginning of the line in line mode (rather than the whole line being selected).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants