Changeset 19a023f


Ignore:
Timestamp:
Jul 11, 2009, 1:14:36 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:
0190c4d
Parents:
2fc8397
git-author:
Nelson Elhage <nelhage@mit.edu> (07/06/09 20:42:13)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:36)
Message:
Refactor owl_editwin_replace to allow more internal uses.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r2fc8397 r19a023f  
    5656static int owl_editwin_is_char_in(owl_editwin *e, char *set);
    5757static gunichar owl_editwin_get_char_at_point(owl_editwin *e);
     58static int owl_editwin_replace_internal(owl_editwin *e, int replace, char *s);
    5859static char *oe_copy_buf(owl_editwin *e, char *buf, int len);
    5960static int oe_copy_region(owl_editwin *e);
     
    564565}
    565566
    566 /* replace count characters at the point with s, returning the change in size */
     567/* replace 'replace' characters at the point with s, returning the change in size */
    567568int owl_editwin_replace(owl_editwin *e, int replace, char *s)
    568569{
    569   int start, end, i, free, need, size, change;
     570  int start, end, i;
    570571  char *p;
    571   oe_excursion *x;
    572572
    573573  if (!g_utf8_validate(s, -1, NULL)) {
     
    583583  else
    584584    end = e->bufflen;
     585
     586  return owl_editwin_replace_internal(e, end - start, s);
     587}
     588
     589static int owl_editwin_replace_internal(owl_editwin *e, int replace, char *s)
     590{
     591  int start, end, free, need, size, change;
     592  oe_excursion *x;
     593  char *p;
     594
     595  start = e->index;
     596  end   = start + replace;
    585597
    586598  free = e->allocated - e->bufflen + end - start;
Note: See TracChangeset for help on using the changeset viewer.