mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 20:33:46 +02:00
added format_get_length() for getting length of text part in a format
string. gui_printtext() now works like printtext_string() so %s won't accidentally crash it. /SET prompt can now have %formats. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1273 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
c8893c61ee
commit
4718edf055
8 changed files with 44 additions and 27 deletions
|
|
@ -216,6 +216,34 @@ void format_create_dest(TEXT_DEST_REC *dest,
|
|||
dest->hilight_bg_color = 0;
|
||||
}
|
||||
|
||||
int format_get_length(const char *str)
|
||||
{
|
||||
GString *tmp;
|
||||
int len;
|
||||
|
||||
tmp = g_string_new(NULL);
|
||||
len = 0;
|
||||
while (*str != '\0') {
|
||||
if (*str == '%' && str[1] != '\0') {
|
||||
str++;
|
||||
if (*str != '%' && format_expand_styles(tmp, *str)) {
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* %% or unknown %code, written as-is */
|
||||
if (*str != '%')
|
||||
len++;
|
||||
}
|
||||
|
||||
len++;
|
||||
str++;
|
||||
}
|
||||
|
||||
g_string_free(tmp, TRUE);
|
||||
return len;
|
||||
}
|
||||
|
||||
static char *format_get_text_args(TEXT_DEST_REC *dest,
|
||||
const char *text, char **arglist)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue