etjones / LiveParametric

Extension to Google Sketchup's Parametric class example to allow live updating & richer UI.
2 stars 0 forks source link

DropdownList strings containing HTML chars are ignored #1

Open etjones opened 12 years ago

etjones commented 12 years ago

Bug description

If HTML characters (angle brackets, etc.) are sent to a DropdownList (or other VariableDicts, probably) the bracketed parts will be ignored.

A solution would be to use cgi.escapeHTML to escape all LP strings, but cgi isn't included in SU's Ruby. Will investigate an alternative solution.

Workaround

Er, for the moment don't use strings with angle brackets in them.

Demo program:

class DropdownBugExample < LiveParametric

Correct behavior would yield a dropdown list with these entries:

#    good element
#    missing <bracketed> word
#
# Actual behavior yields:
#    good element
#    missing word
def default_variables
    possible_vals = ["good element", "missing <bracketed> word"]
    [ DropdownList.new("test_dropdown", possible_vals)]
end
def create_entities( data, container)
    container.add_face( [[0,0,0],[0,1,0],[1,0,0]])
end

end

FrancisGerard commented 12 years ago

DropdownList returns string with a preceding space which is OK if all you want is for a human to read the string but it messes up string comparisons. The receiving program can strip it off but that's a get around.

etjones commented 12 years ago

Opened the leading space issue as #18, and fixed it.

FrancisGerard commented 12 years ago

Many thanks for fixing the leading space issue.

The window/door plugin is starting to work and Live Parametric will make it very much more user friendly. It's a great improvement on Parametric.