void owl_global_set_search_re(owl_global *g, const owl_regex *re) { if (owl_regex_is_set(&g->search_re)) { owl_regex_cleanup(&g->search_re); owl_regex_init(&g->search_re); } if (re != NULL) owl_regex_copy(re, &g->search_re); /* TODO: Emit a signal so we don't depend on the viewwin and mainwin */ if (owl_global_get_viewwin(g)) owl_viewwin_dirty(owl_global_get_viewwin(g)); owl_mainwin_redisplay(owl_global_get_mainwin(g)); }
void owl_process_input_char(owl_input j) { int ret; owl_popwin *pw; owl_editwin *tw; owl_global_set_lastinputtime(&g, time(NULL)); pw=owl_global_get_popwin(&g); tw=owl_global_get_typwin(&g); owl_global_set_lastinputtime(&g, time(NULL)); /* find and activate the current keymap. * TODO: this should really get fixed by activating * keymaps as we switch between windows... */ if (pw && owl_popwin_is_active(pw) && owl_global_get_viewwin(&g)) { owl_context_set_popless(owl_global_get_context(&g), owl_global_get_viewwin(&g)); owl_function_activate_keymap("popless"); } else if (owl_global_is_typwin_active(&g) && owl_editwin_get_style(tw)==OWL_EDITWIN_STYLE_ONELINE) { /* owl_context_set_editline(owl_global_get_context(&g), tw); owl_function_activate_keymap("editline"); */ } else if (owl_global_is_typwin_active(&g) && owl_editwin_get_style(tw)==OWL_EDITWIN_STYLE_MULTILINE) { owl_context_set_editmulti(owl_global_get_context(&g), tw); owl_function_activate_keymap("editmulti"); } else { owl_context_set_recv(owl_global_get_context(&g)); owl_function_activate_keymap("recv"); } /* now actually handle the keypress */ ret = owl_keyhandler_process(owl_global_get_keyhandler(&g), j); if (ret!=0 && ret!=1) { owl_function_makemsg("Unable to handle keypress"); } }