Changeset a88f35a for editwin.c


Ignore:
Timestamp:
Jul 11, 2009, 1:14:36 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:
cf26b72
Parents:
0190c4d
git-author:
Nelson Elhage <nelhage@mit.edu> (06/20/09 23:45:56)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:36)
Message:
Give perl code more rope with respect to the editwin.

In particular, implement save_excursion and replace_region.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r19a023f ra88f35a  
    99#define VALID_EXCURSION (0x9a2b4729)
    1010
    11 typedef struct oe_excursion_struct { /*noproto*/
     11typedef struct _owl_editwin_excursion { /*noproto*/
    1212  int valid;
    1313  int index;
     
    1515  int goal_column;
    1616  int lock;
    17   struct oe_excursion_struct *next;
     17  struct _owl_editwin_excursion *next;
    1818} oe_excursion;
    1919
     
    365365    oe_release_excursion(e, x);
    366366  }
     367}
     368
     369/* External interface to oe_save_excursion */
     370owl_editwin_excursion *owl_editwin_begin_excursion(owl_editwin *e)
     371{
     372  owl_editwin_excursion *x = owl_malloc(sizeof *x);
     373  oe_save_excursion(e, x);
     374  return x;
     375}
     376
     377void owl_editwin_end_excursion(owl_editwin *e, owl_editwin_excursion *x)
     378{
     379  oe_restore_excursion(e, x);
     380  owl_free(x);
    367381}
    368382
     
    565579}
    566580
     581int owl_editwin_replace_region(owl_editwin *e, char *s)
     582{
     583  oe_excursion x;
     584  oe_save_excursion(e, &x);
     585  int ret;
     586
     587  if(e->index > e->mark) {
     588    owl_editwin_exchange_point_and_mark(e);
     589  }
     590
     591  ret = owl_editwin_replace_internal(e, e->mark - e->index, s);
     592
     593  oe_restore_excursion(e, &x);
     594
     595  return ret;
     596}
     597
    567598/* replace 'replace' characters at the point with s, returning the change in size */
    568599int owl_editwin_replace(owl_editwin *e, int replace, char *s)
Note: See TracChangeset for help on using the changeset viewer.