Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jdt-ui-dev] Submitting a JavaDOC word-wrapping AutoIndentStategy


Problems were introduced:

1) Go to the end of a line that is at the middle of a "paragraph", and press SPACE.  The SPACE does not get inserted, and the caret is wrapped to the first word on the next line.  It is impossible to add a word at the end of a line.
2) Go the the beginning of a line that is at the middle of a paragraph, and press BACKSPACE.  This joins the first word on the current line with the last word on the previous line, but wrapping does not occur.  The current line is appended to the previous line.  I'm not sure if this was in the code I posted, but my current implementation handles this here:
        jdocHandleBackspaceDelete(d, c);
        try {
                int line = d.getLineOfOffset(c.offset);
                int lineOffset = d.getLineOffset(line);
                String prefix = jdocExtractLinePrefix(d, line);
                boolean always = c.offset > lineOffset
                        &&         c.offset <= lineOffset + prefix.length();
                jdocWrapParagraphFromLine(d, d.getLineOfOffset(c.offset), always);
        } catch (BadLocationException e){
        }

3) HTML Indentation is broken.  Try editing:

/**
 * Activates the EditPart.  EditParts that observe a dynamic model or support editing must
 * be <i>active</i>.
 * Called by the managing EditPart, or the Viewer in the case of the
 * {@link RootEditPart}. This method may be called again once
 * {@link #deactivate()} has been called.
 * <P>During activation the receiver should:
 * <UL>
 *   <LI>begin to observe its model if appropriate, and should continue the observation
 *   until {@link #deactivate()} is called.
 *   <LI>activate all of its EditPolicies.  EditPolicies may also observe the model,
 *   although this is rare.  But it is common for EditPolicies to contribute additional
 *   visuals, such as selection handles or feedback during interactions. Therefore it is
 *   necessary to tell the EditPolicies when to start doing this, and when to stop.
 *   <LI>call activate() on the EditParts it manages.  This includes its children, and for
 *   GraphicalEditParts, its <i>source connections</i>.
 * </UL>
 */

Go the first <LI> and insert a space just before that <LI>, or press backspace just before the <LI>.  The entire <LI> paragraph is supposed to shift right (or left for backspace).  This is a cool feature that was working in the patch.  Also, try just editing an intented HTML paragraph.

Known limitations still exist:
a) Wrapping only on single character insertion
b) shortening the first word on a line does not wrap starting at the previous line.
c) atomic undo (It seems like this would require big changes from Text framework)

-Randy Hudson



"Claude Knaus" <Claude_Knaus@xxxxxxx>
Sent by: jdt-ui-dev-admin@xxxxxxxxxxx

10/25/2002 12:41 PM
Please respond to jdt-ui-dev

       
        To:        jdt-ui-dev@xxxxxxxxxxx
        cc:        
        Subject:        Re: [jdt-ui-dev] Submitting a JavaDOC word-wrapping AutoIndentStategy

       



I released a modified version of the patch. Some semantic changes are intentional, some might be not :).

I used BreakIterators as Erich had suggested to reformat the paragraph. It also handles the computation

of the width of the line correctly now (taking tabs in account).


The feature can be turned off on the JavaEditor Behavior preference page.

It will be in the next integration build.


-- Claude


Back to the top