Permalink
Browse files

[Dialog] fix some internal var names always set to %v #572

Command activation that passed an xvalue to run_command() replaced all named
vars (eg %label1 or %foo) with xvalue instead of correct element's value.

Test for this bug (present in < 1.0.4):
spacefm -g --label 111111 --label \
           --check "Set label2 to label1" 0 set label2 %label1

When checkbox is clicked, label2 should be set to "111111", not "1" or "0".
  • Loading branch information...
1 parent 150264a commit 5bcdd24b77ed4635c17cf4732a141de4fe6a1527 @IgnorantGuru committed Sep 7, 2015
Showing with 4 additions and 5 deletions.
  1. +1 −0 ChangeLog
  2. +3 −5 src/cust-dialog.c
View
@@ -16,6 +16,7 @@
add new event for tab change dir evt_tab_chdir; update manual
replace show-menu socket method with activate for all item types
[Dialog] add non-visible element --click to run cmd on click #572
+ [Dialog] fix some internal var names always set to %v #572
increase max icon/thumbnail size from 256x256 to 512x512
1.0.3 2015-08-26:
add Devices|Settings|Auto-Mount|Mount Dirs option #548
View
@@ -1250,19 +1250,17 @@ static char* replace_vars( CustomElement* el, char* value, char* xvalue )
}
else
{
- if ( !strcmp( sep + 1, "v" ) )
- // %v
+ if ( !strcmp( sep + 1, "v" ) || !g_strcmp0( sep + 1, el->name ) )
+ // %v or %self
str3 = xvalue ? g_strdup( xvalue ) :
get_element_value( el, el->name );
else
// %NAME
- str3 = xvalue ? g_strdup( xvalue ) :
- get_element_value( el, sep + 1 );
+ str3 = get_element_value( el, sep + 1 );
str2 = newval;
newval = g_strdup_printf( "%s%s", str2 ? str2 : "", str3 );
g_free( str2 );
g_free( str3 );
-
}
str[0] = c;
}

0 comments on commit 5bcdd24

Please sign in to comment.