Changeset 9c3f334


Ignore:
Timestamp:
Sep 30, 2010, 8:07:17 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
ac6d4e4
Parents:
58a16cc
git-author:
David Benjamin <davidben@mit.edu> (09/29/10 14:18:35)
git-committer:
David Benjamin <davidben@mit.edu> (09/30/10 20:07:17)
Message:
cursorx in oe_insert_char is a lie

There's even a comment to that effect. Use owl_editwin_current_column
instead. This fixes the previously checked-in unit test.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r52172cc r9c3f334  
    2727  int goal_column;
    2828  int topindex;
    29   int cursorx;
    3029  int winlines, wincols, fillcol, wrapcol;
    3130  owl_window *win;
     
    101100  if (index != e->index) {
    102101    e->goal_column = -1;
    103     e->cursorx = -1;
    104102  }
    105103  e->index = index;
     
    135133  e->killbuf = NULL;
    136134  e->goal_column = -1;
    137   e->cursorx = -1;
    138135  e->topindex = 0;
    139136  e->excursions = NULL;
     
    591588
    592589  wmove(curswin, y, x);
    593   e->cursorx = x;
    594590}
    595591
     
    12961292  char tmp[7];
    12971293  int replaced = -1;
     1294  int column;
    12981295
    12991296  if (c == '\r') /* translate CRs to NLs */
     
    13051302    }
    13061303
    1307     if (e->wrapcol > 0 && e->cursorx != -1 &&
    1308         e->cursorx + oe_char_width(c, e->cursorx) > e->wrapcol) {
     1304    column = owl_editwin_current_column(e);
     1305    if (e->wrapcol > 0 && column != -1 &&
     1306        column + oe_char_width(c, column) > e->wrapcol) {
    13091307      /* XXX this is actually wrong:
    1310        * + If the line has been been wrapped, we can be past the wrap column but
    1311        *   e->cursorx be much smaller.
    13121308       * + If the user went back and inserted a bunch of stuff in the middle of
    13131309       *   the line, there may be more than one word past the wrap column.
Note: See TracChangeset for help on using the changeset viewer.