mirror of
https://github.com/irssi/irssi.git
synced 2026-08-10 12:23:37 +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
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue