Changeset 72ab15f


Ignore:
Timestamp:
Jul 15, 2009, 10:49:16 PM (15 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
3e8ff1e
Parents:
7c83a32
Message:
editwin: Simplify zdot handling.

I'm frankly not sure what the old code was trying to do, but this is
much simpler, covers every case I can think of, and fixes some bugs.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    rbd7fb58 r72ab15f  
    11991199static int owl_editwin_check_dotsend(owl_editwin *e)
    12001200{
    1201   char *p, *p_n, *p_p;
    1202   gunichar c;
     1201  int zdot;
     1202  oe_excursion x;
    12031203
    12041204  if (!e->dotsend) return(0);
    1205 
    1206   p = g_utf8_find_prev_char(e->buff, e->buff + e->bufflen);
    1207   p_n = g_utf8_find_next_char(p, NULL);
    1208   p_p = g_utf8_find_prev_char(e->buff, p);
    1209   c = g_utf8_get_char(p);
    1210   while (p != NULL) {
    1211     if (*p == '.'
    1212         && p_p != NULL && (*p_p == '\n' || *p_p == '\r')
    1213         && p_n != NULL && (*p_n == '\n' || *p_n == '\r')) {
    1214       e->bufflen = p - e->buff;
    1215       e->buff[e->bufflen] = '\0';
    1216       return(1);
    1217     }
    1218     if (c != '\0' && !g_unichar_isspace(c)) return(0);
    1219     p_n = p;
    1220     p = p_p;
    1221     c = g_utf8_get_char(p);
    1222     p_p = g_utf8_find_prev_char(e->buff, p);
    1223   }
    1224   return(0);
     1205  if (e->index != e->bufflen) return (0);
     1206
     1207  oe_save_excursion(e, &x);
     1208
     1209  owl_editwin_point_move(e, -3);
     1210
     1211  zdot = (strcmp(e->buff + e->index, "\n.\n") == 0);
     1212
     1213  oe_restore_excursion(e, &x);
     1214
     1215  return zdot;
    12251216}
    12261217
Note: See TracChangeset for help on using the changeset viewer.