diff --git a/lslopt/lsloutput.py b/lslopt/lsloutput.py index 5e91504..095bcef 100644 --- a/lslopt/lsloutput.py +++ b/lslopt/lsloutput.py @@ -30,6 +30,9 @@ class outscript(object): else: pfx = '((key)' sfx = ')' + if '\t' in value: + warning('WARNING: A string contains a tab. Tabs are expanded to four' + ' spaces by the viewer when copy-pasting the code.') return pfx + '"' + value.encode('utf8').replace('\\','\\\\') \ .replace('"','\\"').replace('\n','\\n') + '"' + sfx if tvalue == int: @@ -59,6 +62,7 @@ class outscript(object): # This should never happen (Python should always return a point or exponent) return s + '.' # pragma: no cover exp = '' + # TODO: Move this to a separate function to fix the above. while s[-1] != '.' and lslfuncs.F32(float(s[:-1]+exp)) == value: s = s[:-1] # TODO: Refine. diff --git a/main.py b/main.py index 6848469..643b780 100644 --- a/main.py +++ b/main.py @@ -33,6 +33,11 @@ Options (* means not implemented): directives like: # 123 "filename". optimize Runs the optimizer. optsigns Optimize signs and float as int. + * foldtabs Tabs can't be copy-pasted, so they aren't optimized by + default. But with support from the viewer, they can be + folded too and make it to the uploaded source. This + option overrides that check, enabling optimization of + strings with tabs. * allowcescapes Enables use of \r, \b, \xNN, \NNN, etc. * enableswitch Enables Firestorm-compatible switch statements (not recommended)