[TW5] setWidget with filter

73 views
Skip to first unread message

FrD

unread,
Sep 25, 2015, 8:20:30 AM9/25/15
to TiddlyWiki
Hi,

I came across something strange in relation with the setWidget, when used with a filter in order to affect a value to a variable (the value= ... emptyValue=... syntax)
It seems that I can't affect an empty string as value although I can do it with emptyValue.

Try the following code in a tiddler :

\define myFilter1() "something"
\define myFilter2() ""

<$set name="foo" filter=<<myFilter1>> value="" emptyValue="value if empty">
 foo
: <<foo>>
</$set>


<$set name="bar" filter=<<myFilter2>> value="value if not empty" emptyValue="">
 bar: <<bar>>
</
$set>


In the first case the value stored in foo is the value of the filter : something, while I was expecting an empty string.
In the second case, bar is an empty string as requested.

I must admit it's a very narrow use-case, but I don't know if this behaviour is expectet or not so I prefer to just pass the info.

FrD


 

Tobias Beer

unread,
Sep 25, 2015, 10:19:39 AM9/25/15
to TiddlyWiki
Hi Frd,
 
In the first case the value stored in foo is the value of the filter : something, while I was expecting an empty string.

That appears to be a bug here...

if(this.setValue === undefined) {

@Jeremy, should I add this modification to this pull request
regarding the missing refresh handling of the set widget when using a filter?

fixes #1937 — filter refresh in set widget
https://github.com/Jermolene/TiddlyWiki5/pull/1952

Best wishes,

— tb

Jeremy Ruston

unread,
Sep 25, 2015, 11:33:00 AM9/25/15
to TiddlyWiki
Hi Tobias


@Jeremy, should I add this modification to this pull request
regarding the missing refresh handling of the set widget when using a filter?

Thanks Tobias. I think it's better to make it a new pull request. 

Best wishes

Jeremy
 

fixes #1937 — filter refresh in set widget
https://github.com/Jermolene/TiddlyWiki5/pull/1952

Best wishes,

— tb

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/b871b32a-db1d-48a3-a9fe-a6d758798557%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Tobias Beer

unread,
Sep 25, 2015, 9:08:11 PM9/25/15
to TiddlyWiki, jeremy...@gmail.com
Hi Jeremy,

I'll guess, I'll add it to both ...tomorrow / at the appropriate time.
Seems to be the sensible choice if one is sure to be merged.

Best wishes,

— tb
Reply all
Reply to author
Forward
0 new messages