Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: 3a6b421cf9cd7491957779335aca8df20550210e
Ticket: c6978a9ec7c033113330478fa136413b57a0c371
Revised [text]: Linux : spacemode trim reports wrong character as hidden (24.11.1)
User & Date: bll 2017-07-04 21:28:37
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    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"
    }
    
  5. foundin changed to: "revised_text"
  6. is_private changed to: "0"
  7. login: "bll"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "bll"
  13. subsystem changed to: "18. [text]"
  14. title changed to:
    text: Linux : spacemode trim reports wrong character as hidden (24.11.1)
    
  15. type changed to: "Bug"