Reset colour of input to defaults

When issuing commands to Vimprobable, reset the colours back to their
defaults, to clear out old values from modifications made by search strings,
etc.
This commit is contained in:
Thomas Adam 2010-07-02 15:16:16 +01:00
parent b2992297e6
commit 4230a4bc40
1 changed files with 27 additions and 1 deletions

28
main.c
View File

@ -922,7 +922,33 @@ input(const Arg *arg) {
const char *url;
update_state();
/* to avoid things like :open URL :open URL2 or :open :open URL */
/* Set the colour and font back to the default, so that we don't still
* maintain a red colour from a warning from an end of search indicator,
* etc.
*
* XXX - unify this with echo() at some point.
*/
{
GdkColor ibox_fg_color;
GdkColor ibox_bg_color;
PangoFontDescription *font;
int index = Info;
font = pango_font_description_from_string(urlboxfont[index]);
gtk_widget_modify_font(inputbox, font);
pango_font_description_free(font);
if (urlboxcolor[index])
gdk_color_parse(urlboxcolor[index], &ibox_fg_color);
if (urlboxbgcolor[index])
gdk_color_parse(urlboxbgcolor[index], &ibox_bg_color);
gtk_widget_modify_text(inputbox, GTK_STATE_NORMAL, urlboxcolor[index] ? &ibox_fg_color : NULL);
gtk_widget_modify_base(inputbox, GTK_STATE_NORMAL, urlboxbgcolor[index] ? &ibox_bg_color : NULL);
}
/* to avoid things like :open URL :open URL2 or :open :open URL */
gtk_entry_set_text(GTK_ENTRY(inputbox), "");
gtk_editable_insert_text(GTK_EDITABLE(inputbox), arg->s, -1, &pos);
if (arg->i & InsertCurrentURL && (url = webkit_web_view_get_uri(webview)))