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"
}