Add support for copy/paste registers
This adds support for vim-style copy/paste registers which allows
cutting and copying multiple items without having to overwrite the
copy/paste buffer. Registers can be specified using the quote key ('"').
To access a register, type '"x' before a command where "x" is the name
of a register. If you want to copy the currently selected item into
register 1, type '"1c'.
Valid registers are 0-9, a-z, "-" and "_". Note that the latter is the
so-called black hole register, which works similar to the black hole
register in vim.
The register prefix key is currently hardcoded and cannot be configured.
Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
struct day_items_nb inday;
|
||||
int no_data_file = 1;
|
||||
int count;
|
||||
int count, reg;
|
||||
|
||||
#if ENABLE_NLS
|
||||
setlocale(LC_ALL, "");
|
||||
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
|
||||
wins_reset();
|
||||
}
|
||||
|
||||
key = keys_getch(win[STA].p, &count);
|
||||
key = keys_getch(win[STA].p, &count, ®);
|
||||
switch (key) {
|
||||
case KEY_GENERIC_REDRAW:
|
||||
resize = 1;
|
||||
@@ -286,7 +286,7 @@ int main(int argc, char **argv)
|
||||
|
||||
case KEY_GENERIC_CUT:
|
||||
if (wins_slctd() == APP && apoint_hilt() != 0) {
|
||||
interact_day_item_cut(&inday.nb_events, &inday.nb_apoints);
|
||||
interact_day_item_cut(&inday.nb_events, &inday.nb_apoints, reg);
|
||||
inday = do_storage(0);
|
||||
wins_update(FLAG_CAL | FLAG_APP);
|
||||
}
|
||||
@@ -294,7 +294,7 @@ int main(int argc, char **argv)
|
||||
|
||||
case KEY_GENERIC_COPY:
|
||||
if (wins_slctd() == APP && apoint_hilt() != 0) {
|
||||
interact_day_item_copy(&inday.nb_events, &inday.nb_apoints);
|
||||
interact_day_item_copy(&inday.nb_events, &inday.nb_apoints, reg);
|
||||
inday = do_storage(0);
|
||||
wins_update(FLAG_CAL | FLAG_APP);
|
||||
}
|
||||
@@ -302,7 +302,7 @@ int main(int argc, char **argv)
|
||||
|
||||
case KEY_GENERIC_PASTE:
|
||||
if (wins_slctd() == APP) {
|
||||
interact_day_item_paste(&inday.nb_events, &inday.nb_apoints);
|
||||
interact_day_item_paste(&inday.nb_events, &inday.nb_apoints, reg);
|
||||
inday = do_storage(0);
|
||||
wins_update(FLAG_CAL | FLAG_APP);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user