Ticket UUID: | c6978a9ec7c033113330478fa136413b57a0c371 | |||
Title: | Revised [text]: Linux : spacemode trim reports wrong character as hidden (24.11.1) | |||
Type: | Bug | Version: | revised_text | |
Submitter: | bll | Created on: | 2017-07-04 21:28:37 | |
Subsystem: | 18. [text] | Assigned To: | gcramer | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Open | Last Modified: | 2021-07-14 15:43:49 | |
Resolution: | None | Closed By: | nobody | |
Closed on: | ||||
Description: |
New test 24.11.1 (was 24.11, has -spacemode trim turned on) Works on Mac OS X. On Linux the space should have a width of 5 and the newline should always be hidden (0). The newline offset should be 148. '8' '9' space newline 'a' a:129 3 7 14/136 3 7 14/143 3 0 14/148 3 0 14/3 17 7 14/ b:129 3 7 14/136 3 7 14/143 3 0 14/143 3 5 14/3 17 7 14/ (Mac OS X: [correct] ---- textDisp-24.11.1 start '8' '9' space newline 'a' a:129 3 7 14/136 3 7 14/143 3 5 14/148 3 0 14/3 17 7 14/ b:129 3 7 14/136 3 7 14/143 3 5 14/148 3 0 14/3 17 7 14/ ++++ textDisp-24.11.1 PASSED ) package require Tk set twbw 2 set twht 2 option add *Text.borderWidth $twbw option add *Text.highlightThickness $twht set fixedFont {"Courier New" -12} set fixedHeight [font metrics $fixedFont -linespace] set fixedWidth [font measure $fixedFont m] set fixedAscent [font metrics $fixedFont -ascent] set fixedDiff [expr {$fixedHeight - 14}] frame .f -width 100 -height 20 pack .f -side left text .t -font $fixedFont -width 20 -height 10 pack .t -expand 1 -fill both update wm geometry . {} update wm withdraw . wm minsize . 1 1 wm positionfrom . user wm deiconify . update .t configure -spacing1 0 -spacing2 0 -spacing3 0 .t configure -wrap word .t configure -bd 0 .t configure -highlightthickness 2 .t configure -relief raised update set bw [.t cget -borderwidth] set px [.t cget -padx] set py [.t cget -pady] set hlth [.t cget -highlightthickness] set padx [expr {$bw+$px+$hlth}] set pady [expr {$bw+$py+$hlth}] update scan [wm geom .] %dx%d width height .t configure -spacemode trim .t configure -wrap char .t delete 1.0 end .t insert 1.0 "01234567890123456789 \nabcdefg" set w [expr {(21*$fixedWidth)-2}] wm geom . [expr {2*$padx+100+$w}]x$height update set result {} # space, newline, 'a' lappend result [.t bbox 1.20] [.t bbox 1.21] [.t bbox 2.0] puts "a:[.t bbox 1.18]/[.t bbox 1.19]/[.t bbox 1.20]/[.t bbox 1.21]/[.t bbox 2.0]/" .t mark set insert 1.21 puts "b:[.t bbox 1.18]/[.t bbox 1.19]/[.t bbox 1.20]/[.t bbox 1.21]/[.t bbox 2.0]/" # space, newline, 'a' lappend result [.t bbox 1.20] [.t bbox 1.21] [.t bbox 2.0] set expectedresult [list \ [list [expr {$padx+20*$fixedWidth}] $pady [expr {$fixedWidth-2}] $fixedHeight] \ [list [expr {$padx+21*$fixedWidth-2}] $pady 0 $fixedHeight] \ [list $padx [expr {$pady+$fixedHeight}] $fixedWidth $fixedHeight] \ [list [expr {$padx+20*$fixedWidth}] $pady [expr {$fixedWidth-2}] $fixedHeight] \ [list [expr {$padx+21*$fixedWidth-2}] $pady 0 $fixedHeight] \ [list $padx [expr {$pady+$fixedHeight}] $fixedWidth $fixedHeight]] puts $result puts $expectedresult if { $result ne $expectedresult } { puts "NG" } else { puts "OK" } | |||
User Comments: |
bll added on 2017-08-09 19:15:06:
That's fine. Then on Mac OS X, the resulting values are incorrect. fvogel added on 2017-08-09 19:03:02: (text/x-fossil-wiki) Output on Windows, with [342aab73]: <verbatim> % puts $result {143 3 0 15} {143 3 5 15} {3 18 7 15} {143 3 0 15} {143 3 5 15} {3 18 7 15} % puts $expectedresult {143 3 5 15} {148 3 0 15} {3 18 7 15} {143 3 5 15} {148 3 0 15} {3 18 7 15} </verbatim> gcramer added on 2017-08-09 19:02:17: > Having a character hidden and the next character displayed does not seem right to me. But here it is logical, because the newline takes the rest of the line in every case, this means independent from space mode. But a trimmed character cannot have a space, otherwise it wouldn't be trimmed. My previous comment: > I did a second try, now I compiled with clang instead of gcc, but the result is the same, I cannot reproduce this, under my system it works fine, so currently it's impossible to me fix it. I'm curious about the test under Windows. was an accident, it was dedicated for another item, but luckily it is not wrong here! gcramer added on 2017-08-09 18:35:02: I did a second try, now I compiled with clang instead of gcc, but the result is the same, I cannot reproduce this, under my system it works fine, so currently it's impossible to me fix it. I'm curious about the test under Windows. bll added on 2017-08-09 15:46:10: My examination was: {143 3 5 14} : partial space is displayed (truncated to 5 pixels from 7) {148 3 0 14} : newline is hidden (no room to display) This is how the mac results work. Which is the correct version? One or the other is wrong. Having a character hidden and the next character displayed does not seem right to me. gcramer added on 2017-08-09 15:14:38: (text/html) There was something wrong with the measurement if spacemode is "trim", and I did a fix in [342aab732c]. But I do not agree with your computed values, under Linux I get the correct values: <verbatim> {143 3 0 14} {143 3 5 14} {3 17 7 14} {143 3 0 14} {143 3 5 14} {3 17 7 14} </verbatim> <ol> <li>{143 3 0 14}: because last space is trimmed and does not consume space.</li> <li>{143 3 5 14}: the newline consumes the rest of the line, this is conform to original implementation, although it is not documented.</li> <li>{3 17 7 14}: the width of character 'a'.</li> </ol> <p> Francois: what do you think? fvogel added on 2017-07-05 19:28:39: Test script returns "NG" for me on Windows. |