Changeset 77f605d for editwin.c


Ignore:
Timestamp:
Jul 11, 2009, 1:14:35 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:
2fc8397
Parents:
3e36085
git-author:
Karl Ramm <kcr@1ts.org> (06/15/09 11:56:08)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:35)
Message:
Slightly more rope that you require for completion.

New owl_editwin_text_{before,after}_point, exported to perl.  Also,
export owl_editwin_replace and owl_editwin_point_move.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r3e36085 r77f605d  
    5656static int owl_editwin_is_char_in(owl_editwin *e, char *set);
    5757static gunichar owl_editwin_get_char_at_point(owl_editwin *e);
    58 static int owl_editwin_replace(owl_editwin *e, int count, char *s);
    5958static char *oe_copy_buf(owl_editwin *e, char *buf, int len);
    6059static int oe_copy_region(owl_editwin *e);
    6160static int oe_display_column(owl_editwin *e);
     61static char *oe_chunk(owl_editwin *e, int start, int end);
    6262
    6363#define INCR 4096
     
    565565
    566566/* replace count characters at the point with s, returning the change in size */
    567 static int owl_editwin_replace(owl_editwin *e, int replace, char *s)
     567int owl_editwin_replace(owl_editwin *e, int replace, char *s)
    568568{
    569569  int start, end, i, free, need, size, change;
     
    12601260}
    12611261
    1262 int owl_editwin_get_echochar(owl_editwin *e) {
     1262int owl_editwin_get_echochar(owl_editwin *e)
     1263{
    12631264  return e->echochar;
    12641265}
     1266
     1267static char *oe_chunk(owl_editwin *e, int start, int end)
     1268{
     1269  char *p;
     1270 
     1271  p = owl_malloc(end - start + 1);
     1272  memcpy(p, e->buff + start, end - start);
     1273  p[end - start] = 0;
     1274
     1275  return p;
     1276}
     1277
     1278char *owl_editwin_text_before_point(owl_editwin *e)
     1279{
     1280  return oe_chunk(e, e->index < e->lock ? 0 : e->lock, e->index);
     1281}
     1282
     1283char *owl_editwin_text_after_point(owl_editwin *e)
     1284{
     1285  return oe_chunk(e, e->index, e->bufflen);
     1286}
     1287
    12651288
    12661289
Note: See TracChangeset for help on using the changeset viewer.