Opened 15 years ago
Last modified 8 years ago
#606 new defect
WinGRASS GIS.m: broken newlines in output window
Reported by: | hamish | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 6.4.6 |
Component: | Tcl/Tk | Version: | 6.4.0 RCs |
Keywords: | wingrass gis.m | Cc: | |
CPU: | x86-32 | Platform: | MSWindows XP |
Description
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
Attachments (1)
Change History (10)
by , 15 years ago
Attachment: | gronsole_win_newline.png added |
---|
follow-up: 2 comment:1 by , 15 years ago
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.
Index: lib/gtcltk/gronsole.tcl =================================================================== --- lib/gtcltk/gronsole.tcl (revision 37251) +++ lib/gtcltk/gronsole.tcl (working copy) @@ -406,6 +406,8 @@ if {[llength $lines] != 0} { Gronsole::add_data_tag $path $ci out + Gronsole::output_to_gronsole $path $mark $ci [list cmd$ci cmd$ci-out] "\n" + update } #output any messages from running the command
adding or removing the +update in that makes no change AFAICT.
Hamish
follow-up: 5 comment:2 by , 15 years ago
Replying to hamish:
+ 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.
follow-up: 4 comment:3 by , 15 years ago
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?
comment:4 by , 15 years ago
Replying to 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.
Hamish
comment:5 by , 15 years ago
Replying to 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.
Hamish
comment:6 by , 14 years ago
Replying to 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.
it's still valid.
Helmut
comment:7 by , 14 years ago
Milestone: | 6.4.0 → 6.4.2 |
---|
comment:8 by , 13 years ago
Priority: | major → minor |
---|
a report of this on debian has been submitted, but I can't reproduce it there.
Hamish
comment:9 by , 8 years ago
Milestone: | 6.4.2 → 6.4.6 |
---|
example of broken newline on wingrass gis.m output window