Ticket #1435 (closed defect: fixed)

Opened 2 years ago

Last modified 20 months ago

outline entries can become padded (too high) when typing 'has'

Reported by: dod Owned by: bowtie
Priority: trivial Milestone:
Component: Outline Version: 0.96
Keywords: Cc: szabgab

Description

Hello

I've often been bothered by the outline panel becoming unusable because space between each entry is too wide.

I've finally found a way to reproduce this behavior:

  • mkdir -p lib/Test
  • save the attached file in this new directory (as Item.pm)
  • open the file with padre
  • open the outline window
  • go just below the 'our $VERSION' line (i.e. line 31)
  • type 'has'

you should see the space between the outline items becoming overblown.

All the best

Attachments

Item.pm (952 bytes) - added by dod 2 years ago.
sample test file to reproduce outline issue
test_1435.png (116.8 KB) - added by bowtie 22 months ago.
visual result, working
PPIx-EditorTools-0.15_04.tar.gz (38.6 KB) - added by bowtie 20 months ago.

Change History

Changed 2 years ago by dod

sample test file to reproduce outline issue

comment:1 Changed 2 years ago by bowtie

I concur :)

comment:2 Changed 22 months ago by bowtie

  • Status changed from new to closed
  • Resolution set to fixed

fixed in r19111

it's a poor hack but works, for now :)

comment:3 Changed 22 months ago by bowtie

PPI generates

    PPI::Token::Word    'has'
    PPI::Token::Whitespace      '\n'

but PPIx::EditorTools::OutLine? is expecting some thing like

    PPI::Token::Word    'has'
    PPI::Token::Whitespace      ' '

The above hack fixes Padre double spacing when it gets given \n as an attribute,

comment:4 Changed 22 months ago by bowtie

  • Status changed from closed to reopened
  • Resolution fixed deleted

here is another snippet, for fun

use Class::Accessor 'antlers';
has first => ( is => 'rw' );
has ;#comment
has second => ( is => 'ro' );

if the ;#comment is removed, syntax checker dose not give an error

comment:5 Changed 22 months ago by bowtie

here is the start of a hack to fix

package PPIx::EditorTools::Outline;

sub _Moo_Attributes {
    my ( $self, $ma_node2, $ma_cur_pkg, $ma_thing ) = @_;

    my $line_num = $ma_thing->location->[0];
    my $attrs    = eval $ma_node2->content;
+   if ( $ma_node2->content =~ /[\n|;]/ ) {
+       return;
+   }
        ...
Last edited 22 months ago by bowtie (previous) (diff)

comment:6 Changed 22 months ago by bowtie

also

sub find {
...
            next unless defined $node2;

+           # Tests for has followed by new line
+           try {
+               if ( defined $node2->{content} ) {
+                   if ( $node2->{content} =~ /\n/ ) {
+                       next;
+                   }
+               }
+           };
...

comment:7 Changed 22 months ago by bowtie

The above patches added to PPIx-EditorTools? 0.15_03

added to https://github.com/kevindawson

see http://cpan.metacpan.org/authors/id/B/BO/BOWTIE/PPIx-EditorTools-0.15_03.tar.gz

also se for current status https://github.com/szabgab/PPIx-EditorTools/network

critiques welcome,

will level open until PPIx-EditorTools? 0.16 is released

comment:8 Changed 22 months ago by bowtie

  • Owner set to bowtie
  • Priority changed from minor to trivial
  • Status changed from reopened to assigned

comment:9 Changed 22 months ago by bowtie

  • Cc szabgab added

Changed 22 months ago by bowtie

visual result, working

comment:10 Changed 22 months ago by bowtie

PPIx-EditorTools 0.15_04 2012.07.11

  • suppress warning Exiting eval via next (BOWTIE)

http://cpan.metacpan.org/authors/id/B/BO/BOWTIE/PPIx-EditorTools-0.15_04.tar.gz

similar #401

Last edited 22 months ago by bowtie (previous) (diff)

comment:11 Changed 21 months ago by dod

I've installed PPIx-EditorTools?-0.15_04 .

With this version, I no longer have problem with the outline spacing in Padre.

Thanks a bunch for the fix.

Changed 20 months ago by bowtie

comment:12 Changed 20 months ago by bowtie

info:

http://cpan.metacpan.org/authors/id/S/SZ/SZABGAB/PPIx-EditorTools-0.17.tar.gz

has been released, looks good to me

dod can you please confirm, then you or I can close this ticket :)

comment:13 Changed 20 months ago by dod

padre works fine with PPIx-EditorTools 0.17: no extra space in the outline when I type in new Moose attributes.

Thanks

comment:14 Changed 20 months ago by dod

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixed in padre's dependency (PPIx-EditorTools 0.17)

Note: See TracTickets for help on using tickets.