allow access to global command history when using a specifc history #762
Conversation
usage: ctrl+up/down this can come in handy if you use /window history named or /set window_history on, but want to recall something from one of the other windows' histories |
sample script for your autorun: use strict;
use warnings;
use YAML::Tiny;
my $histfile = Irssi::get_irssi_dir()."/history";
my ($hist) = eval { YAML::Tiny::LoadFile($histfile) };
if ($hist) {
Irssi::UI::Window::load_history_entries(undef, @$hist);
}
Irssi::signal_add 'gui exit' => sub {
if (Irssi::settings_get_bool('settings_autosave')) {
YAML::Tiny::DumpFile($histfile, [ Irssi::UI::Window::get_history_entries(undef) ] )
}
} |
src/fe-common/core/command-history.c
Outdated
#define history_list_last command_history_list_last | ||
#define history_list_first command_history_list_first | ||
#define history_list_prev command_history_list_prev | ||
#define history_list_next command_history_list_next |
dequis
Oct 6, 2017
Member
Huh. Why?
Huh. Why?
ailin-nemui
Oct 6, 2017
Author
Contributor
fixed
fixed
Good stuff. The commit log / PR title could use some more love. I mean, global window history is the default behavior, but being able to use global history while window history is enabled is a very good feature. Not sure I fully understand what g_history is supposed to hold. Leaving the job of persisting history to a perl script is a weird choice (not wrong, but not one i'd choose) but I guess you like perl, and more APIs don't hurt. It's a good example of adding more perl stuff, I guess. |
this allows access to the global history even when a using /window history named or /set window_history on, and you want to recall something from one of the other windows' histories. usage (default): ctrl+up/down
it is possible to use Irssi::UI::Window::get_history_entries to save the history entries, load_history_entries to load entries into the command history and delete_history_entries to remove history entries (for example to remove history selectively)
it is possible to delete the current history entry using the erase_history_entry key binding
I renamed g_history to history_entries |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
also add history loading method