Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r3b8a563 r8258ea5  
    11#include "owl.h"
    2 #include <stdlib.h>
    3 #include <unistd.h>
    4 #include <string.h>
    5 #include <ctype.h>
    62
    73#define VALID_EXCURSION (0x9a2b4729)
     
    3733  oe_excursion *excursions;
    3834
    39   void (*callback)(struct _owl_editwin*);
     35  void (*callback)(struct _owl_editwin *e, bool success);
    4036  void (*destroy_cbdata)(void *);
    4137  void *cbdata;
     
    6157static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len);
    6258static int oe_copy_region(owl_editwin *e);
    63 static char *oe_chunk(owl_editwin *e, int start, int end);
     59static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end);
    6460static void oe_destroy_cbdata(owl_editwin *e);
    6561static void oe_dirty(owl_editwin *e);
     
    7066#define WHITESPACE " \n\t"
    7167
    72 static owl_editwin *owl_editwin_allocate(void)
     68static CALLER_OWN owl_editwin *owl_editwin_allocate(void)
    7369{
    7470  owl_editwin *e = g_new0(owl_editwin, 1);
     
    142138}
    143139
    144 owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)
     140CALLER_OWN owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)
    145141{
    146142  owl_editwin *e = owl_editwin_allocate();
     
    224220}
    225221
    226 void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin*))
     222void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin *, bool))
    227223{
    228224  e->callback = cb;
    229225}
    230226
    231 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin*)
     227void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin *, bool)
    232228{
    233229  return e->callback;
     
    252248}
    253249
    254 void owl_editwin_do_callback(owl_editwin *e) {
    255   void (*cb)(owl_editwin*);
    256   cb=owl_editwin_get_callback(e);
    257   if(!cb) {
     250void owl_editwin_do_callback(owl_editwin *e, bool success)
     251{
     252  void (*cb)(owl_editwin *, bool);
     253  cb = owl_editwin_get_callback(e);
     254  if (!cb) {
    258255    owl_function_error("Internal error: No editwin callback!");
    259256  } else {
    260     /* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */
    261     cb(e);
     257    cb(e, success);
    262258  }
    263259}
     
    623619
    624620  if (!g_utf8_validate(s, -1, NULL)) {
    625     owl_function_debugmsg("owl_editwin_insert_string: received non-utf-8 string.");
     621    owl_function_debugmsg("owl_editwin_insert_string: received non-UTF-8 string.");
    626622    return 0;
    627623  }
     
    11511147{
    11521148  oe_excursion x;
    1153   gunichar ch;
     1149  gunichar ch = 0;
     1150  gunichar last_ch;
    11541151  int sentence;
    11551152
     
    11841181    }
    11851182
     1183    last_ch = ch;
    11861184    ch = owl_editwin_get_char_at_point(e);
    11871185
     
    12011199    }
    12021200
    1203     if(ch == '.' || ch == '!' || ch == '?')
     1201    if (ch == '.' || ch == '!' || ch == '?' ||
     1202        (ch == '"' && (last_ch == '.' || last_ch == '!' || last_ch == '?')))
    12041203      sentence = 1;
    12051204    else
     
    13691368}
    13701369
    1371 char *owl_editwin_get_region(owl_editwin *e)
     1370CALLER_OWN char *owl_editwin_get_region(owl_editwin *e)
    13721371{
    13731372  int start, end;
     
    13881387}
    13891388
    1390 static char *oe_chunk(owl_editwin *e, int start, int end)
     1389static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end)
    13911390{
    13921391  char *p;
Note: See TracChangeset for help on using the changeset viewer.