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

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-----------------------------------+----------------------------------------
Reporter: 4everskiff | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: minor | Milestone: 6.3.0
Component: Tcl | Version: 6.3.0 RCs
Keywords: Text output, winGRASS |
-----------------------------------+----------------------------------------
Tested with WinGRASS-6.3.0RC6 on Windows XP

Tcl/Tk GUI
Output window

After running a command, with every text output that doesn't start with an
icon (such as error or alarm icon), the firt letter of the output is
placed in the upper line, instead to appear in *its* line.

Screeshot example attached

Marco

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: minor | Milestone: 6.3.0
Component: Tcl | Version: 6.3.0 RCs
Resolution: | Keywords: Text output, winGRASS
-------------------------+--------------------------------------------------
Comment (by pkelly):

Does this really apply to every command? Can you give another example
other than "g.region -p"?

Also, how was the location created? Does the same behaviour occur in a
location that wasn't created using WinGRASS (e.g. does it happen with
spearfish?)

Potential technical explanation:
I suspect it might just be another example of G_getl() needing to be
replaced by G_getl2() when reading the projections file and creating the
PROJ_INFO - the newline character is stripped off but the carriage return
isn't.

IMHO the best solution to this is to audit all occurences of G_getl() and
replace them with G_getl2() if there are no potential problems, then
replace G_getl() itself with a wrapper to G_getl2().

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: minor | Milestone: 6.3.0
Component: Tcl | Version: 6.3.0 RCs
Resolution: | Keywords: Text output, winGRASS
-------------------------+--------------------------------------------------
Comment (by 4everskiff):

Replying to [comment:1 pkelly]:
> Does this really apply to every command? Can you give another example
other than "g.region -p"?
>
> Also, how was the location created? Does the same behaviour occur in a
location that wasn't created using WinGRASS (e.g. does it happen with
spearfish?)
>
> Potential technical explanation:
> I suspect it might just be another example of G_getl() needing to be
replaced by G_getl2() when reading the projections file and creating the
PROJ_INFO - the newline character is stripped off but the carriage return
isn't.
>
> IMHO the best solution to this is to audit all occurences of G_getl()
and replace them with G_getl2() if there are no potential problems, then
replace G_getl() itself with a wrapper to G_getl2().

Hi Paul,

I confirm that I dedected the same bug with other commands (such as
r.horizon, for example) and also with spearfish.

Marco

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: minor | Milestone: 6.3.0
Component: Tcl | Version: 6.3.0 RCs
Resolution: | Keywords: Text output, winGRASS
-------------------------+--------------------------------------------------
Comment (by hamish):

before ripping lots of code apart and applying a sledge hammer solution in
the vague hope it might solve the problem, I think it better to look at
the Tcl code and try to track down exactly what the problem is. (first
step is to identify where in the code this is; 2nd is why)

Of course fgets() + G_getl() -> G_get2() needs to be done in many places.
Also we need to determine if all grass text files (including WIND and
raster cellhd files, etc) are specified as using UNIX newlines or native
newlines for strict writing. (keep reading loose)

Is there any reason to keep the current G_getl() beyond backwards
compatibility? (ie any reason not to make it a wrapper for G_getl2())

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: minor | Milestone: 6.4.0
Component: Tcl | Version: 6.3.0 RCs
Resolution: | Keywords: Text output, winGRASS
-------------------------+--------------------------------------------------
Changes (by neteler):

  * milestone: 6.3.0 => 6.4.0

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>
GRASS Geographic Information System (GRASS GIS) - http://grass.osgeo.org/

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: minor | Milestone: 6.4.0
Component: Tcl | Version: 6.3.0 RCs
Resolution: | Keywords: Text output, winGRASS
-------------------------+--------------------------------------------------
Comment (by 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

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@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 :frowning:
BTW, the windows (working) code for the Carriage Return & Linefeed is
\r\n, but probably the \n suffices

Marco

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: minor | Milestone: 6.4.0
Component: Tcl | Version: 6.3.0
Resolution: | Keywords: Text output, winGRASS
-------------------------+--------------------------------------------------
Comment (by martinl):

> Very good.
> It seems that I definetly need to build upon the SVN trunk. It will take
3 hours or more here :frowning:
> BTW, the windows (working) code for the Carriage Return & Linefeed is
\r\n, but probably the \n suffices

r31351 is related to 'develbranch_6' it wasn't committed to trunk.

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

On 5/15/08 3:19 AM, "GRASS GIS" <trac@osgeo.org> wrote:

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@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 :frowning:
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}}

Michael

Marco

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

> #127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
> -------------------------+--------------------------------------------------
> Reporter: 4everskiff | Owner: grass-dev@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 :frowning:
> 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@gclements.plus.com>

Thanks for the suggestions.

Michael

On 5/15/08 5:08 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Michael Barton wrote:

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
-------------------------+--------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@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 :frowning:
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 ...".

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

#127: WinGRASS Tcl/Tk GUI - Text formatting error in Output window
--------------------------+-------------------------------------------------
  Reporter: 4everskiff | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: minor | Milestone: 6.4.0
Component: Tcl | Version: 6.3.0
Resolution: fixed | Keywords: Text output, winGRASS
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by cmbarton):

  * status: new => closed
  * platform: => Unspecified
  * resolution: => fixed
  * cpu: => Unspecified

Comment:

As far as I can see in the reports above, this is fixed.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/127#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>