[GRASS-dev] Re: [GRASS GIS] #127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window

Glynn Clements glynn at gclements.plus.com
Thu May 15 20:08:59 EDT 2008


Michael Barton wrote:

> > #127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
> > -------------------------+--------------------------------------------------
> >   Reporter:  4everskiff  |       Owner:  grass-dev at lists.osgeo.org
> >       Type:  defect      |      Status:  new
> >   Priority:  minor       |   Milestone:  6.4.0
> >  Component:  Tcl         |     Version:  6.3.0
> > Resolution:              |    Keywords:  Text output, winGRASS
> > -------------------------+--------------------------------------------------
> > Changes (by marcopx):
> > 
> >   * version:  6.3.0 RCs => 6.3.0
> > 
> > Comment:
> > 
> >  Replying to [comment:5 cmbarton]:
> >> I've committed a change to gronsole.tcl that I hope fixes this. It is
> >  not a problem on the Mac, and maybe only on Windows. I moved the linefeed
> >  for command output text from after the text line to before the text line.
> >  I'm assuming that Windows will read "\n" as a line feed. Could someone
> >  please test in Windows. I'm not changing this ticket to resolved yet to
> >  see if it actually works.
> >> 
> >> Michael
> > 
> >  Very good.
> >  It seems that I definetly need to build upon the SVN trunk. It will take 3
> >  hours or more here :-(
> >  BTW, the windows (working) code for the Carriage Return & Linefeed is
> >  \r\n, but probably the \n suffices
> 
> This may be the underlying cause of the error in gronsole.tcl. I don't know
> how /r is read in *nix. I'm also not sure if I can get away with replacing
> "/n" with a variable so that I can make it vary by platform. E.g.,
> 
> If {$mingw == 1} {set rlf {/r/n}} else {set rlf {/n}}

First, the escape character is a backslash, not a (forward) slash.

Tcl/Tk behaves like C, in that \n is used as the line separator
internally. \r characters should be added/removed upon output/input. 
In particular, if you want to add a line break within a multi-line
text widget, you just add a \n character regardless of platform.

To handle EOL conversions for I/O, use "fconfigure ... -translation ...".

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list