Changes in editwin.c [3b8a563:8258ea5]
Legend:
- Unmodified
- Added
- Removed
-
editwin.c
r3b8a563 r8258ea5 1 1 #include "owl.h" 2 #include <stdlib.h>3 #include <unistd.h>4 #include <string.h>5 #include <ctype.h>6 2 7 3 #define VALID_EXCURSION (0x9a2b4729) … … 37 33 oe_excursion *excursions; 38 34 39 void (*callback)(struct _owl_editwin *);35 void (*callback)(struct _owl_editwin *e, bool success); 40 36 void (*destroy_cbdata)(void *); 41 37 void *cbdata; … … 61 57 static const char *oe_copy_buf(owl_editwin *e, const char *buf, int len); 62 58 static int oe_copy_region(owl_editwin *e); 63 static char *oe_chunk(owl_editwin *e, int start, int end);59 static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end); 64 60 static void oe_destroy_cbdata(owl_editwin *e); 65 61 static void oe_dirty(owl_editwin *e); … … 70 66 #define WHITESPACE " \n\t" 71 67 72 static owl_editwin *owl_editwin_allocate(void)68 static CALLER_OWN owl_editwin *owl_editwin_allocate(void) 73 69 { 74 70 owl_editwin *e = g_new0(owl_editwin, 1); … … 142 138 } 143 139 144 owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist)140 CALLER_OWN owl_editwin *owl_editwin_new(owl_window *win, int winlines, int wincols, int style, owl_history *hist) 145 141 { 146 142 owl_editwin *e = owl_editwin_allocate(); … … 224 220 } 225 221 226 void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin *))222 void owl_editwin_set_callback(owl_editwin *e, void (*cb)(owl_editwin *, bool)) 227 223 { 228 224 e->callback = cb; 229 225 } 230 226 231 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin *)227 void (*owl_editwin_get_callback(owl_editwin *e))(owl_editwin *, bool) 232 228 { 233 229 return e->callback; … … 252 248 } 253 249 254 void owl_editwin_do_callback(owl_editwin *e) { 255 void (*cb)(owl_editwin*); 256 cb=owl_editwin_get_callback(e); 257 if(!cb) { 250 void 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) { 258 255 owl_function_error("Internal error: No editwin callback!"); 259 256 } else { 260 /* owl_function_error("text: |%s|", owl_editwin_get_text(e)); */ 261 cb(e); 257 cb(e, success); 262 258 } 263 259 } … … 623 619 624 620 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."); 626 622 return 0; 627 623 } … … 1151 1147 { 1152 1148 oe_excursion x; 1153 gunichar ch; 1149 gunichar ch = 0; 1150 gunichar last_ch; 1154 1151 int sentence; 1155 1152 … … 1184 1181 } 1185 1182 1183 last_ch = ch; 1186 1184 ch = owl_editwin_get_char_at_point(e); 1187 1185 … … 1201 1199 } 1202 1200 1203 if(ch == '.' || ch == '!' || ch == '?') 1201 if (ch == '.' || ch == '!' || ch == '?' || 1202 (ch == '"' && (last_ch == '.' || last_ch == '!' || last_ch == '?'))) 1204 1203 sentence = 1; 1205 1204 else … … 1369 1368 } 1370 1369 1371 char *owl_editwin_get_region(owl_editwin *e)1370 CALLER_OWN char *owl_editwin_get_region(owl_editwin *e) 1372 1371 { 1373 1372 int start, end; … … 1388 1387 } 1389 1388 1390 static char *oe_chunk(owl_editwin *e, int start, int end)1389 static CALLER_OWN char *oe_chunk(owl_editwin *e, int start, int end) 1391 1390 { 1392 1391 char *p;
Note: See TracChangeset
for help on using the changeset viewer.