Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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:


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 9 years ago by Jared Jurkiewicz

Resolution: wontfix
Status: newclosed

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.

comment:2 Changed 9 years ago by Jared Jurkiewicz

Milestone: tbd1.5
Resolution: wontfix
Status: closedreopened

Looked at it, looks like a relatively simple tweak to get it to try and get closer to the maxline length

comment:3 Changed 9 years ago by Jared Jurkiewicz

Resolution: fixed
Status: reopenedclosed

(In [21078]) Tweak to formatter to factor in indent, and try to search back and forward for indenting. fixes #10494

comment:4 Changed 9 years ago by Jared Jurkiewicz


comment:5 Changed 9 years ago by Jared Jurkiewicz

(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.