Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Handle subst in formatted balloons |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
11c0de8cd8cc439f652953b604a2d274 |
User & Date: | peter 2024-09-07 23:20:38.109 |
Context
2024-09-07
| ||
23:39 | Move psballon to a module check-in: 6760f05081 user: peter tags: trunk | |
23:20 | Handle subst in formatted balloons check-in: 11c0de8cd8 user: peter tags: trunk | |
2024-03-07
| ||
23:02 | Window browser in debug menu check-in: f028c6509e user: peter tags: trunk | |
Changes
Changes to eskil.vfs/lib/psballoon/psballoon.tcl.
|
| | | > > > > > > > > > | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #---------------------------------------------------------*-tcl-*------ # # psballoon.tcl, # Procedures to create help message balloons or display balloons for # listboxes and labels that can't display all of their contents. # # Copyright (c) 2003-2024, Peter Spjuth (peter.spjuth@gmail.com) # # Permission is granted to use this code under the same terms as # for the Tcl core code. # #---------------------------------------------------------------------- # This is used as a Tcl Module. Use it like this: # ::tcl::tm::path add <path-to-dir-with-module> # package require psballoon # namespace import psballoon::* # # addBalloon .l .b "My help text" # addBalloon .f -fmt { # Write help more freely.\n # New lines need to be explicit like above. # } #---------------------------------------------------------------------- package provide psballoon 1.2 namespace eval psballoon { variable balloon variable config |
︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # Remove any newlines. set msg [regsub -all "\n" $msg " "] # Remove multiple whitespace set msg [regsub -all {\s+} $msg " "] set msg [string trim $msg] # Any explicitly requested newlines? set msg [regsub -all {\\n\s*} $msg "\n"] # Further line breaks by length? set lines {} foreach line [split $msg \n] { while {[string length $line] > 80} { # There should be no path through this loop that does not # shorten $line set ix [string last " " $line 80] | > > | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | # Remove any newlines. set msg [regsub -all "\n" $msg " "] # Remove multiple whitespace set msg [regsub -all {\s+} $msg " "] set msg [string trim $msg] # Any explicitly requested newlines? set msg [regsub -all {\\n\s*} $msg "\n"] # Any remaining substs like tabs? set msg [subst -nocommand -novariable $msg] # Further line breaks by length? set lines {} foreach line [split $msg \n] { while {[string length $line] > 80} { # There should be no path through this loop that does not # shorten $line set ix [string last " " $line 80] |
︙ | ︙ |