You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Eirik Bakke (JIRA)" <ji...@apache.org> on 2018/06/22 15:58:00 UTC

[jira] [Created] (NETBEANS-977) Improve text layout in word wrap mode

Eirik Bakke created NETBEANS-977:
------------------------------------

             Summary: Improve text layout in word wrap mode
                 Key: NETBEANS-977
                 URL: https://issues.apache.org/jira/browse/NETBEANS-977
             Project: NetBeans
          Issue Type: Improvement
          Components: editor - Formatting &amp; Indentation, editor - Painting &amp; Printing
    Affects Versions: 9.0
            Reporter: Eirik Bakke
         Attachments: wrappingdiff.png

The NetBeans editor's word wrap feature, which can be enabled via Preferences->Editor->Formatting->Line Wrap->After Words, currently has a few quirks that makes wrapped text hard to read. I have prepared a patch which makes the following improvements, as illustrated in the attached before/after screenshot:

1) In HighlightsViewUtils.breakView, use a proper java.text.BreakIterator to split text instead of the previous hand-coded text wrapping logic (this was in fact suggested as a TODO in the previous code). This, in particular, avoids putting spaces and punctuation at the beginning of a wrap line, making the NetBeans editor work more like other editors. This fixes the BugZilla bug [242113|https://netbeans.org/bugzilla/show_bug.cgi?id=242113].
2) Handle words that are longer than the preferred maximum width properly. The long word still won't be broken, but at least the rest of the paragraph will--previously the entire rest of the paragraph would remain unbroken in this case.
3) Allow whitespace at the end of a wrap line to extend beyond the preferred viewport width (like in jEdit and other editors, including the in-browser editor I'm typing this JIRA issue description in). This usually saves one character of horizontal space for regular text paragraphs.
4) Don't display a "line continuation character" to indicate that a line has been wrapped. It clutters the display, takes up an extra character of horizontal space, and does not work well with rule (3) above. This fixes the BugZilla bug [213829|https://netbeans.org/bugzilla/show_bug.cgi?id=213829].

Besides improving the word wrap feature for use in the NetBeans editor, this patch also makes NetBeans' EditorKit more useful for standalone use in a JEditorPane, e.g. in NetBeans Platform applications. For instance, my own platform application uses NetBeans' EditorKit to provide editing of text paragraphs and spreadsheet formulas in a spreadsheet-like table widget, where horizontal space is at a premium.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists