diff options
| author | Teddy Wing | 2017-12-15 21:51:24 +0100 |
|---|---|---|
| committer | Teddy Wing | 2017-12-15 21:51:24 +0100 |
| commit | e26b8d26ebfe24cee1ef9f301d3f426ca510f035 (patch) | |
| tree | 8a0d25f92f9513046fe4b912f4b921220aa048e9 | |
| parent | 597272ba275406e6ae8e02af1065637eee53c32d (diff) | |
| download | irssi-vimput-e26b8d26ebfe24cee1ef9f301d3f426ca510f035.tar.bz2 | |
Write input contents on key press
Now instead of printing the current input to the Irssi window, write it
to a script-specific file.
The filename is inspired by Git. I figure we'll probably want to remove
the file when we're done with it. Debated between creating a real temp
file and using this one. We'll decide that later.
| -rw-r--r-- | vimput.pl | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -12,8 +12,24 @@ our %IRSSI = { }; +# The location of the temporary file where prompt contents are written. +sub tempfile { + Irssi::get_irssi_dir() . '/VIMPUT_MSG'; +} + + +# Write the given string to our tempfile. +sub write_input { + my ($message) = @_; + + open my $handle, '>', tempfile or die $!; + print $handle $message; + close $handle; +} + + Irssi::signal_add_last 'gui key pressed' => sub { my ($key) = @_; - print Irssi::parse_special('$L', undef, 0); + write_input(Irssi::parse_special('$L', undef, 0)); }; |
