Ticket #2372: 2372_fix.diff

File 2372_fix.diff, 1.7 KB (added by angel_il, 13 years ago)

fix

  • src/editor/edit-impl.h

    diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h
    index d6bb43a..0ea7b34 100644
    a b  
    7474 
    7575/* Configurable: log2 of the buffer size in bytes */ 
    7676#ifndef S_EDIT_BUF_SIZE 
    77 #define S_EDIT_BUF_SIZE 16 
     77#define S_EDIT_BUF_SIZE 3 
    7878#endif 
    7979 
    8080/* Size of the buffer */ 
     
    8888 * This number can be increased for systems with enough physical memory. 
    8989 */ 
    9090#ifndef MAXBUFF 
    91 #define MAXBUFF 1024 
     91#define MAXBUFF 91024 
    9292#endif 
    9393 
    9494/* Maximal length of file that can be opened */ 
  • src/editor/edit.c

    diff --git a/src/editor/edit.c b/src/editor/edit.c
    index 226151b..ddf96ab 100644
    a b edit_get_utf (WEdit * edit, long byte_index, int *char_width) 
    17581758    gunichar ch; 
    17591759    gchar *next_ch = NULL; 
    17601760    int width = 0; 
     1761    char buf[6 + 1]; 
    17611762 
    17621763    if (byte_index >= (edit->curs1 + edit->curs2) || byte_index < 0) 
    17631764    { 
    edit_get_utf (WEdit * edit, long byte_index, int *char_width) 
    17771778 
    17781779    if (res < 0) 
    17791780    { 
    1780         ch = *str; 
    1781         width = 0; 
     1781        int i; 
     1782 
     1783        for (i = 0; i < 6; i++) 
     1784            buf[i] = edit_get_byte (edit, byte_index + i); 
     1785 
     1786        buf[6] = '\0'; 
     1787 
     1788        res = g_utf8_get_char_validated ((char *) buf, -1); 
     1789        if (res < 0) 
     1790        { 
     1791            ch = *str; 
     1792            width = 0; 
     1793        } 
     1794        else 
     1795        { 
     1796            ch = res; 
     1797            next_ch = g_utf8_next_char ((char *) buf); 
     1798            if (next_ch) 
     1799            { 
     1800                width = next_ch - (char *) buf; 
     1801            } 
     1802            else 
     1803            { 
     1804                ch = 0; 
     1805                width = 0; 
     1806            } 
     1807        } 
    17821808    } 
    17831809    else 
    17841810    {