Tcl Library Source Code

View Ticket
Login
Ticket UUID: fbf8d90640171a42e47f24ad85cbb10f2bee101e
Title: New alignment tag for numeric values
Type: Patch Version: 0.3.2
Submitter: anonymous Created on: 2024-05-08 13:13:18
Subsystem: report Assigned To:
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2024-05-08 13:14:46
Resolution: None Closed By: nobody
    Closed on:
Description:
As it is very common to represent numbers right aligned I added the new alignment option "rnumber" which right-aligns all fields which contain numbers independent of the alignment of the title fields.
User Comments: anonymous added on 2024-05-08 13:14:46:
diff -u report.tcl /usr/share/tcltk/tcllib1.20/report/report.tcl 
--- report.tcl	2024-05-08 14:52:49.654557007 +0200
+++ /usr/share/tcltk/tcllib1.20/report/report.tcl	2019-04-10 19:19:50.000000000 +0200
@@ -10,7 +10,7 @@
 # RCS: @(#) $Id: report.tcl,v 1.8 2004/01/15 06:36:13 andreas_kupries Exp $
 
 package require Tcl 8.2
-package provide report 0.3.3
+package provide report 0.3.2
 
 namespace eval ::report {
     # Data storage in the report module
@@ -978,12 +978,12 @@
 	return $cjust($column)
     }
     switch -exact -- $jvalue {
-	left - right - center - rnumber {
+	left - right - center {
 	    set cjust($column) $jvalue
 	    return ""
 	}
 	default {
-	    return -code error "justification: expected, left, right, center, or rnumber got \"$jvalue\""
+	    return -code error "justification: expected, left, right, or center, got \"$jvalue\""
 	}
     }
 }
@@ -1371,13 +1371,6 @@
 
 	    return [string range $value $lcut end-$rcut]
 	}
-	rnumber {
-	    if {[string is integer $value] || [string is double $value]} {
-	    ::report::FormatCell $value $size right
-	} else {
-	    ::report::FormatCell $value $size center
-	}
-	}
 	default {
 	    error "Can't happen, panic, run, shout"
 	}
@@ -1390,4 +1383,4 @@
     # a state change, and are logically of zero/no width.
     regsub -all "\033\\\[\[0-9;\]*m" $string {} string
     return $string
-}
+}
\ No newline at end of file