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/main.c | |
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/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -419,15 +419,20 @@ main(int argc, char **argv) * DEC TECO has them in the global table, though. */ /* search string and status register */ - teco_qreg_table_insert(&teco_qreg_table_globals, teco_qreg_plain_new("_", 1)); + teco_qreg_table_insert_unique(&teco_qreg_table_globals, + teco_qreg_plain_new("_", 1)); /* replacement string register */ - teco_qreg_table_insert(&teco_qreg_table_globals, teco_qreg_plain_new("-", 1)); + teco_qreg_table_insert_unique(&teco_qreg_table_globals, + teco_qreg_plain_new("-", 1)); /* current document's dot (":") */ - teco_qreg_table_insert(&teco_qreg_table_globals, teco_qreg_dot_new()); + teco_qreg_table_insert_unique(&teco_qreg_table_globals, + teco_qreg_dot_new()); /* current buffer name and number ("*") */ - teco_qreg_table_insert(&teco_qreg_table_globals, teco_qreg_bufferinfo_new()); + teco_qreg_table_insert_unique(&teco_qreg_table_globals, + teco_qreg_bufferinfo_new()); /* current working directory ("$") */ - teco_qreg_table_insert(&teco_qreg_table_globals, teco_qreg_workingdir_new()); + teco_qreg_table_insert_unique(&teco_qreg_table_globals, + teco_qreg_workingdir_new()); /* environment defaults and registers */ teco_initialize_environment(); @@ -513,7 +518,8 @@ main(int argc, char **argv) * If munged file didn't quit, switch into interactive mode */ /* commandline replacement string register */ - teco_qreg_table_insert(&teco_qreg_table_globals, teco_qreg_plain_new("\e", 1)); + teco_qreg_table_insert_unique(&teco_qreg_table_globals, + teco_qreg_plain_new("\e", 1)); teco_undo_enabled = TRUE; teco_ring_set_scintilla_undo(TRUE); |