This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Using NbDocument.runAtomic() i created an action which inserts a guarded string into a document. The text is highlighted blue as it should be and is guarded correctly. But when the user tries to undo, the text string is removed from the document but the offsets where that string was located remain guarded.
which version of the IDE is it? Can you attach your code snippet?
This occurs with latest trunk code. ------------ Code: private static void insertBlock() { InsertTagsRunnable itr = new InsertTagsRunnable((StyledDocument)doc,rowStart,rowEnd,config,modType); NbDocument.runAtomic((StyledDocument)doc, itr); } private static class InsertTagsRunnable implements Runnable { <snip> public void run() { <snip> doc.insertString(rowStart,startTag,null); NbDocument.markGuarded(doc,rowStart,startTag.length()); <snip> } ------------- So, trying to undo after this insert will only undo the doc.insertString(...) and not the NbDocument.markGuarded(...).
Have you tried insertGuarded insterad of insert/mark combo?
Same problem when using insertGuarded...
Is a fix for this bug planned for Promo D? I am having a hard time finding a suitable work-around for this bug, so i am depending on a fix happening (hopefully before feature freeze). any status update would be appreciated!
Mila, what do you think about this issue? Can it be solved in org.openide.text or one needs support from the editor internals? I tend to believe the later, but I'd like to know your opinion before I reassign the issue.
this is no longer a blocking issue for the mobility modules (we're no longer using guarded blocks). as such, it can probably be nocked down in priority (or closed??).
Reassigning to editor for evaluation, as the Document impl is imho the best place to deal with undo/redo of characters and attributes.
Agreed with gc - downgrading to P3. We need to first find out the appropriate behavior. The swing document impls treat the setting of the character attributes as an undoable operation being sent to the document's undo manager. The undoing would be a single undoable edit in the UM's queue requiring Ctrl+Z - we likely do not want this. That can be partly improved by overriding edit's isSignificant() method but still I would leave this for later promos where this can be tested carefully. The better is IMO to ignore the empty guarded regions completely during typing - I'll try to implement this fix.
Changed target milestone to TBD.
Setting TM to future preliminarily.
Does not seem to be incomplete. Should be reevaluated.
Deleting of guarded block section from document can probably cause problems in JavaEditor, where these sections are handled. Perhaps, the solution would be to do not allow undoing of changes in guarded block (by deleting the UM queue) Reassigning to java module for evaluation
Honzo, please take a look at it. Thanks
Will resolve later
NetBeans.org Migration: changing resolution from LATER to WONTFIX