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

Formatting with eclipse formatter introduces empty document in undo manager #18

Closed
markiewb opened this issue Sep 24, 2013 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@markiewb
Copy link
Collaborator

No description provided.

@junichi11
Copy link

Is the following NG?

NbDocument.runAtomic(document, new Runnable() {
    @Override
    public void run() {
        try {
            document.remove(0, length);
            document.insertString(0, result, null);
        } catch (BadLocationException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
});
if (editor != null) {
    editor.setCaretPosition(Math.max(0, Math.min(caret, document.getLength())));
}

https://github.com/markiewb/eclipsecodeformatter_for_netbeans/blob/master/src/de/markiewb/netbeans/plugins/eclipse/formatter/EclipseFormatterUtilities.java#L59-L63

@markiewb
Copy link
Collaborator Author

markiewb commented Oct 9, 2013

@junichi11 : Yes it works. Thanks. I will integrate it.

@junichi11
Copy link

👍
You are welcome :)

@markiewb
Copy link
Collaborator Author

markiewb commented Oct 9, 2013

Fixed in 1.5

@markiewb markiewb closed this as completed Oct 9, 2013
@ghost ghost assigned markiewb Oct 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants