summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2012-03-27 23:42:00 +1100
committerJonathan Gordon <rockbox@jdgordon.info>2012-03-27 23:42:00 +1100
commitb2202a3d7cce23c20192c1b62cf2f934f78f61df (patch)
tree8603ebf8d23bd44d29b322a0809c6a8327560533
parent215ac639ff82a5064d3a24db005ddd49ec9e1429 (diff)
downloadrockbox-b2202a3.tar.gz
rockbox-b2202a3.zip
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
-rw-r--r--apps/gui/skin_engine/skin_tokens.c5
-rw-r--r--manual/appendix/wps_tags.tex2
2 files changed, 5 insertions, 2 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c
index 29ddad4c5b..1bb5b8e555 100644
--- a/apps/gui/skin_engine/skin_tokens.c
+++ b/apps/gui/skin_engine/skin_tokens.c
@@ -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);
diff --git a/manual/appendix/wps_tags.tex b/manual/appendix/wps_tags.tex
index 4aa9472e74..51f10e9a32 100644
--- a/manual/appendix/wps_tags.tex
+++ b/manual/appendix/wps_tags.tex
@@ -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