Exemplo n.º 1
0
void owl_perlconfig_edit_callback(owl_editwin *e, bool success)
{
  SV *cb = owl_editwin_get_cbdata(e);
  SV *text;
  dSP;

  if(cb == NULL) {
    owl_function_error("Perl callback is NULL!");
    return;
  }
  text = owl_new_sv(owl_editwin_get_text(e));

  ENTER;
  SAVETMPS;

  PUSHMARK(SP);
  XPUSHs(sv_2mortal(text));
  XPUSHs(sv_2mortal(newSViv(success)));
  PUTBACK;
  
  call_sv(cb, G_DISCARD|G_EVAL);

  if(SvTRUE(ERRSV)) {
    owl_function_error("%s", SvPV_nolen(ERRSV));
  }

  FREETMPS;
  LEAVE;
}
Exemplo n.º 2
0
static void owl_viewwin_callback_search(owl_editwin *e)
{
  int consider_current = false;
  const char *line = owl_editwin_get_text(e);
  owl_viewwin_search_data *data = owl_editwin_get_cbdata(e);

  /* Given an empty string, just continue the current search. */
  if (line && *line) {
    owl_function_set_search(line);
    consider_current = true;
  }
  if (!owl_viewwin_search(data->v, owl_global_get_search_re(&g),
                          consider_current, data->direction))
    owl_function_makemsg("No matches");
}