aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2017-12-17 00:50:21 +0100
committerTeddy Wing2017-12-17 00:50:21 +0100
commit92dc1fd0afa742d2a2002461f0a2d1d7db6d24a0 (patch)
tree6584ef3f7b22219d61c6dd2eda9da530a8d6f4a9
parentdee27d5ae7f3c56c3eff00c8b09a28b9e44516f9 (diff)
downloadirssi-vimput-92dc1fd0afa742d2a2002461f0a2d1d7db6d24a0.tar.bz2
Add documentation comments
-rw-r--r--vimput.pl10
1 files changed, 10 insertions, 0 deletions
diff --git a/vimput.pl b/vimput.pl
index c0614b2..48fa201 100644
--- a/vimput.pl
+++ b/vimput.pl
@@ -58,6 +58,9 @@ sub open_tmux_split {
}
+# Forks a child process and opens a pipe for the child to communicate with
+# the parent. In the child process, open a Tmux split, create a FIFO pipe,
+# and send the contents of the FIFO to the parent.
sub open_tmux_and_update_input_line_when_finished {
return if $forked;
@@ -90,6 +93,7 @@ sub open_tmux_and_update_input_line_when_finished {
POSIX::_exit(1);
};
+ # The input line will be sent from Vim on this FIFO.
mkfifo($fifo_path, 0600) or do {
print $write_handle ERROR_PREFIX . "Failed to make FIFO: $!";
@@ -134,6 +138,9 @@ sub open_tmux_and_update_input_line_when_finished {
}
+# Read messages in the parent process from the child over a pipe. Print error
+# messages to the Irssi window. An OK message will be used to replace the
+# current input line.
sub pipe_input {
my ($args) = @_;
my ($read_handle, $pipe_tag) = @$args;
@@ -159,6 +166,7 @@ sub pipe_input {
}
+# Test whether `$pid` is a child process.
sub is_child_fork {
my ($pid) = @_;
@@ -166,6 +174,7 @@ sub is_child_fork {
}
+# Test whether `$string` starts with `ERROR_PREFIX`.
sub is_error_message {
my ($string) = @_;
@@ -173,6 +182,7 @@ sub is_error_message {
}
+# Test whether `$string` starts with `OK_PREFIX`.
sub is_ok_message {
my ($string) = @_;