Menu

#91 tkdiff needlessly obeys 2 blank lines as custom code after save prefs

V5.5.2
closed-dup
None
5
2022-09-10
2022-09-10
Duncan Roe
No

This comes about because of comparing custom code with {} (the built-in default). Suggested patch:

@@ -10837,7 +10837,7 @@
     create-display

     # Evaluate any custom code the user MAY have provided

-    if { "$opts(customCode)" != {}} {
+    if { ! [regexp -expanded "$opts(customCode)" {^$}] } {
         Dbg "Custom code IS in use...beware"
         if {[catch [list uplevel \#0 $opts(customCode)] error]} {
             set startupError "Error in custom code: \n\n$error"

This would be the first use of regexp -expanded in tkdiff, but man n regexp is versioned 8.3 and tkdiff requires 8.5 so I think that is safe.

1 Attachments

Discussion

  • michael-m

    michael-m - 2022-09-10
    • status: open --> closed-dup
    • assigned_to: michael-m
     
  • michael-m

    michael-m - 2022-09-10

    While the issue is true, it is ALSO of little concern, and was ALREADY repaired, per response to a comment from ticket #90. No immediate release is planned, as the only visible perception is to the content of a normally silent debug-only message. It has zero effect on the operation of the tool itself. It will simply become part of whatever (and whenever) the next release occurs.
    PS. a much simpler patch is "string trim $opts(customeCode)" (at that same location) avoiding the setup costs of the regular expression engine when not truly needed. But thanks for your efforts.

     

Log in to post a comment.