From 8fbd0b3ff42ae10c3735801ad17f5345fdc77766 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 19 Sep 2024 03:05:15 +0200 Subject: "special" Q-Registers now support EQq/.../ (load) and E%q/.../ (save) commands * @EQ$/.../ sets the current directory from the contents of the given file. @E%$/.../ stores the currend directory in the given file. * @EQ*/.../ will fail, just like ^U*...$. @E%*/.../ stores the current buffer's name in the given file. * It's especially useful with the clipboard registers. There could still be a minor bug in @E%~/.../ with regard to EOL normalization as teco_view_save() will use the EOL style of the current document, which may not be the style of the Q-Reg contents. Conversions can generally be avoided for these particular commands. But without teco_view_save() we'd have to care about save point creation. --- src/qreg.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/qreg.h') diff --git a/src/qreg.h b/src/qreg.h index df4bdb4..85da898 100644 --- a/src/qreg.h +++ b/src/qreg.h @@ -72,6 +72,13 @@ typedef const struct { gboolean (*edit)(teco_qreg_t *qreg, GError **error); gboolean (*undo_edit)(teco_qreg_t *qreg, GError **error); + + /* + * Load and save already care about undo token + * creation. + */ + gboolean (*load)(teco_qreg_t *qreg, const gchar *filename, GError **error); + gboolean (*save)(teco_qreg_t *qreg, const gchar *filename, GError **error); } teco_qreg_vtable_t; /** @extends teco_rb3str_head_t */ @@ -113,13 +120,6 @@ gboolean teco_qreg_execute(teco_qreg_t *qreg, teco_qreg_table_t *qreg_table_loca void teco_qreg_undo_set_eol_mode(teco_qreg_t *qreg); void teco_qreg_set_eol_mode(teco_qreg_t *qreg, gint mode); -/* - * Load and save already care about undo token - * creation. - */ -gboolean teco_qreg_load(teco_qreg_t *qreg, const gchar *filename, GError **error); -gboolean teco_qreg_save(teco_qreg_t *qreg, const gchar *filename, GError **error); - /** @memberof teco_qreg_t */ static inline void teco_qreg_free(teco_qreg_t *qreg) -- cgit v1.2.3