Ticket #256: mc-4.7-pre2-backward-word-off-by-one.patch

File mc-4.7-pre2-backward-word-off-by-one.patch, 858 bytes (added by egmont, 15 years ago)

Fix for off-by-one error in mc 4.7-pre2.

  • src/widget.c

    diff -urpN mc-4.7.0-pre2.orig/src/widget.c mc-4.7.0-pre2/src/widget.c
    old new backward_word (WInput *in) 
    13951395        in->point--; 
    13961396    } 
    13971397     
    1398     while ((p != in->buffer) && (str_isspace (p) || str_ispunct (p))) { 
     1398    while (p != in->buffer) { 
    13991399        str_cprev_char (&p); 
     1400        if (!str_isspace (p) && !str_ispunct (p)) { 
     1401            str_cnext_char (&p); 
     1402            break; 
     1403        } 
    14001404        in->point--; 
    14011405    } 
    1402     while ((p != in->buffer) && !str_isspace (p) && !str_ispunct (p)) { 
     1406    while (p != in->buffer) { 
    14031407        str_cprev_char (&p); 
     1408        if (str_isspace (p) || str_ispunct (p)) { 
     1409            str_cnext_char (&p); 
     1410            break; 
     1411        } 
    14041412        in->point--; 
    14051413    } 
    14061414}