Index: openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl,v
diff -u -r1.89 -r1.90
--- openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 18 Jul 2018 18:51:17 -0000 1.89
+++ openacs-4/packages/acs-tcl/tcl/text-html-procs.tcl 19 Jul 2018 09:09:18 -0000 1.90
@@ -2181,7 +2181,7 @@
set text [util_close_html_tags $text $truncate_len $truncate_len $ellipsis $more]
}
text/plain {
- set text [string_truncate -ellipsis $ellipsis -more $more -len $truncate_len -equal -- $text]
+ set text [string_truncate -ellipsis $ellipsis -more $more -len $truncate_len -- $text]
}
}
@@ -2298,7 +2298,7 @@
the ellipsis parameter if the string was truncated.
The length of the resulting string, including the ellipsis, is
- guaranteed to be within the len specified.
+ guaranteed to be shorter or equal than the len specified.
Should always be called as string_truncate [-flags ...] -- string
since otherwise strings which start with a - will treated as
@@ -2308,13 +2308,10 @@
@param ellipsis This will get put at the end of the truncated string, if the string was truncated.
However, this counts towards the total string length, so that the returned string
- including ellipsis is guaranteed to be shorter than the 'len' provided.
+ including ellipsis is guaranteed to be shorter or equal than the 'len' provided.
@param more This will get put at the end of the truncated string, if the string was truncated.
- @param equal If this is passed, then the length of the truncated string will be shorter or
- *equal* to the value of the 'len' specified.
-
@param string The string to truncate.
@return The truncated string
@@ -2325,13 +2322,8 @@
if { $len > 0 & [string length $string] > $len } {
set end_index [expr {$len-[string length $ellipsis]-1}]
- # If equal is passed, then the string can be equal to the length specified
- if { $equal_p } {
- incr end_index
- }
-
# Back up to the nearest whitespace
- if {[regexp -indices {\s\S*$} [string range $string 0 $end_index] match]} {
+ if {[regexp -indices {\s\S*$} [string range $string 0 [expr {$end_index+1}]] match]} {
set last_space [lindex $match 0]
} else {
set last_space -1