Ticket #319: place_curs2.diff

File place_curs2.diff, 2.4 KB (added by vit_r, 15 years ago)

my kate/kde seems, acts like all others editors of Slack 12.2, so this is a try to clarify direction. ps.: Sorry for my broken en. Vit

  • ChangeLog

    diff -urN edit_PREV/ChangeLog edit/ChangeLog
    old new  
     12009-03-29  Vit Rosin   <vit_r@list.ru> 
     2        * edit.c (edit_insert_file): When chars are inserted place cursor after 
     3         inserted chars. If next key press is <Down-arrow>,- move cursor to the insert-start clmn. 
     4         Its _NOT_ patch yet, - to try and discuss only. 
    152007-11-02  Vladimir Nadvornik  <nadvornik@suse.cz> 
    26 
    37        * editlock.c (lock_build_name): Check the return value of getpwuid(). 
  • edit.c

    diff -urN edit_PREV/edit.c edit/edit.c
    old new  
    7070int option_edit_left_extreme = 0; 
    7171int option_edit_top_extreme = 0; 
    7272int option_edit_bottom_extreme = 0; 
     73static long flow_insert_col = -1; 
     74 
    7375 
    7476const char *option_whole_chars_search = "0123456789abcdefghijklmnopqrstuvwxyz_"; 
    7577char *option_backup_ext = NULL; 
     
    267268    char *p; 
    268269    if ((p = edit_get_filter (filename))) { 
    269270        FILE *f; 
    270         long current = edit->curs1; 
     271        flow_insert_col = edit->curs_col; 
    271272        f = (FILE *) popen (p, "r"); 
    272273        if (f) { 
    273274            edit_insert_stream (edit, f); 
    274             edit_cursor_move (edit, current - edit->curs1); 
    275275            if (pclose (f) > 0) { 
    276276                GString *errmsg = g_string_new (NULL); 
    277277                g_string_sprintf (errmsg, _(" Error reading from pipe: %s "), p); 
     
    291291        g_free (p); 
    292292    } else { 
    293293        int i, file, blocklen; 
    294         long current = edit->curs1; 
     294        flow_insert_col = edit->curs_col; 
    295295        unsigned char *buf; 
    296296        if ((file = mc_open (filename, O_RDONLY | O_BINARY)) == -1) 
    297297            return 0; 
     
    300300            for (i = 0; i < blocklen; i++) 
    301301                edit_insert (edit, buf[i]); 
    302302        } 
    303         edit_cursor_move (edit, current - edit->curs1); 
    304303        g_free (buf); 
    305304        mc_close (file); 
    306305        if (blocklen) 
     
    21252124        edit_push_key_press (edit); 
    21262125 
    21272126    edit_execute_cmd (edit, command, char_for_insertion); 
     2127    if (CK_Down == command) { 
     2128        if (flow_insert_col >= 0) { 
     2129            edit->force |= REDRAW_COMPLETELY; 
     2130            edit_update_screen (edit); 
     2131            if (edit->curs_col > flow_insert_col)  
     2132                edit_cursor_move (edit, flow_insert_col - edit->curs_col); 
     2133        } 
     2134    } else if (CK_XPaste != command) { 
     2135        flow_insert_col = -1; 
     2136    } 
    21282137    if (column_highlighting) 
    21292138        edit->force |= REDRAW_PAGE; 
    21302139}