[texworks] Hard wrapping

Alain Delmotte alain.delmotte at leliseron.org
Sun Apr 26 11:44:24 CEST 2009


Following the publication by Stefan of the patch for hard wrapping 
(issue #40), I did put TeXworks.exe (r.291 with HW for Windows) on my 
site for testing and comment:
go to http://www.leliseron.org/texworks/

In the Edit menu of the editor there will be a new entry "Hard Wrap", 
clicking on it brings a dialog in which you can define the parameters of 
the wrapping (whole document or selection, end line characters, tab - 
for further indent,...).

 From a message of Stefan:

> Now for the use: once you have hardwrapped, you can not unwrap, unless
> you use a replacement of the "ending characters"(default %| - at least
> one character required?) +\n by space or nothing: right?

Right. You can rewrap text if it has a characteristic ending character
of each line (otherwise the rewrap routine couldn't distinguish
automatically wrapped lines from manually wrapped lines). But no, you
don't have to specify ending characters, you could simply leave it blank
and it should still work. You just wouldn't be able to do rewrapping.
As for unwrapping, it can be done in exactly the way you proposed, by a
simple replace. But if there's large public demand adding an "unwrap"
button would be easy to implement.

> Would it be possible to set HardWrap as default when one work, without
> "end of line marker" and with the possibility to define the parameters?
> (I know when you receive a piece, you always ask more :-) )

I'm afraid that wouldn't be so easy. Since the editor widget only
supports "soft wrapping" IIRC we'd have to run and rerun the hardwrap
function for every letter you type, and that would probably slow down
the whole system considerably. Besides, the original intention behind
hard wrapping was to keep lines short e.g. when sending tex sources over
email or using a version control system. For normal operation and quick
writing I personally consider the soft wrapping enough. But again: if
there's public demand maybe we can find a way to make this happen
(though I'm not too confident I have to admit).
BTW: It's good to ask for more, that gives the programmers out there
something to do ;-) .

> Further, once the parameters are defined, a shortcut just to apply
> hardwrapping could be nice.

That's an interesting idea, too. I'd suggest you post your
comments/ideas/suggestions to the mailing list. That way we could see
(a) if there's a large public demand for one feature or another, and (b)
what Jonathan thinks about the user interface design (e.g. what to
define shortcuts for, etc.). Maybe publishing a testing version for
Windows at the same time would be a good idea so we're not limited to
users on linux (or users compiling TW themselves, in any case).

On a sidenote: Right now, the hardwrapping settings are not stored (and
hence not restored when you rerun the dialog). I will rectify that
eventually, but first I'd like to hear something from Jonathan about the
principle implementation. But until then defining a shortcut will be
impossible, unfortunately.
Note the replace instruction to suppress hardwrapping should be something like:
find: " %\|\n"      without ""
replace: " "
regexp on

I hope this help!
Good TeXworking,


More information about the texworks mailing list