From: Steve Hancock Date: Wed, 5 Aug 2020 14:37:45 +0000 (-0700) Subject: simplified sub flush X-Git-Tag: 20200822~22 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ae5853a0bd7da93b9ee52937785d1124315b5403;p=perltidy.git simplified sub flush --- diff --git a/lib/Perl/Tidy/VerticalAligner.pm b/lib/Perl/Tidy/VerticalAligner.pm index 2dad48f0..43b2bf8b 100644 --- a/lib/Perl/Tidy/VerticalAligner.pm +++ b/lib/Perl/Tidy/VerticalAligner.pm @@ -154,6 +154,23 @@ sub initialize { return $self; } +sub flush { + + # flush() is the external call to completely empty the pipeline. + my ($self) = @_; + + # the buffer must be emptied first + $self->dump_valign_buffer(); + + # then any current group + $self->my_flush(); + + # then the cache, which may still contain text if there was + # no group + $self->my_flush_cache(); + return; +} + sub initialize_for_new_group { my ($self) = @_; @@ -1288,25 +1305,6 @@ sub dump_array { return; } -# flush() sends the current Perl::Tidy::VerticalAligner group down the -# pipeline to Perl::Tidy::FileWriter. - -# This is the external flush, which also empties the buffer and cache -sub flush { - my ($self) = @_; - - # the buffer must be emptied first, then any cached text - $self->dump_valign_buffer(); - - if ( $self->group_line_count() ) { - $self->my_flush(); - } - else { - $self->my_flush_cache(); - } - return; -} - sub level_change { # compute decrease in level when we remove $diff spaces from the