Ticket #2081: mc-4.7.0.3-edit-overwrite-utf8.patch

File mc-4.7.0.3-edit-overwrite-utf8.patch, 687 bytes (added by egmont, 14 years ago)

a fix

  • src/editor/edit.c

    diff -ur mc-4.7.0.3.orig/src/editor/edit.c mc-4.7.0.3/src/editor/edit.c
    old new  
    26152615    /* An ordinary key press */ 
    26162616    if (char_for_insertion >= 0) { 
    26172617        if (edit->overwrite) { 
    2618             if (edit_get_byte (edit, edit->curs1) != '\n') 
     2618            /* If UTF-8, only remove a whole character when the first byte is inserted. */ 
     2619            if (edit_get_byte (edit, edit->curs1) != '\n' && 
     2620               (!edit->utf8 || (char_for_insertion & 0xC0) != 0x80)) 
    26192621                edit_delete (edit, 0); 
    26202622        } 
    26212623        if ( option_cursor_beyond_eol && edit->over_col > 0 )