Ticket #1629: mc-4.7-pre2-utf8-nroff-proof-of-concept.patch

File mc-4.7-pre2-utf8-nroff-proof-of-concept.patch, 1.2 KB (added by egmont, 15 years ago)

proof of concept only - not a ready patch

  • src/viewer/nroff.c

    diff -urdp mc-4.7.0-pre2.orig/src/viewer/nroff.c mc-4.7.0-pre2/src/viewer/nroff.c
    old new mcview_display_nroff (mcview_t * view) 
    103103 
    104104        if (c == '\b') { 
    105105            if (from > 1) { 
    106                 mcview_get_byte (view, from - 2, &c_prev); 
     106#ifdef HAVE_CHARSET 
     107                if (view->utf8) { 
     108                    c_next = mcview_get_utf (view, from, &cw, &read_res); 
     109                } else 
     110#endif 
    107111                mcview_get_byte (view, from, &c_next); 
    108112            } 
    109             if (g_ascii_isprint (c_prev) && g_ascii_isprint (c_prev) 
     113            if (g_unichar_isprint (c_prev) && g_unichar_isprint (c_prev) 
    110114                && (c_prev == c_next || c_prev == '_' || (c_prev == '+' && c_next == 'o'))) { 
    111115                if (col == 0) { 
    112116                    if (row == 0) { 
    mcview_display_nroff (mcview_t * view) 
    159163            tty_setcolor (SELECTED_COLOR); 
    160164        } 
    161165 
     166        c_prev = c; 
     167 
    162168        if (col >= view->dpy_text_column && col - view->dpy_text_column < width) { 
    163169            widget_move (view, top + row, left + (col - view->dpy_text_column)); 
    164170#ifdef HAVE_CHARSET