diff options
author | gregor herrmann <gregoa@debian.org> | 2022-12-17 18:17:24 +0100 |
---|---|---|
committer | gregor herrmann <gregoa@debian.org> | 2022-12-17 18:17:24 +0100 |
commit | 70c99ca89563dc74950bee2143d759ea2b9036ec (patch) | |
tree | 060dd8d5f13c9ab456339e72ac4ef20225b33087 | |
parent | ed81870975cf1014f09972bc93470b6c177e9fec (diff) |
New upstream version 0.29
-rw-r--r-- | Build.PL | 2 | ||||
-rw-r--r-- | Changes | 7 | ||||
-rw-r--r-- | MANIFEST | 8 | ||||
-rw-r--r-- | META.json | 12 | ||||
-rw-r--r-- | META.yml | 10 | ||||
-rw-r--r-- | lib/Tickit/Widget/Scroller.pm | 40 | ||||
-rw-r--r-- | lib/Tickit/Widget/Scroller/Item/RichText.pm | 3 | ||||
-rw-r--r-- | lib/Tickit/Widget/Scroller/Item/Text.pm | 30 |
8 files changed, 62 insertions, 50 deletions
@@ -7,7 +7,7 @@ my $build = Module::Build->new( module_name => 'Tickit::Widget::Scroller', requires => { 'perl' => '5.026', # signatures - 'Object::Pad' => '0.57', + 'Object::Pad' => '0.74', # 0.73 + bugfix 'String::Tagged' => 0, 'Tickit::RenderBuffer' => '0.43', # flush_to_term @@ -1,5 +1,12 @@ Revision history for Tickit-Widget-Scroller +0.29 2022-12-14 + [CHANGES] + * Updated for Object::Pad v0.73 + + Use `field NAME = EXPR` syntax + + Use `ADJUST :params` + + Set `:strict(params)` + 0.28 2022-04-25 [CHANGES] * Added `new_from_formatting` convenience constructor to @@ -6,7 +6,11 @@ lib/Tickit/Widget/Scroller.pm lib/Tickit/Widget/Scroller/Item.pod lib/Tickit/Widget/Scroller/Item/RichText.pm lib/Tickit/Widget/Scroller/Item/Text.pm +LICENSE MANIFEST This list of files +META.json +META.yml +README t/00use.t t/01item-text.t t/02item-richtext.t @@ -25,7 +29,3 @@ t/23pop-bottom.t t/23pop-top.t t/30indicator.t t/99pod.t -README -LICENSE -META.yml -META.json @@ -16,7 +16,7 @@ "prereqs" : { "runtime" : { "requires" : { - "Object::Pad" : "0.57", + "Object::Pad" : "0.74", "String::Tagged" : "0", "Tickit::Pen" : "0.19", "Tickit::RenderBuffer" : "0.43", @@ -35,15 +35,15 @@ "provides" : { "Tickit::Widget::Scroller" : { "file" : "lib/Tickit/Widget/Scroller.pm", - "version" : "0.28" + "version" : "0.29" }, "Tickit::Widget::Scroller::Item::RichText" : { "file" : "lib/Tickit/Widget/Scroller/Item/RichText.pm", - "version" : "0.28" + "version" : "0.29" }, "Tickit::Widget::Scroller::Item::Text" : { "file" : "lib/Tickit/Widget/Scroller/Item/Text.pm", - "version" : "0.28" + "version" : "0.29" } }, "release_status" : "stable", @@ -53,6 +53,6 @@ ], "x_IRC" : "irc://irc.freenode.net/#tickit" }, - "version" : "0.28", - "x_serialization_backend" : "JSON::PP version 4.06" + "version" : "0.29", + "x_serialization_backend" : "JSON::PP version 4.07" } @@ -15,15 +15,15 @@ name: Tickit-Widget-Scroller provides: Tickit::Widget::Scroller: file: lib/Tickit/Widget/Scroller.pm - version: '0.28' + version: '0.29' Tickit::Widget::Scroller::Item::RichText: file: lib/Tickit/Widget/Scroller/Item/RichText.pm - version: '0.28' + version: '0.29' Tickit::Widget::Scroller::Item::Text: file: lib/Tickit/Widget/Scroller/Item/Text.pm - version: '0.28' + version: '0.29' requires: - Object::Pad: '0.57' + Object::Pad: '0.74' String::Tagged: '0' Tickit::Pen: '0.19' Tickit::RenderBuffer: '0.43' @@ -33,5 +33,5 @@ requires: resources: IRC: irc://irc.freenode.net/#tickit license: http://dev.perl.org/licenses/ -version: '0.28' +version: '0.29' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff --git a/lib/Tickit/Widget/Scroller.pm b/lib/Tickit/Widget/Scroller.pm index 81c7b6b..2db2c77 100644 --- a/lib/Tickit/Widget/Scroller.pm +++ b/lib/Tickit/Widget/Scroller.pm @@ -1,13 +1,14 @@ # You may distribute under the terms of either the GNU General Public License # or the Artistic License (the same terms as Perl itself) # -# (C) Paul Evans, 2011-2021 -- leonerd@leonerd.org.uk +# (C) Paul Evans, 2011-2022 -- leonerd@leonerd.org.uk use v5.26; # signatures -use Object::Pad 0.57; +use Object::Pad 0.73 ':experimental(adjust_params init_expr)'; -package Tickit::Widget::Scroller 0.28; +package Tickit::Widget::Scroller 0.29; class Tickit::Widget::Scroller + :strict(params) :isa(Tickit::Widget); use Tickit::Style; @@ -140,11 +141,11 @@ C<set_gen_top_indicator> and C<set_gen_bottom_indicator>. =cut -has @_items; -has @_itemheights; +field @_items; +field @_itemheights; -has $_start_item = 0; -has $_start_partial = 0; +field $_start_item = 0; +field $_start_partial = 0; # accessor methods for t/30indicator.t to use # TODO: Should think about whether these should be made public @@ -154,22 +155,21 @@ method _start_partial { $_start_partial } # We're going to cache window height because we need pre-resize height # during resize event -has $_window_lines; -has $_window_cols; +field $_window_lines; +field $_window_cols; -has $_gravity_bottom; +field $_gravity_bottom; -has $_pending_scroll_to_bottom; +field $_pending_scroll_to_bottom; -has $_on_scrolled :param :reader :writer = undef; +field $_on_scrolled :param :reader :writer = undef; -has $_gen_top_indicator :param = undef; -has $_gen_bottom_indicator :param = undef; - -ADJUSTPARAMS ( $params ) -{ - my $gravity = ( delete $params->{gravity} ) || "top"; +field $_gen_top_indicator :param = undef; +field $_gen_bottom_indicator :param = undef; +ADJUST :params ( + :$gravity = "top", +) { $_gravity_bottom = ( $gravity eq "bottom" ); } @@ -978,8 +978,8 @@ return different text now. =cut -has %_indicator_win; -has %_indicator_text; +field %_indicator_win; +field %_indicator_text; method update_indicators () { diff --git a/lib/Tickit/Widget/Scroller/Item/RichText.pm b/lib/Tickit/Widget/Scroller/Item/RichText.pm index add77f7..85a8236 100644 --- a/lib/Tickit/Widget/Scroller/Item/RichText.pm +++ b/lib/Tickit/Widget/Scroller/Item/RichText.pm @@ -5,8 +5,9 @@ use Object::Pad 0.57; -package Tickit::Widget::Scroller::Item::RichText 0.28; +package Tickit::Widget::Scroller::Item::RichText 0.29; class Tickit::Widget::Scroller::Item::RichText + :strict(params) :isa(Tickit::Widget::Scroller::Item::Text); use Tickit::Utils qw( textwidth ); diff --git a/lib/Tickit/Widget/Scroller/Item/Text.pm b/lib/Tickit/Widget/Scroller/Item/Text.pm index 3f37c89..b5fd0e7 100644 --- a/lib/Tickit/Widget/Scroller/Item/Text.pm +++ b/lib/Tickit/Widget/Scroller/Item/Text.pm @@ -1,12 +1,14 @@ # You may distribute under the terms of either the GNU General Public License # or the Artistic License (the same terms as Perl itself) # -# (C) Paul Evans, 2011-2020 -- leonerd@leonerd.org.uk +# (C) Paul Evans, 2011-2022 -- leonerd@leonerd.org.uk -use Object::Pad 0.27; +use v5.26; +use Object::Pad 0.70 ':experimental(adjust_params)'; -package Tickit::Widget::Scroller::Item::Text 0.28; -class Tickit::Widget::Scroller::Item::Text; +package Tickit::Widget::Scroller::Item::Text 0.29; +class Tickit::Widget::Scroller::Item::Text + :strict(params); use Tickit::Utils qw( textwidth cols2chars ); @@ -59,17 +61,19 @@ amount. Does not apply to the first line. sub BUILDARGS ( $class, $text, %opts ) { return ( text => $text, %opts ) } -has $_indent; -has @_chunks; +field $_indent; +field @_chunks; -has $_width; # width for which the @_lineruns are valid -has @_lineruns; +field $_width; # width for which the @_lineruns are valid +field @_lineruns; -ADJUSTPARAMS ( $params ) -{ - $_indent = delete $params->{indent} if exists $params->{indent}; +ADJUST :params ( + :$indent = undef, + :$text = undef, +) { + $_indent = $indent if defined $indent; - @_chunks = $self->_build_chunks_for( delete $params->{text} ); + @_chunks = $self->_build_chunks_for( $text ); } =head1 METHODS @@ -179,7 +183,7 @@ method render ( $rb, %args ) $rb->goto( $lineidx, 0 ); $rb->erase( $indent ) if $indent; - foreach my $chunk ( @{ $_lineruns[$lineidx] } ) { + foreach my $chunk ( $_lineruns[$lineidx]->@* ) { my ( $text, $width, $chunkpen ) = @$chunk; $rb->text( $text, $chunkpen ); } |