Changeset b2c1bd4


Ignore:
Timestamp:
Jan 17, 2008, 2:03:11 AM (17 years ago)
Author:
Alejandro R. Sedeño <asedeno@mit.edu>
Branches:
master, barnowl_perlaim, debian, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
81312e4
Parents:
84027015
Message:
editwin.c - fix a wrapping bug I introduced in the last revision.
It could leave us with a buffer that was not valid UTF-8
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r84027015 rb2c1bd4  
    368368    if (owl_util_can_break_after(c)) {
    369369      if (c != ' ') {
    370         _owl_editwin_set_xy_by_index(e, ptr1 - e->buff);
    371         owl_editwin_key_right(e);
     370        i = ptr1 - e->buff;
     371        _owl_editwin_set_xy_by_index(e, i);
     372        _owl_editwin_insert_bytes(e, 1);
    372373        /* _owl_editwin_insert_bytes may move e->buff. */
    373         i = ptr1 - e->buff;
    374         _owl_editwin_insert_bytes(e,1);
    375374        ptr1 = e->buff + i;
    376375      }
     
    10451044    /* if we've travelled too far, linewrap */
    10461045    if ((e->buffx) >= e->fillcol) {
     1046      int len = e->bufflen;
    10471047      _owl_editwin_linewrap_word(e);
     1048      /* we may have added a character. */
     1049      if (i < save) save += e->bufflen - len;
    10481050    }
    10491051
     
    10571059      e->buff[i]=' ';
    10581060    }
    1059    
     1061
    10601062    /* fix spacing */
    10611063    i = _owl_editwin_get_index_from_xy(e);
     
    10731075      owl_editwin_key_right(e);
    10741076    }
    1075 
    10761077  }
    10771078
Note: See TracChangeset for help on using the changeset viewer.