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 242113 - Line wrap should avoid spaces at the beginning of break lines
Summary: Line wrap should avoid spaces at the beginning of break lines
Status: REOPENED
Alias: None
Product: editor
Classification: Unclassified
Component: Painting & Printing (show other bugs)
Version: 7.4
Hardware: PC Mac OS X
: P3 normal with 1 vote (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-19 18:48 UTC by ebakke
Modified: 2018-06-22 16:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot showing space at the beginning of a wrap line (with desired wrapping illustrated with jEdit) (70.48 KB, image/png)
2014-02-19 18:48 UTC, ebakke
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ebakke 2014-02-19 18:48:07 UTC
Created attachment 145413 [details]
Screenshot showing space at the beginning of a wrap line (with desired wrapping illustrated with jEdit)

When the editor is in "After words" line wrap mode, line wrapping often results in spaces appearing at the beginning of wrap lines. This is undesirable; at least in the common case where there is only one space between each word, the space should always go at the end of the wrap line. See the attached screenshot. (Other editors, e.g. jEdit, do this correctly.)

To reproduce:
1) Go to Options/Preferences->Editor->Formatting, select "All Languages" and set "Line Wrap" to "After words". Click OK.
2) Create a new plain text file and open it in the editor.
3) Paste in "asdhf jasdfh asjdfh sdjafha sdjfhad fjahdfjasdhf jasdfh asjdfh asdjfahdf jasdhf asdfasdfjkl asdf ksdafajsdklf ajsdkfl".
4) Resize the window until the breaking happens to put a space at the beginning of one of the break lines.
Comment 1 ebakke 2014-02-23 20:12:34 UTC
Also, the current line breaking algorithm breaks seems to have an odd definition of what constitutes a "word", not allowing characters like adjacent commas to be included. For instance, at a certain width, the string "Although Queasybreath had spent several years in Antarctica, he still bundled up warmly in the brisk autumns of Ohio." will be broken into two lines as follows:

"Although Queasybreath had spent several years in Antarctica" and
", he still bundled up warmly in the brisk autumns of Ohio."

The second break line starts with a comma, which is bad.
Comment 2 Martin Balin 2016-07-07 07:27:15 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 3 ebakke 2016-07-07 17:26:55 UTC
Still reproducible on latest build; reopening.

Product Version: NetBeans IDE Dev (Build 201607070002)
Java: 1.8.0_92; Java HotSpot(TM) 64-Bit Server VM 25.92-b14
Runtime: Java(TM) SE Runtime Environment 1.8.0_92-b14
System: Mac OS X version 10.9.5 running on x86_64; UTF-8; en_US (nb)
Comment 4 ebakke 2018-06-22 16:00:35 UTC
This issue has now been migrated to the JIRA issue at https://issues.apache.org/jira/browse/NETBEANS-977 .