Ticket #3867: 0001-editor-add-c-cursor-offset-from-BOF-support-for-macr.patch

File 0001-editor-add-c-cursor-offset-from-BOF-support-for-macr.patch, 2.1 KB (added by sknaumov, 7 years ago)
  • src/editor/edit.c

    From b8f33769c090f9493e51023e7673c9f9c5df32d2 Mon Sep 17 00:00:00 2001
    From: Sergey Naumov <snaumov@quantenna.com>
    Date: Wed, 4 Oct 2017 11:56:43 +0300
    Subject: [PATCH] editor: add %c (cursor offset from BOF) support for macros
    
    ---
     src/editor/edit.c          | 9 +++++++++
     src/editor/edit.h          | 1 +
     src/filemanager/usermenu.c | 9 +++++++++
     3 files changed, 19 insertions(+)
    
    diff --git a/src/editor/edit.c b/src/editor/edit.c
    index eaab3c4..258307e 100644
    a b edit_move_forward3 (const WEdit * edit, off_t current, long cols, off_t upto) 
    28292829} 
    28302830 
    28312831/* --------------------------------------------------------------------------------------------- */ 
     2832/** returns the current offset of the cursor from the beginning of a file */ 
     2833 
     2834off_t 
     2835edit_get_curs_offt (const WEdit * edit) 
     2836{ 
     2837        return edit->buffer.curs1; 
     2838} 
     2839 
     2840/* --------------------------------------------------------------------------------------------- */ 
    28322841/** returns the current column position of the cursor */ 
    28332842 
    28342843long 
  • src/editor/edit.h

    diff --git a/src/editor/edit.h b/src/editor/edit.h
    index e02589f..b8b2e19 100644
    a b gboolean edit_file (const vfs_path_t * file_vpath, long line); 
    7070gboolean edit_files (const GList * files); 
    7171 
    7272const char *edit_get_file_name (const WEdit * edit); 
     73off_t edit_get_curs_offt (const WEdit * edit); 
    7374long edit_get_curs_col (const WEdit * edit); 
    7475const char *edit_get_syntax_type (const WEdit * edit); 
    7576 
  • src/filemanager/usermenu.c

    diff --git a/src/filemanager/usermenu.c b/src/filemanager/usermenu.c
    index e2b7c9d..7a75a7a 100644
    a b expand_format (const WEdit * edit_widget, char c, gboolean do_quote) 
    800800            result = qstr; 
    801801            goto ret; 
    802802        } 
     803    case 'c': 
     804#ifdef USE_INTERNAL_EDIT 
     805        if (edit_widget != NULL) 
     806        { 
     807                result = g_strdup_printf ("%u", (unsigned int)edit_get_curs_offt (edit_widget)); 
     808                goto ret; 
     809        } 
     810#endif 
     811        break; 
    803812    case 'i':                  /* indent equal number cursor position in line */ 
    804813#ifdef USE_INTERNAL_EDIT 
    805814        if (edit_widget != NULL)