skin_engine: Allow negative numbers for the start offset in %ss

i.e %ss(-1, -, %ia) will get the last letter in the %ia tag

Change-Id: I6b2764d30c072b549e7424fc6e847ec48850b46a
This commit is contained in:
Jonathan Gordon 2012-03-27 23:42:00 +11:00
parent 215ac639ff
commit b2202a3d7c
2 changed files with 5 additions and 2 deletions

View file

@ -927,7 +927,10 @@ const char *get_token_value(struct gui_wps *gwps,
if (utf8_len < ss->start)
return NULL;
start_byte = utf8seek(token_val, ss->start);
if (ss->start < 0)
start_byte = utf8seek(token_val, ss->start + utf8_len);
else
start_byte = utf8seek(token_val, ss->start);
if (ss->length < 0 || (ss->start + ss->length) > utf8_len)
end_byte = strlen(token_val);

View file

@ -766,7 +766,7 @@ a horizontal progressbar which doesn't fill and draws the image
\end{tagmap}
Use this tag to get a substring from another tag.
\begin{description}
\item[start] -- first character to take (0 being the start of the string)
\item[start] -- first character to take (0 being the start of the string, negative means from the end of the string)
\item[length] -- length of the substring to return (- for the rest of the string)
\item[tag] -- tag to get
\item[number] -- OPTIONAL. if this is present it will assume the