Changeset a0fbdee


Ignore:
Timestamp:
Jul 11, 2009, 1:14:33 PM (12 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
cedc95c
Parents:
d7043b4
git-author:
Karl Ramm <kcr@1ts.org> (06/08/09 18:58:00)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:33)
Message:
s/_?owl_editwin_(save_|restore_|)excursion/oe_\1excursion/
(and move the functions up in the file)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    rd7043b4 ra0fbdee  
    3030  int index;
    3131  int goal_column;
    32 } _owl_editwin_excursion;
     32  int lock;
     33} oe_excursion;
    3334
    3435static int owl_editwin_is_char_in(owl_editwin *e, char *set);
     
    266267}
    267268
     269static void oe_save_excursion(owl_editwin *e, oe_excursion *x)
     270{
     271  x->index = e->index;
     272  x->goal_column = e->goal_column;
     273  x->lock = e->lock;
     274}
     275
     276static void oe_restore_excursion(owl_editwin *e, oe_excursion *x)
     277{
     278  e->index = x->index;
     279  e->goal_column = x->goal_column;
     280  e->lock = x->lock;
     281}
     282
    268283static inline char *oe_next_point(owl_editwin *e, char *p)
    269284{
     
    297312  char *p;
    298313
    299   while(1) {
    300     /* are we at the point? */
     314    /* are we at the point already? */
    301315    if (x != NULL && index == e->index)
    302316      *x = width;
    303 
     317  while(1) {
    304318    /* get the current character */
    305319    c = g_utf8_get_char(e->buff + index);
     
    659673}
    660674
    661 void owl_editwin_save_excursion(owl_editwin *e, _owl_editwin_excursion *x) /*noproto*/
    662 {
    663   x->index = e->index;
    664   x->goal_column = e->goal_column;
    665 }
    666 
    667 void owl_editwin_restore_excursion(owl_editwin *e, _owl_editwin_excursion *x) /*noproto*/
    668 {
    669   e->index = x->index;
    670   e->goal_column = x->goal_column;
    671 }
    672 
    673675void owl_editwin_adjust_for_locktext(owl_editwin *e)
    674676{
     
    721723int owl_editwin_at_beginning_of_line(owl_editwin *e) /*noproto*/
    722724{
    723   _owl_editwin_excursion x;
     725  oe_excursion x;
    724726  int ret;
    725727
     
    727729    return 1;
    728730
    729   owl_editwin_save_excursion(e, &x);
     731  oe_save_excursion(e, &x);
    730732  owl_editwin_point_move(e, -1);
    731733  ret = (_owl_editwin_get_char_at_point(e) == '\n');
    732   owl_editwin_restore_excursion(e, &x);
     734  oe_restore_excursion(e, &x);
    733735
    734736  return ret;
     
    864866void owl_editwin_move_to_previousword(owl_editwin *e)
    865867{
    866   _owl_editwin_excursion x;
     868  oe_excursion x;
    867869  int beginning;
    868870  /* if in middle of word, beginning of word */
     
    874876    owl_editwin_move_if_in(e, -1, WHITESPACE); /* leaves us on the last
    875877                                                    character of the word */
    876     owl_editwin_save_excursion(e, &x);
     878    oe_save_excursion(e, &x);
    877879    /* are we at the beginning of a word? */
    878880    owl_editwin_point_move(e, -1);
    879881    beginning = owl_editwin_is_char_in(e, WHITESPACE);
    880     owl_editwin_restore_excursion(e, &x);
     882    oe_restore_excursion(e, &x);
    881883    if (beginning)
    882884      return;
    883885   } else {
    884886    /* in the middle of the word; */
    885     owl_editwin_save_excursion(e, &x);
     887    oe_save_excursion(e, &x);
    886888    owl_editwin_point_move(e, -1);
    887889    if (owl_editwin_is_char_in(e, WHITESPACE)) { /* we were at the beginning */
     
    889891      return;
    890892    } else {
    891       owl_editwin_restore_excursion(e, &x);
     893      oe_restore_excursion(e, &x);
    892894    }
    893895  }
     
    900902void owl_editwin_delete_nextword(owl_editwin *e)
    901903{
    902   _owl_editwin_excursion x;
     904  oe_excursion x;
    903905  int end;
    904906
    905   owl_editwin_save_excursion(e, &x);
     907  oe_save_excursion(e, &x);
    906908  owl_editwin_move_to_nextword(e);
    907909  end = e->index;
    908   owl_editwin_restore_excursion(e, &x);
     910  oe_restore_excursion(e, &x);
    909911  _owl_editwin_remove_bytes(e, end - e->index);
    910912}
     
    928930void owl_editwin_delete_to_endofline(owl_editwin *e)
    929931{
    930   _owl_editwin_excursion x;
     932  oe_excursion x;
    931933  int end;
    932934
    933   owl_editwin_save_excursion(e, &x);
     935  oe_save_excursion(e, &x);
    934936  owl_editwin_move_to_line_end(e);
    935937  end = e->index;
    936   owl_editwin_restore_excursion(e, &x);
     938  oe_restore_excursion(e, &x);
    937939  _owl_editwin_remove_bytes(e, end - e->index);
    938940}
     
    956958{
    957959#if 0 /* XXX */
    958   _owl_editwin_excursion x;
     960  oe_excursion x;
    959961  int i, save;
    960962
    961963  /* save our starting point */
    962   owl_editwin_save_excursion(e, &x);
     964  oe_save_excursion(e, &x);
    963965
    964966  save = e->index;
     
    10251027
    10261028  /* put cursor back at starting point */
    1027   owl_editwin_restore_excursion(e, &x);
     1029  oe_restore_excursion(e, &x);
    10281030#endif
    10291031}
Note: See TracChangeset for help on using the changeset viewer.