Closed pdonias closed 8 years ago
Just wanted to say that the blue symbols in the left gutter can be misleading: a bookmark is not just a line, it's a text selection, that can span multiple lines. You can create a multi-line bookmark which will behave the way you describe (F2 selects both lines, F2 on one of these lines removes both, etc...)
What you describe about the copy/paste creating a second bookmark seems to be a bug, though. But I couldn't reproduce it.
Here's a recreation of the fake bookmarks:
It's enough just to paste multiple rows onto a bookmarked line. At least multiple bookmarks are not real, it's enough to toggle the bookmark and they go away. What's annoying is bug #69 — jump to bookmark.
I'm on Bookmarks 0.42@Atom 1.11.2@Mac.
You don't even have to paste to create the bookmarks. Just keep typing after a bookmarked line creates them for me.
@Ben3eeE Yes that too, and it has something to do with the beginning of the line. Check this out:
Actually it only creates the bookmark when adding newlines in the beginning of the line if you had the cursor in the beginning of the line when adding the bookmark.
For longer lines this is what happens:
Also, thank you for the gifs to help reproduce @revelt. Much appreciated :bowing_man:
@Ben3eeE I don't seem to have the exact same behaviour here:
@pdonias Like Linus said, it's dependent where you created the original bookmark. Here I create bookmark after "1", and only there it duplicates:
Looks like bookmarks are based on certain invisible character which gets messed up on editing its vicinity.
@revelt OK, my bad. I have the same behaviour.
Actually there is a small difference in the gif by @pdonias :wink:. If you add characters after adding the bookmark all of these characters creates the duplicated bookmark on newline.
+1 I was able to reproduce it. Adding characters on the same line after bookmarking is also a bug factor.
As @solendil said, a bookmark is a range.
@markerLayer.markBufferRange(range, {invalidate: 'surround'})
So it has a head and a tail (head and tail can be at the same position) and when we add content in between those 2 bounds (head and tail included), it will make the bookmarked range bigger. Every line containing a part of the range will have the blue icon.
Wouldn't it make more sense if a bookmark was just a line?
jumping to a bookmark would always place the cursor to the beginning of the line
But Sublime manages to jump exactly where the bookmark was placed! Often code spans multiple lines, and jumping to exact spot would be enormously helpful.
OK, I understand. So if you want to match Sublime's behaviour, some changes need to be done:
There are probably more, but I think this would be enough to fix the weird behaviour we have right now :)
Copying and pasting a bookmarked line sometimes (I wasn't able to determine what's making it happen) creates a fake bookmark on the pasted line. Then, pressing F2 (jump key) from anywhere in the file selects both lines.
And pressing F1 (toggle bookmark key) on one of the lines sometimes removes both bookmarks, and sometimes doesn't do anything (it might depend on which one is the "fake" bookmark).
Details: OS: Ubuntu 4.2.0-38-generic Atom version: 1.8.0 bookmarks version: 0.39.0