[texworks] Hard wrapping
Jonathan Kew
jfkthame at googlemail.com
Thu May 7 14:50:50 CEST 2009
On 7 May 2009, at 01:34, Stefan Löffler wrote:
>
> In principle I have to agree that a simple user interface (at least at
> first) is generally better than a complex one. As I pointed out
> somewhere (I think at Google code) I wanted to have all but the most
> important options hidden initially with a "More..." button (or
> something
> comparable) that would enable the user to show/edit more options (and
> otherwise use the defaults for those advanced options). I think this
> would be the perfect solution for having a generally simple interface
> but with the power of more advanced options just a few clicks away
> (for
> those who can't/don't want to live with the defaults ;)).
> Unfortunately I didn't succeed in implementing this show/hide behavior
> in a consistent way (the dialog didn't expand/retract all the time, at
> least on Linux).
Yes, I saw this and agree it could be a good way forward, but I also
didn't have time to look into it and try to make it work that way.
> As for the markers: my code didn't generally depend on them (i.e. you
> could do wrapping with en empty marker, which should have given the
> same
> result as the current code). It did rely on the markers for
> rewrapping,
> however. If I understand this correctly this prevented the problems
> reported in this thread so far (as rewrapping didn't take place at any
> line break, but only at "specially marked" ones; btw: the marker was
> chosen such that it effectively escapes/comments the hard-wrapped line
> break for LaTeX). My working hypothesis was that while it is important
> to give the user a simple interface, it is more important to respect
> the
> user's wishes (i.e. input). So wherever there is a user-defined line
> break, hard wrap doesn't mess with it (that was the reason for me
> not to
> implement rewrap the way Jonathan did - by eating all (single) new
> lines
> to construct a long line to wrap again).
Understood, but I'm not sure I agree with this aspect of the design. I
suppose I'm influenced by other editors I've seen that provide a
similar "re-wrap" or "fill paragraphs" feature that will replace
single newlines with spaces, and not rely on "markers" to distinguish
the line-breaks created by a "hard wrap" command from other line-breaks.
The point of re-wrap is that the original text has hard line-breaks
(most likely because it comes from an external source that didn't use
soft-wrapping), and the user does not want to keep these breaks.
If the original line-breaks are important, then the user should not
apply re-wrap to that area of text! :)
> 2) (Also affects my original code) The "inverse" issue of the one
> reported by Bruno Voisin. If you have a line like
>
> Hello World % a long and useless comment
> More Text
>
> this may be wrapped to
>
> Hello World % a long and useless
> comment More Text
>
> Which effectively adds the word "comment" to the output, although it's
> supposed to be part of the comment. Unfortunately, there's no easy way
> around that, however. The correct output would probably be
>
> Hello World % a long and useless
> % comment
> More Text
Yes, but I'm reluctant to make Hard Wrap try to be really smart about
analyzing and reformatting code.... given the infinite flexibility of
TeX input, this will be a never-ending battle! Hard Wrap is a text-
modification tool, just like Replace, Comment, etc., and at some level
it has to be up to the user to choose where to apply it.
Another possibility I'm considering is to make it "sensitive" to the
auto-indent setting, if any, so that you could usefully apply it to
blocks of TeX comments, for example, or indented areas of text (e.g,
the contents of an environment, if you like to indent that as a whole).
>
> BTW (a tiny little bit off-topic, but still related): Qt does have an
> internal wrap-at-fixed-column mode, which could be implemented
> alongside
> the wrap-at-widget soft-wrap mode. I know that this may be problematic
> with the proportional fonts used in the editor, but it would give
> people
> a way to easily arrange their code for the use with hard-wrap.
Hmmm, that may be worth looking at. I'd forgotten about that.
Thanks,
JK
More information about the texworks
mailing list