diff options
| author | ailin-nemui | 2016-01-27 15:48:23 +0100 |
|---|---|---|
| committer | ailin-nemui | 2016-01-27 15:48:23 +0100 |
| commit | b0652ec6e4354c0bb0ee3f00d0e195a20a0ae139 (patch) | |
| tree | e2ef09caba53a22e11e5482b842769c3aa59960a /scripts | |
| parent | ad5d607116e270171a642edc5014770a82b2b48d (diff) | |
| parent | ffdbac98a6899c51798a8198bd5ff39f9c08b4da (diff) | |
| download | scripts.irssi.org-b0652ec6e4354c0bb0ee3f00d0e195a20a0ae139.tar.bz2 | |
Merge pull request #227 from mh-source/gh-pages
mh_hold_mode.pl v1.04
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/mh_hold_mode.pl | 69 |
1 files changed, 45 insertions, 24 deletions
diff --git a/scripts/mh_hold_mode.pl b/scripts/mh_hold_mode.pl index 03f6719..34ed99b 100644 --- a/scripts/mh_hold_mode.pl +++ b/scripts/mh_hold_mode.pl @@ -1,8 +1,8 @@ ############################################################################## # -# mh_hold_mode.pl v1.03 (20151226) +# mh_hold_mode.pl v1.04 (20160126) # -# Copyright (c) 2007, 2015 Michael Hansen +# Copyright (c) 2007, 2015, 2016 Michael Hansen # # Permission to use, copy, modify, and distribute this software # for any purpose with or without fee is hereby granted, provided @@ -28,6 +28,9 @@ # can remove the old item with '/statusbar window remove mh_more' and # follow the instructions below to add the new item # +# should you not like the new item look, you can revert it back to the +# old style with the setting mh_hold_mode_more_oldstyle +# # instructions: # # add the mh_sbmore statusbar item with '/statusbar window add -after window_empty mh_sbmore' @@ -63,7 +66,16 @@ # # (i hope i didn't forget anything :-) # +# settings: +# +# mh_hold_mode_more_oldstyle (default OFF): switch between old and new +# style more statusbar item +# # history: +# v1.04 (20160126) +# added mh_hold_mode_more_oldstyle and supporting code +# added namespace to MSGLEVEL +# code cleanup # v1.03 (20151226) # now using 'key send_line' instead of 'gui key pressed' # added /help @@ -98,7 +110,7 @@ use strict; use Irssi 20100403; use Irssi::TextUI; -our $VERSION = '1.03'; +our $VERSION = '1.04'; our %IRSSI = ( 'name' => 'mh_hold_mode', @@ -107,7 +119,7 @@ our %IRSSI = 'authors' => 'Michael Hansen', 'contact' => 'mh on IRCnet #help', 'url' => 'http://scripts.irssi.org / https://github.com/mh-source/irssi-scripts', - 'changed' => 'Sat Dec 26 11:50:57 CET 2015', + 'changed' => 'Tue Jan 26 18:55:23 CET 2016', ); ############################################################################## @@ -131,19 +143,19 @@ our $more = 0; sub trim_space { - my ($string) = @_; - - if (defined($string)) - { - $string =~ s/^\s+//g; - $string =~ s/\s+$//g; + my ($string) = @_; - } else { + if (defined($string)) + { + $string =~ s/^\s+//g; + $string =~ s/\s+$//g; - $string = ''; - } + } else + { + $string = ''; + } - return($string); + return($string); } ############################################################################## @@ -247,8 +259,8 @@ sub window_scroll { $windowrec->view()->set_bookmark_bottom('mh_hold_mode'); - } else { - + } else + { $windowrec->view()->set_bookmark('mh_hold_mode', $windowrec->view()->{'startline'}); } } @@ -294,8 +306,8 @@ sub signal_key_send_line_last window_refresh(); } - } else { - + } else + { window_refresh(); } } @@ -350,8 +362,8 @@ sub command_hold_mode { $window->{'hold_mode'} = 1; - } else { - + } else + { $window->{'hold_mode'} = 0; } @@ -396,14 +408,14 @@ sub command_hold_mode } } - $windowrec->print('hold_mode (' . (($window->{'hold_mode'}) ? 'on' : 'off' ) . '): scroll_always is ' . (($window->{'scroll_always'}) ? 'on' : 'off' ), MSGLEVEL_CLIENTCRAP); + $windowrec->print('hold_mode (' . (($window->{'hold_mode'}) ? 'on' : 'off' ) . '): scroll_always is ' . (($window->{'scroll_always'}) ? 'on' : 'off' ), Irssi::MSGLEVEL_CLIENTCRAP); } } } if ($showstatus) { - $windowrec->print('hold_mode is ' . (($window->{'hold_mode'}) ? 'on' : 'off' ), MSGLEVEL_CLIENTCRAP); + $windowrec->print('hold_mode is ' . (($window->{'hold_mode'}) ? 'on' : 'off' ), Irssi::MSGLEVEL_CLIENTCRAP); } } @@ -445,10 +457,17 @@ sub statusbar_more if ($more) { - $statusbaritem->default_handler($get_size_only, "{sb $more more}", '', 0); + my $format = "{sb $more more}"; - } else { + if (Irssi::settings_get_bool('mh_hold_mode_more_oldstyle')) + { + $format = "-- $more more --"; + } + + $statusbaritem->default_handler($get_size_only, $format, '', 0); + } else + { $statusbaritem->default_handler($get_size_only, '', '', 0); } } @@ -459,6 +478,8 @@ sub statusbar_more # ############################################################################## +Irssi::settings_add_bool('mh_hold_mode', 'mh_hold_mode_more_oldstyle', 0); + Irssi::command('^SET SCROLL ON'); Irssi::signal_add_last('window created', 'config_window_get'); |
