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

:retab seems to remove all marks #815

Open
tomtom opened this issue Sep 10, 2018 · 3 comments
Open

:retab seems to remove all marks #815

tomtom opened this issue Sep 10, 2018 · 3 comments

Comments

@tomtom
Copy link

tomtom commented Sep 10, 2018

The :retab command removes all marks.

mp
:retab<cr>
'p

A message is displayed: "Mark not set".

I cannot decide whether this is undocumented behaviour, intentional, or a bug. Marks are retained in vim, though.

Regards

@keforbes
Copy link
Contributor

If I run the command :marks after running :retab I can see the mark p is still defined, but its location info has disappeared:
image

I think the problem is that we're using Eclipse's "markers" to store our mark locations and if a line changes, Ecilpse just throws away marks on that line. Since :retab causes all lines to appear "dirty", Eclipse throws away all marks. Vrapper still knows a mark was defined with name p but when we query Eclipse to find that location, it doesn't know what we're talking about.

So I agree this is a defect but I'm not sure if there's any way for us to "update" the mark locations after a retab operation.

@keforbes
Copy link
Contributor

@albertdev, feel free to add your thoughts; I think you know more about the marks feature than I do.

We do have code saying:

//add listener so Position automatically updates as the document changes
textViewer.getDocument().addPosition(p);

but I don't think that works when we do a editorAdaptor.getModelContent().replace() like in RetabOperation.java.

@albertdev
Copy link
Member

Replying somewhat late, but I think I've seen this behavior before. It was #446 where I also noticed that sometimes marks get lost when content is replaced or deleted.

If Eclipse won't keep that information for us we could in theory code a workaround by taking a "snapshot" of the marks and restoring them after the :retab, though that might turn out to be quite a lot of work...

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

3 participants