#10494 closed defect (fixed)
dojox.editor.plugins.PrettyPrint lineLength isn't working
Reported by: | jcline | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | 1.4.1 |
Component: | Editor | Version: | 1.4.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
PrettyPrint? isn't correctly counting the characters and splitting the lines when you set a lineLength.
The first line in the output from "PrettyPrint? (with 3 space indent and 60 character lines)" test when formatted is 72 characters long: This instance is created from a div with an extra plugin, 'PrettyPrint?'
Most of the other lines in the examples are over 60 characters as well.
Change History (5)
comment:1 Changed 11 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
Milestone: | tbd → 1.5 |
---|---|
Resolution: | wontfix |
Status: | closed → reopened |
Looked at it, looks like a relatively simple tweak to get it to try and get closer to the maxline length
comment:3 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
comment:4 Changed 11 years ago by
Milestone: | 1.5 → 1.4.1 |
---|
comment:5 Changed 11 years ago by
(In [21079]) Backporting tweak to PrettyPrint? code so that it gets closer to the maxLine value when splitting lines. refs #10494
Note: See
TracTickets for help on using
tickets.
Documented inline in the code. Updated docs.dojocampus to clarify it.
1.) lineLength does not take into account any indenting. (Documented in the underlying dojox.html.format command) 2.) It finds the end of the next complete word (where whitespace is), to split the line past the denoted lineLength.
It's effectively trying to do a 'best fit' not counting indent.
I don't intend to address these behaviors unless there is a critical reason to do so. It's just a 'best fix' heuristic to try and format it reasonably. The reason it counds past to find space is to deal with super-long words (which may be longer than lineLength), where counting backwards would fail.