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.

Bug 41489 - Problem with NbDocument.markGuarded() + undo
Summary: Problem with NbDocument.markGuarded() + undo
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: Jan Pokorsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-30 10:00 UTC by gc
Modified: 2009-11-07 11:38 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gc 2004-03-30 10:00:07 UTC
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.
Comment 1 _ ttran 2004-04-04 20:11:20 UTC
which version of the IDE is it?  Can you attach your code snippet?
Comment 2 gc 2004-04-13 09:34:38 UTC
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(...).  
Comment 3 Petr Nejedly 2004-04-13 09:59:07 UTC
Have you tried insertGuarded insterad of insert/mark combo?
Comment 4 gc 2004-04-13 15:28:42 UTC
Same problem when using insertGuarded...
Comment 5 gc 2004-05-04 17:58:10 UTC
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!  
Comment 6 Jaroslav Tulach 2004-07-26 13:54:20 UTC
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.
Comment 7 gc 2004-07-26 14:46:04 UTC
  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??).  
Comment 8 Jaroslav Tulach 2004-07-27 11:01:17 UTC
Reassigning to editor for evaluation, as the Document impl is imho the
best place to deal with undo/redo of characters and attributes.
Comment 9 Miloslav Metelka 2004-07-27 15:34:23 UTC
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.
Comment 10 Roman Strobl 2005-01-10 13:18:40 UTC
Changed target milestone to TBD.
Comment 11 Miloslav Metelka 2005-03-15 17:07:06 UTC
Setting TM to future preliminarily.
Comment 12 Martin Matula 2005-08-29 22:46:02 UTC
Does not seem to be incomplete. Should be reevaluated.
Comment 13 Martin Roskanin 2005-11-01 15:55:37 UTC
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
Comment 14 Jan Becicka 2005-11-09 13:39:22 UTC
Honzo, please take a look at it. Thanks
Comment 15 Jan Becicka 2008-11-13 10:26:46 UTC
Will resolve later
Comment 16 Quality Engineering 2009-11-02 11:04:19 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX