ci_edit icon indicating copy to clipboard operation
ci_edit copied to clipboard

Bookmark stays in the same line numbers

Open aaxu opened this issue 7 years ago • 2 comments

One thing I did not address is how bookmarks can be deleted. While we have the command bm- to delete a bookmark, some editors make it so that you can delete a bookmark if you remove enough lines around the bookmark. I don't think this is a major issue, since I think that if a person bookmarks an area and deletes a line, they may come back to that same place.

However, just to be clear, right now, the bookmark does not move, so if you have a bookmark on line 15 and remove 10 lines around the bookmark, the bookmark will still be on line 15. I want to somehow make it so that the bookmark stays relative to the text it covers, but it seems difficult. For example, if the editor was like this:

a
b
c <--- bookmark here
d
e

and I erase lines a and b, then the editor should look like this:

c <--- bookmark here
d
e

And the reverse would also be true if I add lines a and b back.

aaxu avatar Jan 10 '18 19:01 aaxu

I found one bug in particular, where if you make a bookmark, then erase enough lines so that the number of lines is less than the position of the bookmark, if you press F2 to go to bookmark, it will crash the program. I'm thinking we could fix this by clearing out-of-bounds bookmarks whenever we decrease the number of lines, but it looks like we do that in multiple places.

aaxu avatar Jan 10 '18 19:01 aaxu

During my work on the PR (#147), I realized that there are some edge cases where there are multiple sensible options on when/how to change the bookmark range. There are for examples differences between changes to the start/middle/end of lines and/or changes to the start/end of the bookmark range.

Androbin avatar Feb 02 '18 15:02 Androbin