Exemplo n.º 1
0
/* Pops the current context from the context stack and returns it. Caller is
 * responsible for freeing. */
CALLER_OWN owl_context *owl_global_pop_context_no_delete(owl_global *g)
{
  owl_context *c;
  if (!g->context_stack)
    return NULL;
  c = owl_global_get_context(g);
  owl_context_deactivate(c);
  g->context_stack = g_list_delete_link(g->context_stack,
                                        g->context_stack);
  owl_global_activate_context(g, owl_global_get_context(g));
  return c;
}
Exemplo n.º 2
0
/* note that changing the value of this will clobber 
 * any user setting of this */
int owl_variable_disable_ctrl_d_set(owl_variable *v, int newval)
{
  if (!owl_context_is_startup(owl_global_get_context(&g))) {
    if (newval == 2) {
      owl_function_command_norv("bindkey editmulti C-d command edit:delete-next-char");
    } else if (newval == 1) {
      owl_function_command_norv("bindkey editmulti C-d command edit:done-or-delete");
    } else {
      owl_function_command_norv("bindkey editmulti C-d command edit:done");
    }
  }  
  return owl_variable_int_set_default(v, newval);
}
Exemplo n.º 3
0
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");
  }
}
Exemplo n.º 4
0
/* Gets the currently active typwin out of the current context. */
owl_editwin *owl_global_current_typwin(const owl_global *g) {
  owl_context *ctx = owl_global_get_context(g);
  return owl_editcontext_get_editwin(ctx);
}
Exemplo n.º 5
0
void owl_global_push_context_obj(owl_global *g, owl_context *c)
{
  g->context_stack = g_list_prepend(g->context_stack, c);
  owl_global_activate_context(g, owl_global_get_context(g));
}