Skip to content

Commit

Permalink
ysfx: allow whitespace before slider identifier
Browse files Browse the repository at this point in the history
Some JSFX use whitespace after the : and before the identifier name. Since reaper supports this, we should too.
  • Loading branch information
JoepVanlier committed Jan 31, 2025
1 parent fc72705 commit 625c96d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sources/ysfx_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ bool ysfx_parse_slider(const char *line, ysfx_slider_t &slider)
// semicolon
if (*cur++ != ':')
PARSE_FAIL;

// Whitespace before the identifier is ignored
while (*cur && ysfx::ascii_isspace(*cur)) ++cur;

// search if there is an '=' sign prior to any '<' or ','
// if there is, it's a custom variable
Expand Down
3 changes: 3 additions & 0 deletions tests/ysfx_test_parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,9 @@ TEST_CASE("slider parsing", "[parse]")
"slider10:a1?+!%&<-150%&=/?+!,12!%/&?+=,1=/?+!%&>?+!%&=/",
"SLIDER11:shouty=0<-150,12,1>shouty",
"SlIdEr12:infantile=0<-150,12,1>hehe",
"slider13: compRatio=0<-150,12,1> Ratio [x:1]",
"slider14: compRatio2=0<-150,12,1> Ratio [x:1]",
"slider15: all_the_spaces = 0 < -150 , 12 , 1 > Ratio [x:1]",
})
{
ysfx_slider_t slider;
Expand Down

0 comments on commit 625c96d

Please sign in to comment.