in wingrass gis.m output the leading newlines seem to be broken. When you
run a command the first couple of letters seem to be hidden. When you
resize the Output window by dragging on the corner (or if you run another
command) the first missing letter appears next to the scissors icon, and
the second missing letter appears at the start of the next line.
see attached screenshot.
I assume it is because gtcltk/gronsole.tcl hardcodes "\n" in a number of
places (e.g. line 231) which needs to be "\r\n" on wingrass.
maybe something like this at the beginning of gronsole.tcl?
{{{
if { $mingw == "1" } {
set newline "\r\n"
} else {
set newline "\n"
}
}}}
manually changing the "\n" to "\r\n" doesn't help any.
the following patch stops the first letter from ending up on the right
side of the scissors icon, but sometimes* still (temporarily) chops off
the first letter. no idea why.
[*] it follows a regular pattern: first 3 or 4 times 'Run'ning g.version
gives correct output, ~3rd or 4th time the first letter is missing until
you hit [Run] again, then the previous output is refreshed & gets its
first char back. Once you have enough output to need the scrollbar (with
the patch it) doesn't remove the leading char anymore.
When compared to the correctly working linux version, WinGrass + the patch
is the same with a single blank line between the grey command bar and the
output text for g.version. But for 'g.proj -p' the first run has 1 blank
line, the 2nd & on have two leading blank lines.
>
{{{
+ update
}}}
>
>
> adding or removing the +update in that makes no change AFAICT.
Don't use Tcl's "update" command unless you are able and willing to make
the function and everything which calls it re-entrant. Even then, don't
use it, as someone will eventually modify the code without considering the
re-entrancy issues, and we'll end up spending days trying to track down a
hard-to-reproduce bug. Again.
I've seen this issue before and suspected it was an issue with linefeeds
and carriage return characters in text files. Both g.proj and g.version
read text files and print to the screen. If the files have been created on
Windows (rather than imported from a Unix system) they will have CRLF
endings, which AFAIK still aren't handled properly everywhere.
That's just a guess though, but perhaps a line of approach that might be
worth looking into?
Replying to [comment:3 pkelly]:
> I've seen this issue before and suspected it was an issue with
> linefeeds and carriage return characters in text files. Both
> g.proj and g.version read text files and print to the screen.
> If the files have been created on Windows (rather than imported
> from a Unix system) they will have CRLF endings, which AFAIK
> still aren't handled properly everywhere.
> That's just a guess though, but perhaps a line of approach that
> might be worth looking into?
A nice guess, but no cigar.
For one thing, the problem is at the start of the file, not at a EOL or
EOF.
For another [Run]ing 'ls' ends up with "RMANENT" in the output window.
Replying to [comment:2 glynn]:
> Don't use Tcl's "update" command unless you are able and willing
> to make the function and everything which calls it re-entrant.
> Even then, don't use it, as someone will eventually modify the
> code without considering the re-entrancy issues, and we'll end
> up spending days trying to track down a hard-to-reproduce bug.
> Again.
ok. note that I was just cutting and pasting it from two or three lines
down in the same function where it was already used.
Replying to [ticket:606 hamish]:
> Hi,
>
> in wingrass gis.m output the leading newlines seem to be broken. When
you run a command the first couple of letters seem to be hidden. When you
resize the Output window by dragging on the corner (or if you run another
command) the first missing letter appears next to the scissors icon, and
the second missing letter appears at the start of the next line.
>
> see attached screenshot.
>
> I assume it is because gtcltk/gronsole.tcl hardcodes "\n" in a number of
places (e.g. line 231) which needs to be "\r\n" on wingrass.
>
> maybe something like this at the beginning of gronsole.tcl?
> {{{
> if { $mingw == "1" } {
> set newline "\r\n"
> } else {
> set newline "\n"
> }
> }}}
>
> and then use $newline instead of "\n"?
>
>
>
> Hamish
tested with WinGRASS-6.4.SVN-r42833-1-Setup.exe in a WinVista32-box.