aboutsummaryrefslogtreecommitdiffstats
path: root/weechat
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-07-16 22:20:43 +0200
committerJohannes Löthberg <johannes@kyriasis.com>2015-08-06 13:12:51 +0200
commit3612dd366635d607d74ee449201dfd5874b80dbf (patch)
tree57491227a5232bb7af714ec9e27418280de7b8b9 /weechat
parent6dc558ed2071176bd8d099ba8e3eae37adcf266d (diff)
downloaddotfiles-3612dd366635d607d74ee449201dfd5874b80dbf.tar.xz
weechat: iset.pl: 3.7 -> 3.9
Diffstat (limited to 'weechat')
-rw-r--r--weechat/perl/iset.pl38
1 files changed, 27 insertions, 11 deletions
diff --git a/weechat/perl/iset.pl b/weechat/perl/iset.pl
index 0a4f8b5..af74767 100644
--- a/weechat/perl/iset.pl
+++ b/weechat/perl/iset.pl
@@ -19,6 +19,10 @@
#
# History:
#
+# 2015-05-16, Sebastien Helleu <flashcode@flashtux.org>:
+# version 3.9: fix cursor position when editing an option with WeeChat >= 1.2
+# 2015-05-02, arza <arza@arza.us>:
+# version 3.8: don't append "null" to /set when setting an undefined setting
# 2015-05-01, nils_2 <weechatter@arcor.de>:
# version 3.7: fix two perl warnings (reported by t3chguy)
# 2014-09-30, arza <arza@arza.us>:
@@ -119,7 +123,7 @@
use strict;
my $PRGNAME = "iset";
-my $VERSION = "3.7";
+my $VERSION = "3.9";
my $DESCR = "Interactive Set for configuration options";
my $AUTHOR = "Sebastien Helleu <flashcode\@flashtux.org>";
my $LICENSE = "GPL3";
@@ -982,22 +986,34 @@ sub iset_cmd_cb
my $value = $options_values[$current_line];
if ($options_is_null[$current_line])
{
- $value = "null";
+ $value = "";
}
else
{
$quote = "\"" if ($options_types[$current_line] eq "string");
}
+ $value = " ".$quote.$value.$quote if ($value ne "" or $quote ne "");
+
my $set_command = "/set";
- $set_command = "/mute " . $set_command if (weechat::config_boolean($options_iset{"use_mute"}) == 1);
-
- weechat::buffer_set($iset_buffer, "input", $set_command." ".$options_names[$current_line]." ".$quote.$value.$quote);
- weechat::command($iset_buffer, "/input move_beginning_of_line");
- weechat::command($iset_buffer, "/input move_next_word");
- weechat::command($iset_buffer, "/input move_next_word");
- weechat::command($iset_buffer, "/input move_next_word") if (weechat::config_boolean($options_iset{"use_mute"}) == 1);
- weechat::command($iset_buffer, "/input move_next_char");
- weechat::command($iset_buffer, "/input move_next_char") if ($quote ne "");
+ my $start_index = 5;
+ if (weechat::config_boolean($options_iset{"use_mute"}) == 1)
+ {
+ $set_command = "/mute ".$set_command;
+ $start_index += 11;
+ }
+ $set_command = $set_command." ".$options_names[$current_line].$value;
+ my $pos_space = index($set_command, " ", $start_index);
+ if ($pos_space < 0)
+ {
+ $pos_space = 9999;
+ }
+ else
+ {
+ $pos_space = $pos_space + 1;
+ $pos_space = $pos_space + 1 if ($quote ne "");
+ }
+ weechat::buffer_set($iset_buffer, "input", $set_command);
+ weechat::buffer_set($iset_buffer, "input_pos", "".$pos_space);
}
}
weechat::bar_item_update("isetbar_help") if (weechat::config_boolean($options_iset{"show_help_bar"}) == 1);