diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2018-01-10 17:49:32 +0100 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2018-02-02 13:56:56 +0100 |
commit | 9072e988194a36186bd98db844b8285e3f37069a (patch) | |
tree | 0e2781594d749a6b6ddb55ff99e5f093d6bd89eb /src/perl | |
parent | 0f1b3873fe5b99cf8af9bc58d1a982dd5f0f66bd (diff) | |
download | irssi-9072e988194a36186bd98db844b8285e3f37069a.zip |
change color -> extents (malloc based)
Diffstat (limited to 'src/perl')
-rw-r--r-- | src/perl/textui/TextUI.xs | 66 |
1 files changed, 63 insertions, 3 deletions
diff --git a/src/perl/textui/TextUI.xs b/src/perl/textui/TextUI.xs index 02ef6c73..e2f162a0 100644 --- a/src/perl/textui/TextUI.xs +++ b/src/perl/textui/TextUI.xs @@ -125,12 +125,72 @@ CODE: gui_entry_set_text(active_entry, str); void -gui_input_color(pos, len, color) +gui_input_set_extent(pos, text) + int pos + char *text +PREINIT: + char *tt; +CODE: + tt = text != NULL ? format_string_expand(text, NULL) : NULL; + gui_entry_set_extent(active_entry, pos, tt); + g_free(tt); + +void +gui_input_set_extents(pos, len, left, right) + int pos + int len + char *left + char *right +PREINIT: + char *tl; + char *tr; +CODE: + tl = left != NULL ? format_string_expand(left, NULL) : NULL; + tr = right != NULL ? format_string_expand(right, NULL) : NULL; + gui_entry_set_extents(active_entry, pos, len, tl, tr); + g_free(tl); + g_free(tr); + +void +gui_input_clear_extents(pos, len = 0) int pos int len - int color CODE: - gui_entry_set_color(active_entry, pos, len, color); + gui_entry_clear_extents(active_entry, pos, len); + +void +gui_input_get_extent(pos) + int pos +PREINIT: + char *ret; +PPCODE: + ret = gui_entry_get_extent(active_entry, pos); + XPUSHs(sv_2mortal(new_pv(ret))); + g_free(ret); + +void +gui_input_get_text_and_extents() +PREINIT: + GSList *ret, *tmp; +PPCODE: + ret = gui_entry_get_text_and_extents(active_entry); + for (tmp = ret; tmp != NULL; tmp = tmp->next) { + XPUSHs(sv_2mortal(new_pv(tmp->data))); + } + g_slist_free_full(ret, g_free); + +void +gui_input_set_text_and_extents(...) +PREINIT: + GSList *list; + int i; +PPCODE: + list = NULL; + for (i = items; i > 0; i--) { + list = g_slist_prepend(list, SvPV_nolen(ST(i-1))); + } + gui_entry_set_text_and_extents(active_entry, list); + g_slist_free(list); int gui_input_get_pos() |