Tk Source Code

Ticket Change Details
Login
Overview

Artifact ID: 7ba96d15bda48170f20725734363c278a925b635
Ticket: 46d7a4d153591683ad4283e3eed018f420c50617
tags not present as intended
User & Date: chw 2017-05-26 21:39:17
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    The code below is derived from the widget demo and should display hyperlinks on most lines.
    There seems to be a pattern of lines not getting a hyperlink tag. Tried on a x86_64 linux build.
    
    --- code ---
    
    text .t -wrap word -width 70 -height 50 \
            -setgrid 1 -highlightthickness 0
    pack .t -expand 1 -fill both -padx 1
    
    .t tag configure title -font TkDefaultFont
    .t tag configure subtitle -font TkDefaultFont
    .t tag configure bold -font TkDefaultFont
    .t tag configure demospace -lmargin1 1c -lmargin2 1c
    .t tag configure demo -lmargin1 1c -lmargin2 1c \
        -foreground blue -underline 1
    .t tag configure visited -lmargin1 1c -lmargin2 1c \
        -foreground #303080 -underline 1
    .t tag configure hot -foreground red -underline 1
    
    proc addt {text} {
        set style normal
        set isNL 1
        set demoCount 0
        set new 0
        foreach line [split $text \n] {
            set line [string trim $line]
            if {$line eq ""} {
                continue
            }
            if {[string match @@* $line]} {
                set data [string range $line 2 end]
                set key [lindex $data 0]
                set values [lrange $data 1 end]
                switch -exact -- $key {
                    title {
                        .t insert end $values\n title \n normal
                    }
                    newline {
                        .t insert end \n $style
                        set isNL 1
                    }
                    subtitle {
                        .t insert end "\n" {} $values subtitle \
                                " \n " demospace
                        set demoCount 0
                    }
                    demo {
                        set description [lassign $values name]
                        .t insert end "[incr demoCount]. $description" \
                                [list demo demo-$name]
                        if {$new} {
                            .t image create end -image ::img::new -padx 5
                            set new 0
                        }
                        .t insert end " \n " demospace
                    }
                    new {
                        set new 1
                    }
                    default {
                        set style $key
                    }
                }
                continue
            }
            if {!$isNL} {
                .t insert end " " $style
            }
            set isNL 0
            .t insert end $line $style
        }
    }
    
    set addt {
        @@title     Tag test
    
        Bla bla bla ...
        Bla bla bla ...
    
        @@subtitle   subtitle
    }
    
    for {set i 0} {$i < 1024} {incr i} {
        append addt "    @@demo tag$i\ttag$i\n"
    }
    
    addt $addt
    
    --- /code ---
    
  5. foundin changed to: "revised_text"
  6. is_private changed to: "0"
  7. login: "chw"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "0b3aff16612e1e9f3b675963fa64e01bd1d89307"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "chw"
  14. subsystem changed to: "-- New Widgets"
  15. title changed to: "tags not present as intended"
  16. type changed to: "Bug"