Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow access to global command history when using a specifc history #762

Merged
merged 4 commits into from Nov 25, 2017

Conversation

@ailin-nemui
Copy link
Contributor

@ailin-nemui ailin-nemui commented Oct 5, 2017

also add history loading method

@ailin-nemui
Copy link
Contributor Author

@ailin-nemui ailin-nemui commented Oct 5, 2017

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

@ailin-nemui
Copy link
Contributor Author

@ailin-nemui ailin-nemui commented Oct 5, 2017

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) ] )
    }
}
#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

This comment has been minimized.

@dequis

dequis Oct 6, 2017
Member

Huh. Why?

This comment has been minimized.

@ailin-nemui

ailin-nemui Oct 6, 2017
Author Contributor

fixed

@dequis
Copy link
Member

@dequis dequis commented Oct 6, 2017

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.

@ailin-nemui ailin-nemui changed the title add global window history to irssi allow access to global command history when using a specifc history Oct 6, 2017
ailin-nemui added 4 commits Oct 6, 2017
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
@ailin-nemui ailin-nemui force-pushed the ailin-nemui:global-history branch from 82502c8 to 5da0b73 Oct 6, 2017
@ailin-nemui
Copy link
Contributor Author

@ailin-nemui ailin-nemui commented Oct 6, 2017

I renamed g_history to history_entries

@ailin-nemui ailin-nemui merged commit 3792bc9 into irssi:master Nov 25, 2017
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@ailin-nemui ailin-nemui deleted the ailin-nemui:global-history branch Nov 25, 2017
@ailin-nemui ailin-nemui added this to the 1.1.0 milestone Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.