Changeset 77d4402 for editwin.c


Ignore:
Timestamp:
Jul 11, 2009, 1:14:33 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:
2021bea
Parents:
b5ef65c
git-author:
Karl Ramm <kcr@1ts.org> (06/09/09 11:29:42)
git-committer:
Nelson Elhage <nelhage@mit.edu> (07/11/09 13:14:33)
Message:
cursor location improved; other behavior
The cursor locater now handles wrapped lines /better/ but still messes up
 when the line is the width of the screen and the cursor is at the end
 (so it should be a the beginning of a blank screen line)
C-a set the goal column
kill-to-end-of-line will eat a final newline and thus join.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    rb5ef65c r77d4402  
    312312  char *p;
    313313
    314     /* are we at the point already? */
     314  while(1) {
     315    /* note the position of the dot */
    315316    if (x != NULL && index == e->index)
    316317      *x = width;
    317   while(1) {
     318
    318319    /* get the current character */
    319320    c = g_utf8_get_char(e->buff + index);
     
    327328        cw = 0;
    328329
    329     if (width + cw > e->wincols)
     330    if (width + cw > e->wincols) {
     331      if (x != NULL && *x == width)
     332        *x = -1;
    330333      break;
     334    }
    331335    width += cw;
    332336
    333337    if (c == '\n') {
    334       ++index; /* skip the newline */
     338      if (width < e->wincols)
     339        ++index; /* skip the newline */
    335340      break;
    336341    }
     
    345350    index = p - e->buff;
    346351
    347     /* note the position of the dot */
    348     if (x != NULL && index == e->index)
    349       *x = width;
    350352  }
    351353  return index;
     
    394396{
    395397  int x = -1, y = -1, t;
    396   int line, index, lineindex;
     398  int line, index, lineindex, times = 0;
    397399
    398400  do {
     
    418420    if (x == -1)
    419421        e->topindex = -1; /* force a reframe */
    420   } while(x == -1);
     422    times++;
     423  } while(x == -1 && times < 3);
    421424
    422425  wmove(e->curswin, y, x);
     
    819822      distance += owl_editwin_point_move(e, 1);
    820823  }
     824  e->goal_column = 0; /* subtleties */
    821825
    822826  return distance;
     
    974978  end = e->index;
    975979  oe_restore_excursion(e, &x);
    976   _owl_editwin_remove_bytes(e, end - e->index);
     980  if (end - e->index)
     981    _owl_editwin_remove_bytes(e, end - e->index);
     982  else if (end < e->bufflen)
     983    _owl_editwin_remove_bytes(e, 1);
    977984}
    978985
Note: See TracChangeset for help on using the changeset viewer.