aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2016-09-17 06:48:34 -0400
committerTeddy Wing2016-09-17 06:48:34 -0400
commit586fabf96c50c5aa8e6811dab136b8d7d0318054 (patch)
treebab36dc005cc1f52f3d36a11eb8215ceeb5e7d05
parent4f17970533cfea1e6e8d0e2f2d63b64b9433ae2b (diff)
downloadirssi-slack-profile-586fabf96c50c5aa8e6811dab136b8d7d0318054.tar.bz2
complete_profile_field: Fill in rest of field name
Previously we would replace the argument with the completion regardless of what the user typed. With this change, if they started to type one of the available fields (e.g. `/slack_profile_set ph<TAB>`), then the argument will complete with the rest of the field name.
-rw-r--r--slack_profile.pl13
1 files changed, 12 insertions, 1 deletions
diff --git a/slack_profile.pl b/slack_profile.pl
index f240b3f..80e2501 100644
--- a/slack_profile.pl
+++ b/slack_profile.pl
@@ -172,7 +172,18 @@ sub complete_profile_field {
return unless $linestart =~ /^\Q${slash}\Eslack_profile_set\b/i;
- @$complist = qw(first_name last_name email phone skype title);
+ my @profile_fields = qw(first_name last_name email phone skype title);
+
+ if ($word ne '') {
+ for my $field (@profile_fields) {
+ if ($field =~ /^\Q${word}\E/i) {
+ push @$complist, $field;
+ }
+ }
+ }
+ else {
+ @$complist = @profile_fields;
+ }
Irssi::signal_stop();
}