diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-13 00:53:58 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-07-13 00:53:58 +0300 |
commit | 8c6de6cc718debf44f6056a4c34c4fbb13bc5020 (patch) | |
tree | a522cb6d5608b3a4ba08fdb8a3f840514eb07281 /src/qreg.h | |
parent | 078c1927cffc6514168566c267151a8d6eca7367 (diff) | |
download | sciteco-8c6de6cc718debf44f6056a4c34c4fbb13bc5020.tar.gz |
allow changing the default clipboard by setting the `~` integer
* It continues to default to 67 (C), which is the system clipboard.
But you can now overwrite it e.g. by adding `^^PU~` to the profile.
* This fixes a minor memory leak:
If you set one of the clipboard registers in the profile (initializing
them as plain registers), the clipboard register had been leaked.
The clipboard registers now replace any existing register,
while at the same time preserving the numeric part.
* All remaining Q-Reg table insertions use a new function
teco_qreg_table_insert_unique() which adds an assertion, so that
we notice any future possible memory leaks.
Diffstat (limited to 'src/qreg.h')
-rw-r--r-- | src/qreg.h | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -156,7 +156,13 @@ struct teco_qreg_table_t { void teco_qreg_table_init(teco_qreg_table_t *table, gboolean must_undo); void teco_qreg_table_init_locals(teco_qreg_table_t *table, gboolean must_undo); -/** @memberof teco_qreg_table_t */ +/** + * Insert Q-Register into table. + * + * @return If non-NULL a register with the same name as qreg already + * existed in table. In this case qreg is __not__ automatically freed. + * @memberof teco_qreg_table_t + */ static inline teco_qreg_t * teco_qreg_table_insert(teco_qreg_table_t *table, teco_qreg_t *qreg) { @@ -165,6 +171,17 @@ teco_qreg_table_insert(teco_qreg_table_t *table, teco_qreg_t *qreg) } /** @memberof teco_qreg_table_t */ +static inline void +teco_qreg_table_insert_unique(teco_qreg_table_t *table, teco_qreg_t *qreg) +{ + G_GNUC_UNUSED teco_qreg_t *found = teco_qreg_table_insert(table, qreg); + g_assert(found == NULL); +} + +gboolean teco_qreg_table_replace(teco_qreg_table_t *table, teco_qreg_t *qreg, + gboolean inherit_int, GError **error); + +/** @memberof teco_qreg_table_t */ static inline teco_qreg_t * teco_qreg_table_find(teco_qreg_table_t *table, const gchar *name, gsize len) { |