mirror of https://github.com/MidnightCommander/mc
Merge branch '3867_mcedit_c_macro'
* 3867_mcedit_c_macro: Ticket #3867: mceditor: add %c (cursor offset from BOF) support for macros.
This commit is contained in:
commit
98294fc1e6
|
@ -2828,6 +2828,15 @@ edit_move_forward3 (const WEdit * edit, off_t current, long cols, off_t upto)
|
|||
return (off_t) col;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/** returns the current offset of the cursor from the beginning of a file */
|
||||
|
||||
off_t
|
||||
edit_get_cursor_offset (const WEdit * edit)
|
||||
{
|
||||
return edit->buffer.curs1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/** returns the current column position of the cursor */
|
||||
|
||||
|
|
|
@ -70,6 +70,7 @@ gboolean edit_file (const vfs_path_t * file_vpath, long line);
|
|||
gboolean edit_files (const GList * files);
|
||||
|
||||
const char *edit_get_file_name (const WEdit * edit);
|
||||
off_t edit_get_cursor_offset (const WEdit * edit);
|
||||
long edit_get_curs_col (const WEdit * edit);
|
||||
const char *edit_get_syntax_type (const WEdit * edit);
|
||||
|
||||
|
|
|
@ -808,6 +808,15 @@ expand_format (const WEdit * edit_widget, char c, gboolean do_quote)
|
|||
result = qstr;
|
||||
goto ret;
|
||||
}
|
||||
case 'c':
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
if (edit_widget != NULL)
|
||||
{
|
||||
result = g_strdup_printf ("%u", (unsigned int) edit_get_cursor_offset (edit_widget));
|
||||
goto ret;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 'i': /* indent equal number cursor position in line */
|
||||
#ifdef USE_INTERNAL_EDIT
|
||||
if (edit_widget != NULL)
|
||||
|
|
Loading…
Reference in New Issue