Changeset e9bb404


Ignore:
Timestamp:
Aug 20, 2008, 2:16:30 AM (13 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, debian, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
5987370
Parents:
0504f63
Message:
editwin.c: Don't make owl_editwin_insert_char increase e->bufflen twice

This seems to fix at least some cases of the editwin becoming confused
and causing text entry to not work quite right (often manifesting as a
trailing '.' on a line by itself not sending a zephyr)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r2d4ff14 re9bb404  
    330330{
    331331  int i, z;
    332  
     332
    333333  if ((e->bufflen + n) > (e->allocated - 5)) {
    334334    _owl_editwin_addspace(e);
    335335  }
    336336
     337  z = _owl_editwin_get_index_from_xy(e);
     338
     339  if(z != e->bufflen) {
     340    for (i = e->bufflen + n - 1; i > z; i--) {
     341      e->buff[i] = e->buff[i - n];
     342    }
     343  }
     344
    337345  e->bufflen += n;
    338346  e->buff[e->bufflen] = '\0';
    339  
    340   z = _owl_editwin_get_index_from_xy(e);
    341   for (i = e->bufflen - 1; i > z; i--) {
    342     e->buff[i] = e->buff[i - n];
    343   }
     347
    344348}
    345349
     
    426430
    427431  /* shift all the other characters right */
    428   if (z != e->bufflen) {
    429     _owl_editwin_insert_bytes(e, len);
    430   }
     432  _owl_editwin_insert_bytes(e, len);
    431433
    432434  /* insert the new character */
     
    435437  }
    436438
    437   /* housekeeping */
    438   e->bufflen += len;
    439   e->buff[e->bufflen] = '\0';
    440  
    441439  /* advance the cursor */
    442440  z += len;
Note: See TracChangeset for help on using the changeset viewer.