Changeset d41294a for editwin.c


Ignore:
Timestamp:
Jul 11, 2009, 1:14:36 PM (14 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:
c6ecf5c
Parents:
cf26b72
git-author:
Nelson Elhage <nelhage@mit.edu> (06/21/09 01:08:14)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:36)
Message:
Export some more functions to perl.

get_region, combined with save_excursion, is a very convenient way for
perl to access a specified piece of the buffer.

In addition, provide methods to get information about the current
point and mark.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    ra88f35a rd41294a  
    5959static char *oe_copy_buf(owl_editwin *e, char *buf, int len);
    6060static int oe_copy_region(owl_editwin *e);
    61 static int oe_display_column(owl_editwin *e);
    6261static char *oe_chunk(owl_editwin *e, int start, int end);
    6362
     
    11131112}
    11141113
    1115 static int oe_display_column(owl_editwin *e)
     1114int owl_editwin_current_column(owl_editwin *e)
    11161115{
    11171116  oe_excursion x;
     
    11841183  while(e->index < e->mark) {
    11851184    /* if we've travelled too far, linewrap */
    1186     if (oe_display_column(e) >= e->fillcol)
     1185    if (owl_editwin_current_column(e) >= e->fillcol)
    11871186      _owl_editwin_linewrap_word(e);
    11881187    owl_editwin_point_move(e, 1);
     
    13231322}
    13241323
     1324char *owl_editwin_get_region(owl_editwin *e)
     1325{
     1326  int start, end;
     1327  start = e->index;
     1328  end   = e->mark;
     1329  if(start > end) {
     1330    int tmp = end;
     1331    end = start;
     1332    start = tmp;
     1333  }
     1334
     1335  return oe_chunk(e, start, end);
     1336}
     1337
    13251338int owl_editwin_get_echochar(owl_editwin *e)
    13261339{
     
    13471360{
    13481361  return oe_chunk(e, e->index, e->bufflen);
     1362}
     1363
     1364/*
     1365 * The only guarantee made about these values is that comparisons
     1366 * between them, as well as comparison between multiple calls to these
     1367 * functions without modifying the editwin in-between, are meaningful.
     1368 */
     1369
     1370int owl_editwin_get_point(owl_editwin *e)
     1371{
     1372  return e->index;
     1373}
     1374
     1375int owl_editwin_get_mark(owl_editwin *e)
     1376{
     1377  return e->mark;
    13491378}
    13501379
Note: See TracChangeset for help on using the changeset viewer.