diff options
author | Timo Sirainen <cras@irssi.org> | 2001-02-21 04:21:15 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-02-21 04:21:15 +0000 |
commit | 4718edf055c33ea1d52197ac9b0d7233dc7d77ca (patch) | |
tree | 8ad31b78825ac92c0f62e4eac7a5d762c0115e56 /src/fe-text | |
parent | c8893c61eebf363354ecfab926fb09e5b973deaf (diff) | |
download | irssi-4718edf055c33ea1d52197ac9b0d7233dc7d77ca.zip |
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
Diffstat (limited to 'src/fe-text')
-rw-r--r-- | src/fe-text/gui-entry.c | 10 | ||||
-rw-r--r-- | src/fe-text/gui-printtext.c | 8 | ||||
-rw-r--r-- | src/fe-text/gui-printtext.h | 2 | ||||
-rw-r--r-- | src/fe-text/statusbar-items.c | 4 |
4 files changed, 10 insertions, 14 deletions
diff --git a/src/fe-text/gui-entry.c b/src/fe-text/gui-entry.c index 07990351..257a173c 100644 --- a/src/fe-text/gui-entry.c +++ b/src/fe-text/gui-entry.c @@ -19,7 +19,9 @@ */ #include "module.h" +#include "formats.h" +#include "gui-printtext.h" #include "screen.h" static GString *entry; @@ -78,11 +80,11 @@ void gui_entry_set_prompt(const char *str) g_free_not_null(prompt); prompt = g_strdup(str); - promptlen = strlen(prompt); + promptlen = format_get_length(prompt); } - set_color(stdscr, 0); - mvaddstr(LINES-1, 0, prompt); + if (prompt != NULL) + gui_printtext(0, LINES-1, prompt); entry_screenpos(); entry_update(); @@ -94,7 +96,7 @@ void gui_entry_set_perm_prompt(const char *str) g_free_not_null(prompt); prompt = g_strdup(str); - promptlen = strlen(prompt); + promptlen = format_get_length(prompt); permanent_prompt = TRUE; gui_entry_set_prompt(NULL); diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c index 6d339404..9fbf14b1 100644 --- a/src/fe-text/gui-printtext.c +++ b/src/fe-text/gui-printtext.c @@ -239,16 +239,12 @@ void gui_window_line_remove(WINDOW_REC *window, LINE_REC *line, int redraw) gui_window_redraw(window); } -void gui_printtext(int xpos, int ypos, const char *str, ...) +void gui_printtext(int xpos, int ypos, const char *str) { - va_list va; - next_xpos = xpos; next_ypos = ypos; - va_start(va, str); - printtext_gui_args(str, va); - va_end(va); + printtext_gui(str); next_xpos = next_ypos = -1; } diff --git a/src/fe-text/gui-printtext.h b/src/fe-text/gui-printtext.h index 468e46a7..6f0b46fe 100644 --- a/src/fe-text/gui-printtext.h +++ b/src/fe-text/gui-printtext.h @@ -33,6 +33,6 @@ void gui_window_line_append(GUI_WINDOW_REC *gui, const char *str, int len); void gui_window_line_remove(WINDOW_REC *window, LINE_REC *line, int redraw); void gui_window_line_text_free(GUI_WINDOW_REC *gui, LINE_REC *line); -void gui_printtext(int xpos, int ypos, const char *str, ...); +void gui_printtext(int xpos, int ypos, const char *str); #endif diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index 035c77e1..7d0c092e 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -517,9 +517,7 @@ static void sig_statusbar_more_check_remove(WINDOW_REC *window) static void sig_statusbar_more_check(WINDOW_REC *window) { - g_return_if_fail(window != NULL); - - if (!is_window_visible(window)) + if (window == NULL || !is_window_visible(window)) return; if (!WINDOW_GUI(window)->bottom) { |