blib/lib/Text/Editor/Vip/Buffer.pm

filter: Statementstmt 99.3% 1066 / 1073 Branchbran 88.3% 83 / 94 Conditioncond 77.5% 31 / 40 MC/DCmcdc 52.1% 12 / 23 Subroutinesub 99.3% 295 / 297 Podpod 83.7% 31 / 37 totaltotal 97.0% 1518 / 1564 CC 70 SCAR 7.1
CC
70
Cov
98%
ExpandWith
8.0
Backspace
8.0
Delete
8.0
CRAP 2.0
« blib/lib/Text/Editor/Vip/Buffer/Plugins/Selection.pm ↑ Summary blib/lib/Text/Editor/Vip/Buffer/Plugins/PageUpDown.pm »
1  
2 package Text::Editor::Vip::Buffer;
3  
4 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 18 ▶use warnings ;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 18 ▶use Data::TreeDumper ;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 BEGIN
9 18 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
10 18 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 18 ▶use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 18 $VERSION = 0.01;
14 18 @ISA = qw (Exporter);
15 18 @EXPORT = qw ();
16 18 @EXPORT_OK = qw ();
17 18 %EXPORT_TAGS = ();
18 }
19  
20 #-------------------------------------------------------------------------------
21  
22 18 ▶use Time::HiRes ;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 18 ▶use Carp qw(carp confess cluck);
Subroutine BEGIN: called CC=1 SCAR=0.0
24 18 ▶use List::Util qw(min) ;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 18 ▶use Text::Editor::Vip::Buffer::List ;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 18 ▶use Text::Editor::Vip::Buffer::Constants ;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 18 ▶use Text::Editor::Vip::Selection ;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 18 ▶use Text::Editor::Vip::CommandBlock ;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 #-------------------------------------------------------------------------------
32  
33 =head1 NAME
34  
35 Text::Editor::Vip::Buffer - Editing engine
36  
37 =head1 SYNOPSIS
38  
39 use Text::Editor::Vip::Buffer ;
40 my $buffer = new Text::Editor::Vip::Buffer() ;
41
42 =head1 DESCRIPTION
43  
44 This module implements the core functionality for an editing engine. It knows about
45 selection, undo and plugins.
46  
47 =head1 MEMBER FUNCTIONS
48  
49 =cut
50  
51 18 my $uid = 0 ; #well, hmm, good enough
52  
53 sub new
54 117 ▶{
Subroutine new: called CC=2 SCAR=6.9
Pod documented
55  
56 =head2 new
57  
58 Create a Text::Editor::Vip::Buffer .
59  
60 my $buffer = new Text::Editor::Vip::Buffer() ;
61  
62 =cut
63  
64 117 my $invocant = shift ;
65  
66 117 ▶my $class = ref($invocant) || $invocant ;
Condition66%2/3
ref $invocant || $invocant
l!l&&r!l&&!r
81090
MC/DC0%0/2
ref $invocant || $invocant
ref $invocant $invocant
Truth table66%2/3
A || B
A= ref $invocantB= $invocant
ABresult
1X1
011
000
67 117 my $buffer = {} ;
68  
69 117 my ($package, $file_name, $line) = caller() ;
70 117 $file_name =~ s/[^0-9a-zA-Z_]/_/g ;
71  
72 # push this object in a 'unique' class
73 # this lets us expand a single object functionality without expanding
74 # all objects
75 117 $class .= "::${file_name}_${line}_$uid" ;
76 117 $uid++ ;
77
78 117 my $buffer_package = __PACKAGE__;
79 117 eval "unshift \@${class}::ISA, '$buffer_package' ;" ;
80  
81 117 bless $buffer, $class ;
82  
83 117 $buffer->Setup(@_) ;
84 117 $buffer->LoadAndExpandWith('Text::Editor::Vip::Buffer::DoUndoRedo') ;
85 117 $buffer->LoadAndExpandWith('Text::Editor::Vip::Buffer::Indenter') ;
86 117 $buffer->LoadAndExpandWith('Text::Editor::Vip::Buffer::Selection') ;
87  
88 117 return($buffer) ;
89 }
90  
91 #-------------------------------------------------------------------------------
92  
93 sub Setup
94 250 ▶{
Subroutine Setup: called CC=2 SCAR=6.9
Pod documented
95  
96 =head2 Setup
97  
98 Helper sub called by new. This is considerer private.
99  
100 =cut
101  
102 250 my $buffer = shift ;
103 250 ▶my $expansions = $buffer->{EXPANSIONS} || [] ;
Condition100%2/2
$buffer->{'EXPANSIONS'} || []
l!l
133117
MC/DC100%1/1
$buffer->{'EXPANSIONS'} || []
$buffer->{'EXPANSIONS'}
Truth table100%2/2
A
A= $buffer->{'EXPANSIONS'}
Aresult
11
00
104  
105 250 %$buffer =
106 (
107 NODES => new Text::Editor::Vip::Buffer::List()
108 , EXPANSIONS => $expansions
109
110 , MARKED_AS_EDITED => 0
111
112 , DO_PREFIX => ''
113 , DO_STACK => []
114 , UNDO_PREFIX => ''
115 , UNDO_STACK => []
116 , REDO_STACK => []
117
118 , CLIPBOARDS => {}
119 , MODIFICATION_LINE => 0
120 , MODIFICATION_CHARACTER => 0
121 , SELECTION => new Text::Editor::Vip::Selection()
122 , @_
123 ) ;
124  
125  
126 250 $buffer->{NODES}->Push({TEXT => ''}) ;
127 }
128  
129 #-------------------------------------------------------------------------------
130  
131 =head2 Reset
132  
133 Empties the buffer from it's contents as if it was newly created. L<Plugins> are still plugged into the buffer. This
134 is very practical when writting tests.
135  
136 $buffer->Reset() ;
137  
138 =cut
139  
140 18 *Reset = \&Setup ;
141  
142 #-------------------------------------------------------------------------------
143  
144 sub ExpandedWithOrLoad
145 167 ▶{
Subroutine ExpandedWithOrLoad: called CC=2 SCAR=6.9
Pod documented
146  
147 =head2 ExpandedWithOrLoad
148  
149 See L<PLUGINS>.
150  
151 If the name passed as first argument doesn't match a sub within the object, the module, passed as second argument,
152 is loaded.
153  
154 # newly created buffer that is missing a functionality
155 $buffer->SomeSub(); # perl dies
156
157 # load plugin first
158 $buffer->LoadAndExpandWith('Text::Editor::Vip::Buffer::Plugins::SomePlugin') ;
159 $buffer->SomeSub(); # ok
160
161 # load the plugin only if the sub is available. This doesn't guarantee that 'SomeSub' has been
162 # loaded from the passed Plugin.
163
164 $buffer->ExpandedWithOrLoad('SomeSub', 'Text::Editor::Vip::Buffer::Plugins::SomePlugin') ;
165 $buffer->SomeSub(); #ok
166  
167 Returns 1 if the sub existed and 0 if it didn't and the module was loaded or the error type B<LoadAndExpandWith> generated.
168  
169 =cut
170  
171 167 my $buffer = shift ;
172 167 my $sub_name = shift ;
173 167 my $module = shift ;
174  
175 167 my $class = ref($buffer) ;
176  
177 167 my $sub ;
178 167 eval "\$sub = ${class}->can('${sub_name}') ;" ;
179  
180 167 ▶if(defined $sub)
Branch: 1 branch
BranchTrueFalseTotal
if (defined $sub) { } 146 21 167
181 {
182 146 push @{$buffer->{EXPANSIONS}}, {CALLER => [caller()], LOOKING_FOR => $sub_name, FOUND => 1} ;
183 146 return(1) ;
184 }
185 else
186 {
187 21 $buffer->LoadAndExpandWith($module, 1) ;
188
189 21 push @{$buffer->{EXPANSIONS}}, {CALLER => [caller()], LOOKING_FOR => $sub_name, LOADING_MODULE => $module} ;
190 21 return(0) ;
191 }
192 }
193  
194 #-------------------------------------------------------------------------------
195  
196 sub LoadAndExpandWith
197 487 ▶{
Subroutine LoadAndExpandWith: called CC=3 SCAR=11.0
Pod documented
198  
199 =head2 LoadAndExpandWith
200  
201 See L<PLUGINS>.
202  
203 Loads a perl module (plugin) and adds all it functionality to the buffer
204  
205 $buffer->LoadAndExpandWith('Text::Editor::Vip::Plugins::Buffer::File') ;
206
207 # we can now read files
208 $buffer->InsertFile(__FILE__) ;
209  
210 =cut
211  
212 # look at Export::Cluster, Export::Dispatch
213  
214 487 my $buffer = shift ;
215 487 my $module = shift ;
216 487 my $no_history = shift ;
217  
218 18 ▶eval "use $module ;" ;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
219 487 ▶die __PACKAGE__ . " couldn't load '$module':\n$@\n" if $@ ;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 487 487
220  
221 487 my $class = ref($buffer) ;
222 487 eval "push \@${class}::ISA, '$module' ;" ;
223  
224 487 $buffer->PushUndoStep
225 (
226 "\$buffer->LoadAndExpandWith('$module') ;"
227 , "# undo for \$buffer->LoadAndExpandWith('$module') ;"
228 ) ;
229  
230 487 ▶unless($no_history)
Branch: 1 branch
BranchTrueFalseTotal
unless ($no_history) 466 21 487
231 {
232 466 push @{$buffer->{EXPANSIONS}}, {CALLER => [caller()], LOADING_MODULE => $module} ;
233 }
234  
235 #alternative way to expend the object
236  
237 # expands the current's package ISA not the objects isa
238 #~ push @ISA, $module ;
239  
240 #~ my $class = ref($buffer) ;
241  
242 #~ my $symbole_tabel = "main::${module}::" ;
243  
244 #~ no strict ;
245 #~ if($symbole_tabel->{EXTEND_VIP_BUFFER})
246 #~ {
247 #~ for(sort @{*{$symbole_tabel->{EXTEND_VIP_BUFFER}}{ARRAY}})
248 #~ {
249 #~ if(*{$symbole_tabel->{$_}}{CODE})
250 #~ {
251 #~ print "code => $_\n" ;
252 #~ $buffer->ExpandWith($_, *{$symbole_tabel->{$_}}{CODE})
253 #~ }
254 #~ }
255 #~ }
256 }
257  
258 #-------------------------------------------------------------------------------
259  
260 sub ExpandWith
261 15 ▶{
Subroutine ExpandWith: called CC=8 SCAR=20.8
Pod documented
262  
263 =head2 ExpandWith
264  
265 See L<PLUGINS>.
266  
267 Adds a sub to a buffer instance.
268  
269 $buffer->ExpandWith
270 (
271 'GotoBufferStart' # member function name
272 , \&some_sub # implementaton for GotoBufferStart
273 ) ;
274
275 # we can now go to the buffers start
276 $buffer->GotoBufferStart() ;
277  
278 The second argument is optional, if it is not given, Text::Editor::Vip::Buffer will take the sub from the caller namespace
279  
280 sub GotoBufferStart
281 {
282 my $buffer = shift ; # remember we are a plugin to an object oriented module
283 $buffer->SetModificationPosition,(0, 0) ;
284 }
285
286 $buffer->ExpandWith( 'GotoBufferStart') ;
287 $buffer->GotoBufferStart() ;
288  
289 DEV. WARNING!
290 This is going to give us troubles when using it for macros that are saved to disk!
291 we must find a way to replug when loading the macro back
292  
293 =cut
294  
295 15 my $buffer = shift ;
296 15 my $sub_name = shift ;
297 15 my $sub = shift ;
298  
299 15 my $class = ref($buffer) ;
300  
301 15 my $warning = '' ;
302 0 ▶local $SIG{'__WARN__'} = sub {$warning = $_[0] ;} ;
Subroutine __ANON__: not called CC=1 SCAR=1.2
303  
304 #~ $DB::single = 1 ;
305  
306 15 my ($package, $file_name, $line) = caller() ;
307 15 ▶$package ||= '' ;
Condition50%1/2
$package ||= ""
l!l
150
MC/DC0%0/1
$package ||= ""
$package
Truth table50%1/2
A
A= $package
Aresult
11
00
308  
309 15 my $location = "$file_name:$line" ;
310  
311 15 ▶if($sub)
Branch: 1 branch
BranchTrueFalseTotal
if ($sub) { } 8 7 15
312 {
313 8 ▶ die __PACKAGE__ . " not a sub reference '$sub_name' at $location:\n" unless 'CODE' eq ref $sub ;
Branch: 1 branch
BranchTrueFalseTotal
unless "CODE" eq ref $sub 1 7 8
314
315 7 eval "*${class}::${sub_name} = \$sub;" ;
316 7 push @{$buffer->{EXPANSIONS}}, {CALLER => [caller()], SUB_REF => $sub_name} ;
317 }
318 else
319 {
320 # load the named sub from the caller package
321
322 7 ▶ die __PACKAGE__ . " error exapnding with undefined named sub at $location\n" unless defined $sub_name and $sub_name ne '' ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $sub_name and $sub_name ne "" 2 5 7
Condition100%3/3
defined $sub_name and $sub_name ne ""
!ll&&!rl&&r
115
MC/DC100%2/2
defined $sub_name and $sub_name ne ""
defined $sub_name $sub_name ne ""
Truth table100%3/3
A and B
A= defined $sub_nameB= $sub_name ne ""
ABresult
0X0
100
111
323  
324 5 my $found_sub ;
325 5 eval "\$found_sub = ${package}->can('${sub_name}') ;" ;
326 5 ▶ die __PACKAGE__ . " error exapnding with named sub '$sub_name' at $location.\n" unless defined $found_sub ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $found_sub 1 4 5
327  
328 4 eval "*${class}::${sub_name} = \\\&$package\::${sub_name};" ;
329 4 ▶ die __PACKAGE__ . " error exapnding with named sub ''$sub_name' at $location:\n$@\n" if $@ ;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 4 4
330  
331 4 push @{$buffer->{EXPANSIONS}}, {CALLER => [$package, $file_name, $line], SUB_REF_IN_CALLER_SPACE => $sub_name} ;
332 }
333 }
334  
335 #-------------------------------------------------------------------------------
336  
337 sub PrintExpansionHistory
338 1 ▶{
Subroutine PrintExpansionHistory: called CC=2 SCAR=7.0
Pod documented
339  
340 =head2 PrintExpansionHistory
341  
342 Displays the expansion done to the buffer
343  
344 =cut
345  
346 1 my $buffer = shift ;
347 1 ▶my $message = shift || '' ;
Condition50%1/2
shift() || ''
l!l
01
MC/DC0%0/1
shift() || ''
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
348  
349 1 my ($package, $file_name, $line) = caller() ;
350 1 $message .= " @ '$file_name:$line'" ;
351  
352 1 print DumpTree($buffer->{EXPANSIONS}, $message) ;
353 }
354  
355 #-------------------------------------------------------------------------------
356  
357 sub Do
358 108 ▶{
Subroutine Do: called CC=3 SCAR=11.0
Pod documented
359  
360 =head2 Do
361  
362 Let you run any perl code on the buffer. The variable $buffer is made available in your perl code.
363  
364 ($result, $message) = $buffer->Do("# comment\n\$buffer->Insert('bar') ;") ;
365 is($buffer->GetText(), "bar", 'buffer contains \'bar\'' ) ;
366  
367 Returns (1) on success and (0, "error message") on failure.
368  
369 =cut
370  
371 108 my $buffer = shift ;
372 108 ▶my $perl_script = shift || '' ;
Condition100%2/2
shift() || ''
l!l
1053
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
373  
374 108 our $buffer = $buffer ;
375 108 eval $perl_script ;
376  
377 108 ▶if($@)
Branch: 1 branch
BranchTrueFalseTotal
if ($@) { } 1 107 108
378 {
379 1 $buffer->PrintError("\n* Failed evaluating buffer command *\n$perl_script\n$@\n") ;
380 1 return(0, $@) ;
381 }
382 else
383 {
384 107 return(1) ;
385 }
386 }
387  
388 #-------------------------------------------------------------------------------
389  
390 sub PrintError
391 26 ▶{
Subroutine PrintError: called CC=1 SCAR=0.0
Pod documented
392  
393 =head2 PrintError
394  
395 This sub is called when an error occures. It should be overriden by the buffer user. We use this
396 sub to abstract error handling and allow different handling dependind on the buffer user.
397  
398 If the user is a plain perl script, the error might just be logged while a dialogue might be displayed
399 if the user is a full UI.
400  
401 =cut
402  
403 26 my $buffer = shift ;
404 26 my $message = shift ;
405  
406 26 my ($package, $file_name, $line) = caller() ;
407  
408 26 confess "\n\n Using default PrintError wich dies !!\n\n$message" ;
409 }
410  
411 #-------------------------------------------------------------------------------
412  
413 sub GetText
414 214 ▶{
Subroutine GetText: called CC=2 SCAR=6.9
Pod documented
415  
416 =head2 GetText
417  
418 Returns the buffer contents joined with "\n".
419  
420 See L<GetTextAsArrayRef>.
421  
422 =cut
423  
424 214 my $buffer = shift ;
425  
426 214 my $text = '' ;
427  
428 214 for(0 .. ($buffer->GetNumberOfLines() - 2))
429 {
430 2005 $text .= $buffer->GetLine($_)->{TEXT} . "\n" ;
431 }
432  
433 214 $text .= $buffer->GetLine(($buffer->GetNumberOfLines() - 1))->{TEXT} ;
434  
435 214 return($text) ;
436 }
437  
438 #-------------------------------------------------------------------------------
439  
440 sub GetTextAsArrayRef
441 3 ▶{
Subroutine GetTextAsArrayRef: called CC=2 SCAR=6.9
Pod documented
442  
443 =head2 GetTextAsArrayRef
444  
445 Returns a copy of the buffers content as an array reference.
446  
447 See L<GetText>.
448  
449 =cut
450  
451 3 my $buffer = shift ;
452  
453 3 my @text ;
454  
455 3 for(0 .. ($buffer->GetNumberOfLines() - 1))
456 {
457 3 push @text, $buffer->GetLine($_)->{TEXT} ;
458 }
459  
460 3 return(\@text) ;
461 }
462  
463 #-------------------------------------------------------------------------------
464  
465 sub SetLineAttribute
466 1 ▶{
Subroutine SetLineAttribute: called CC=2 SCAR=7.1
Pod documented
467  
468 =head2 SetLineAttribute
469  
470 Attaches a named attribute to a line.
471  
472 $buffer->SetLineAttribute(0, 'TEST', $some_data) ;
473 $retrieved_data = $buffer->GetLineAttribute(0'TEST', $some_data) ;
474  
475 =cut
476  
477 1 my ($buffer, $line, $attribute_name, $attribute) = @_ ;
478 1 ▶$line = $buffer->GetModificationLine() unless defined $line ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $line 0 1 1
479  
480 1 $buffer->GetLine($line)->{$attribute_name} = $attribute ;
481 }
482  
483 #-------------------------------------------------------------------------------
484  
485 sub GetLineAttribute
486 2 ▶{
Subroutine GetLineAttribute: called CC=2 SCAR=7.1
Pod undocumented
487  
488 =head2 SetLineAttribute
489  
490 Retrieves a named attribute from a line.
491  
492 $buffer->SetLineAttribute(0, 'TEST', $some_data) ;
493 $retrieved_data = $buffer->GetLineAttribute(0, 'TEST') ;
494  
495 =cut
496  
497 2 my ($buffer, $line, $attribute_name, $attribute) = @_ ;
498  
499 2 ▶$line = $buffer->GetModificationLine() unless defined $line ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $line 0 2 2
500  
501 2 return($buffer->GetLine($line)->{$attribute_name}) ;
502 }
503  
504 #-------------------------------------------------------------------------------
505  
506 =head2 MarkedBufferAsEdited
507  
508 Used to mak the buffer as edited after a modification. You should not need to use this function
509 if you access the buffer through it's interface. Which you should always do.
510  
511 =head2 MarkedBufferAsUndited
512  
513 Used to mak the buffer as unedited You should not need to use this function.
514  
515 =head2 IsBufferMarkedAsEdited
516  
517 Used to query the buffer about its state. Returns (1) if the buffer was edit. (0) otherwise.
518  
519 =head2 GetLastEditionTImestamp
520  
521 Returns the time of the last edition.
522  
523 =cut
524  
525 4 ▶sub IsBufferMarkedAsEdited {return($_[0]->{MARKED_AS_EDITED}) ;}
Subroutine IsBufferMarkedAsEdited: called CC=1 SCAR=0.0
Pod documented
526 5985 ▶sub MarkBufferAsEdited { $_[0]->{MARKED_AS_EDITED} = 1 ; $_[0]->{EDITED_AT_TIME} = Time::HiRes::time() ;}
Subroutine MarkBufferAsEdited: called CC=1 SCAR=0.0
Pod undocumented
527 1 ▶sub MarkBufferAsUnedited {$_[0]->{MARKED_AS_EDITED} = 0 ;}
Subroutine MarkBufferAsUnedited: called CC=1 SCAR=0.0
Pod undocumented
528  
529 0 ▶sub GetLastEditionTImestamp {$_[0]->{EDITED_AT_TIME};}
Subroutine GetLastEditionTImestamp: not called CC=1 SCAR=6.9
Pod documented
530  
531 #-------------------------------------------------------------------------------
532  
533 sub GetNumberOfLines
534 13008 ▶{
Subroutine GetNumberOfLines: called CC=1 SCAR=0.0
Pod documented
535  
536 =head2 GetNumberOfLines
537  
538 Returns the number of lines in the buffer.
539  
540 =cut
541  
542 13008 return($_[0]->{NODES}->GetNumberOfNodes()) ;
543 }
544  
545 #------------------------------------------------------------------------------
546  
547 sub GetLastLineIndex
548 15 ▶{
Subroutine GetLastLineIndex: called CC=1 SCAR=0.0
Pod undocumented
549  
550 =head2 GetLastfLineIndex
551  
552 Returns theindex of the last line. the buffer always contains at least one line thus the last line index is always 0 or more.
553  
554 =cut
555  
556 15 return($_[0]->{NODES}->GetNumberOfNodes() - 1) ;
557 }
558  
559 #------------------------------------------------------------------------------
560  
561 sub GetModificationPosition
562 4561 ▶{
Subroutine GetModificationPosition: called CC=1 SCAR=0.0
Pod documented
563  
564 =head2 GetModificationPosition
565  
566 Returns the position, line and character, where the next modification will occure.
567  
568 =cut
569  
570 4561 return($_[0]->{MODIFICATION_LINE}, $_[0]->{MODIFICATION_CHARACTER}) ;
571 }
572  
573 #-------------------------------------------------------------------------------
574  
575 sub SetModificationPosition
576 3492 ▶{
Subroutine SetModificationPosition: called CC=1 SCAR=0.0
Pod documented
577  
578 =head2 SetModificationPosition
579  
580 Sets the position, line and character, where the next modification will occure.
581  
582 $buffer->SetModificationPosition(0, 15) ;
583  
584 =cut
585  
586 3492 my ($buffer, $line, $character) = @_ ;
587  
588 3492 my $undo_block = new Text::Editor::Vip::CommandBlock($buffer, "\$buffer->SetModificationPosition($line, $character) ;", ' #', "# undo for \$buffer->SetModificationPosition($line, $character) ;", ' ') ;
589  
590 3492 $buffer->SetModificationLine($line) ;
591 3491 $buffer->SetModificationCharacter($character) ;
592 }
593  
594 #-------------------------------------------------------------------------------
595  
596 sub OffsetModificationPosition
597 3 ▶{
Subroutine OffsetModificationPosition: called CC=1 SCAR=0.0
Pod documented
598  
599 =head2 OffsetModificationPosition
600  
601 Offset the position, line and character, where the next modification will occure. an exception is thrown if position is not valid
602  
603 $buffer->OffsetModificationPosition(0, 15) ;
604  
605 =cut
606  
607 3 my ($buffer, $line_offset, $character_offset) = @_ ;
608  
609 3 my $undo_block = new Text::Editor::Vip::CommandBlock
610 (
611 $buffer
612 , "\$buffer->OffsetModificationPosition($line_offset, $character_offset) ;"
613 , ' #'
614 , "\$buffer->OffsetModificationPosition(-($line_offset), -($character_offset)) ;"
615 , ' '
616 ) ;
617  
618 3 $buffer->SetModificationLine($buffer->GetModificationLine() + $line_offset) ;
619 2 $buffer->SetModificationCharacter($buffer->GetModificationCharacter() + $character_offset) ;
620 }
621  
622 #-------------------------------------------------------------------------------
623  
624 sub OffsetModificationPositionGuarded
625 2 ▶{
Subroutine OffsetModificationPositionGuarded: called CC=4 SCAR=15.2
Pod documented
626  
627 =head2 OffsetModificationPositionGuarded
628  
629 Offsets the position, line and character, where the next modification will occure. Nothing happends if the new position is invalid
630  
631 $buffer->OffsetModificationPositionGuarded(0, 15) ;
632  
633 =cut
634  
635 2 my ($buffer, $line_offset, $character_offset) = @_ ;
636  
637 2 my $new_line = $buffer->GetModificationLine() + $line_offset ;
638 2 my $new_character = $buffer->GetModificationCharacter() + $character_offset ;
639  
640 2 ▶if
Branch: 1 branch
BranchTrueFalseTotal
if ($new_line < $buffer->GetNumberOfLines and 0 <= $new_line and 0 <= $new_character) { } 0 2 2
Condition66%4/6
$new_line < $buffer->GetNumberOfLines and 0 <= $new_line and 0 <= $new_character
!ll&&!rl&&r
110
$new_line < $buffer->GetNumberOfLines and 0 <= $new_line
!ll&&!rl&&r
011
MC/DC0%0/3
$new_line < $buffer->GetNumberOfLines and 0 <= $new_line and 0 <= $new_character
$new_line < $buffer->GetNumberOfLines 0 <= $new_line 0 <= $new_character
Truth table50%2/4
A and B and C
A= $new_line < $buffer->GetNumberOfLinesB= 0 <= $new_lineC= 0 <= $new_character
ABCresult
0XX0
10X0
1100
1111
641 (
642 $new_line < $buffer->GetNumberOfLines()
643 && 0 <= $new_line
644 && 0 <= $new_character
645 )
646 {
647 0 $buffer->OffsetModificationPosition($line_offset, $character_offset) ;
648 0 return(1) ;
649 }
650 else
651 {
652 2 return(0) ;
653 }
654 }
655  
656 #-------------------------------------------------------------------------------
657  
658 sub GetModificationLine
659 10354 ▶{
Subroutine GetModificationLine: called CC=1 SCAR=0.0
Pod documented
660  
661 =head2 GetModificationLine
662  
663 Returns the line where the next modification will occure.
664  
665 =cut
666  
667 10354 return($_[0]->{MODIFICATION_LINE}) ;
668 }
669  
670 #-------------------------------------------------------------------------------
671  
672 sub SetModificationLine
673 4836 ▶{
Subroutine SetModificationLine: called CC=4 SCAR=13.9
Pod documented
674  
675 =head2 SetModificationLine
676  
677 Set the line where the next modification will occure.
678  
679 =cut
680  
681 4836 my $buffer = shift ;
682 4836 my $a_new_modification_line = shift ;
683  
684 4836 my $current_line = $buffer->GetModificationLine() ;
685  
686 4836 ▶if
Branch: 1 branch
BranchTrueFalseTotal
if ($a_new_modification_line < $buffer->GetNumberOfLines and 0 <= $a_new_modification_line) { } 4831 5 4836
Condition100%3/3
$a_new_modification_line < $buffer->GetNumberOfLines and 0 <= $a_new_modification_line
!ll&&!rl&&r
324831
MC/DC100%2/2
$a_new_modification_line < $buffer->GetNumberOfLines and 0 <= $a_new_modification_line
$a_new_modification_line < $buffer->GetNumberOfLines 0 <= $a_new_modification_line
Truth table100%3/3
A and B
A= $a_new_modification_line < $buffer->GetNumberOfLinesB= 0 <= $a_new_modification_line
ABresult
0X0
100
111
687 (
688 $a_new_modification_line < $buffer->GetNumberOfLines()
689 && 0 <= $a_new_modification_line
690 )
691 {
692 4831 ▶ if($a_new_modification_line != $current_line)
Branch: 1 branch
BranchTrueFalseTotal
if ($a_new_modification_line != $current_line) 3289 1542 4831
693 {
694 3289 PushUndoStep
695 (
696 $buffer
697 , "\$buffer->SetModificationLine($a_new_modification_line) ;"
698 , "\$buffer->SetModificationLine($current_line) ;"
699 ) ;
700
701 3289 $buffer->{MODIFICATION_LINE} = $a_new_modification_line ;
702 }
703 }
704 else
705 {
706 5 $buffer->PrintError("Invalid line index: $a_new_modification_line. Number of lines: " . $buffer->GetNumberOfLines(). "\n") ;
707 }
708 }
709  
710 #-------------------------------------------------------------------------------
711  
712 sub GetModificationCharacter
713 11189 ▶{
Subroutine GetModificationCharacter: called CC=1 SCAR=0.0
Pod undocumented
714  
715 =head2 GetModificationLine
716  
717 Returns the character where the next modification will occure.
718  
719 =cut
720  
721 11189 my $buffer = shift ;
722 11189 return($buffer->{MODIFICATION_CHARACTER}) ;
723 }
724  
725 #-------------------------------------------------------------------------------
726  
727 sub SetModificationCharacter
728 7730 ▶{
Subroutine SetModificationCharacter: called CC=3 SCAR=11.0
Pod undocumented
729  
730 =head2 GetModificationLine
731  
732 Sets the character where the next modification will occure.
733  
734 =cut
735  
736 7730 my $buffer = shift ;
737 7730 my $a_new_modification_character = shift ;
738  
739 7730 my $current_character = $buffer->GetModificationCharacter() ;
740  
741 7730 ▶if(0 <= $a_new_modification_character)
Branch: 1 branch
BranchTrueFalseTotal
if (0 <= $a_new_modification_character) { } 7729 1 7730
742 {
743 7729 ▶ if($a_new_modification_character != $current_character)
Branch: 1 branch
BranchTrueFalseTotal
if ($a_new_modification_character != $current_character) 5388 2341 7729
744 {
745 5388 PushUndoStep
746 (
747 $buffer
748 , "\$buffer->SetModificationCharacter($a_new_modification_character) ;"
749 , "\$buffer->SetModificationCharacter($current_character) ;"
750 ) ;
751
752 5388 $buffer->{MODIFICATION_CHARACTER} = $a_new_modification_character ;
753 }
754 }
755 else
756 {
757 1 $buffer->PrintError("Invalid character index: $a_new_modification_character\n") ;
758 }
759 }
760  
761 #-------------------------------------------------------------------------------
762  
763 sub GetLine
764 12684 ▶{
Subroutine GetLine: called CC=1 SCAR=0.0
Pod documented
765  
766 =head2 GetLine
767  
768 Returns the Line object used by the buffer. This is a private sub and should not be used directly.
769  
770 See L<GetLineText>.
771  
772 =cut
773  
774 12684 my $buffer = shift ;
775 12684 my $a_line_index = shift ;
776  
777 12684 return( $buffer->{NODES}->GetNodeData($a_line_index) ) ;
778 }
779  
780 #-------------------------------------------------------------------------------
781  
782 sub GetLineText
783 4449 ▶{
Subroutine GetLineText: called CC=4 SCAR=14.0
Pod documented
784  
785 =head2 GetLineText
786  
787 Returns the text of the line passes as argument or the current modification line if no argument is passed.
788  
789 my $line_12_text = $buffer->GetLineText(12) ;
790 my $current_line_text = $buffer->GetLineText() ;
791  
792 =cut
793  
794 4449 my $buffer = shift ;
795 4449 my $a_line_index = shift ;
796  
797 4449 ▶$a_line_index = $buffer->GetModificationLine() unless defined $a_line_index ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $a_line_index 10 4439 4449
798  
799 4449 ▶if(0 <= $a_line_index && $a_line_index < $buffer->GetNumberOfLines())
Branch: 1 branch
BranchTrueFalseTotal
if (0 <= $a_line_index and $a_line_index < $buffer->GetNumberOfLines) { } 4446 3 4449
Condition66%2/3
0 <= $a_line_index and $a_line_index < $buffer->GetNumberOfLines
!ll&&!rl&&r
034446
MC/DC50%1/2
0 <= $a_line_index and $a_line_index < $buffer->GetNumberOfLines
0 <= $a_line_index $a_line_index < $buffer->GetNumberOfLines
Truth table66%2/3
A and B
A= 0 <= $a_line_indexB= $a_line_index < $buffer->GetNumberOfLines
ABresult
0X0
100
111
800 {
801 4446 return($buffer->GetLine($a_line_index)->{TEXT}) ;
802 }
803 else
804 {
805 3 $buffer->PrintError("GetLineText: Invalid line index: $a_line_index. Number of lines: " . $buffer->GetNumberOfLines(). "\n") ;
806 0 return('') ;
807 }
808 }
809  
810 #-------------------------------------------------------------------------------
811  
812 sub GetLineTextWithNewline
813 8 ▶{
Subroutine GetLineTextWithNewline: called CC=5 SCAR=17.1
Pod documented
814  
815 =head2 GetLineTextWithNewline
816  
817 Returns the text of the line passes as argument or the current modification line if no argument is passed. A "\n" is
818 appended if the line is not the last line in the buffer.
819  
820 my $line_12_text = $buffer->GetLineTextWithNewline(12) ;
821 my $current_line_text = $buffer->GetLineTextWithNewline() ;
822  
823 =cut
824  
825 8 my $buffer = shift ;
826 8 my $a_line_index = shift ;
827  
828 8 ▶$a_line_index = $buffer->GetModificationLine() unless defined $a_line_index ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $a_line_index 2 6 8
829  
830 8 ▶if(0 <= $a_line_index && $a_line_index < $buffer->GetNumberOfLines())
Branch: 1 branch
BranchTrueFalseTotal
if (0 <= $a_line_index and $a_line_index < $buffer->GetNumberOfLines) { } 8 0 8
Condition33%1/3
0 <= $a_line_index and $a_line_index < $buffer->GetNumberOfLines
!ll&&!rl&&r
008
MC/DC0%0/2
0 <= $a_line_index and $a_line_index < $buffer->GetNumberOfLines
0 <= $a_line_index $a_line_index < $buffer->GetNumberOfLines
Truth table33%1/3
A and B
A= 0 <= $a_line_indexB= $a_line_index < $buffer->GetNumberOfLines
ABresult
0X0
100
111
831 {
832 8 ▶ if($a_line_index == $buffer->GetLastLineIndex())
Branch: 1 branch
BranchTrueFalseTotal
if ($a_line_index == $buffer->GetLastLineIndex) { } 1 7 8
833 {
834 1 return($buffer->GetLine($a_line_index)->{TEXT}) ;
835 }
836 else
837 {
838 7 return($buffer->GetLine($a_line_index)->{TEXT} . "\n") ;
839 }
840 }
841 else
842 {
843 0 $buffer->PrintError("GetLineText: Invalid line index: $a_line_index. Number of lines: " . $buffer->GetNumberOfLines(). "\n") ;
844 0 return('') ;
845 }
846 }
847  
848 #-------------------------------------------------------------------------------
849  
850 sub GetLineLength
851 3115 ▶{
Subroutine GetLineLength: called CC=2 SCAR=6.9
Pod documented
852  
853 =head2 GetLineLength
854  
855 Returns the length of the text of the line passes as argument or the current modification line if no argument is passed.
856  
857 my $line_12_text = $buffer->GetLineText(12) ;
858 my $current_line_text = $buffer->GetLineText() ;
859  
860 =cut
861  
862 3115 my $buffer = shift ;
863 3115 my $a_line_index = shift ;
864  
865 3115 ▶$a_line_index = $buffer->GetModificationLine() unless defined $a_line_index ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $a_line_index 1437 1678 3115
866  
867 3115 return(length($buffer->GetLineText($a_line_index))) ;
868 }
869  
870 #-------------------------------------------------------------------------------
871  
872 sub Backspace
873 646 ▶{
Subroutine Backspace: called CC=8 SCAR=20.8
Pod documented
874  
875 =head2 Backspace
876  
877 Deletes characters backwards. The number of characters to delete is passed as an argument.
878 Doing a Backspace while at the begining of a line warps to the previous line.
879  
880 =cut
881  
882 646 my $buffer = shift ;
883 646 ▶my $number_of_character_to_delete = shift || 0 ;
Condition100%2/2
shift() || 0
l!l
6451
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
884  
885 646 ▶return if 0 >= $number_of_character_to_delete ;
Branch: 1 branch
BranchTrueFalseTotal
if 0 >= $number_of_character_to_delete 1 645 646
886  
887 645 my $undo_block = new Text::Editor::Vip::CommandBlock($buffer, "\$buffer->Backspace($number_of_character_to_delete) ;", ' #', "# undo for \$buffer->Backspace($number_of_character_to_delete)", ' ') ;
888  
889 645 ▶if($buffer->{SELECTION}->IsEmpty())
Branch: 1 branch
BranchTrueFalseTotal
if ($buffer->{'SELECTION'}->IsEmpty) { } 643 2 645
890 {
891 643 for (1 .. $number_of_character_to_delete)
892 {
893
894 647 my $current_line = $buffer->GetModificationLine() ;
895 647 my $current_position = $buffer->GetModificationCharacter() ;
896  
897 647 ▶ if($current_position != 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($current_position != 0) { } 6 641 647
898 {
899 6 $buffer->SetModificationCharacter($current_position - 1) ;
900
901 6 ▶ if($current_position <= $buffer->GetLineLength($current_line))
Branch: 1 branch
BranchTrueFalseTotal
if ($current_position <= $buffer->GetLineLength($current_line)) 6 0 6
902 {
903 6 $buffer->Delete(1) ;
904 }
905 #else
906 #after end of line, already modified position
907 }
908 else
909 {
910 641 ▶ if($current_line != 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($current_line != 0) 636 5 641
911 {
912 636 $buffer->SetModificationLine($current_line -1) ;
913
914 #Move to end of line
915 636 $buffer->SetModificationCharacter
916 (
917 $buffer->GetLineLength
918 (
919 $buffer->GetModificationLine()
920 )
921 ) ;
922
923 636 $buffer->Delete(1) ;
924 }
925 #else
926 # at first line
927 }
928 }
929 }
930 else
931 {
932 2 $buffer->DeleteSelection() ;
933 2 $buffer->Backspace($number_of_character_to_delete - 1) ;
934 }
935 }
936  
937 #-------------------------------------------------------------------------------
938  
939 sub ClearLine
940 7 ▶{
Subroutine ClearLine: called CC=4 SCAR=13.9
Pod documented
941  
942 =head2 ClearLine
943  
944 Removes all text from the passed line index or the current modification line if no argument is given.
945 The line itself is not deleted and the modification position is not modified.
946  
947 $buffer->ClearLine(0) ;
948  
949 =cut
950  
951 7 my $buffer = shift ;
952 7 my $line_index = shift ;
953  
954 7 ▶$line_index = $buffer->GetModificationLine() unless defined $line_index ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $line_index 1 6 7
955  
956 7 my $modification_line = $buffer->GetModificationLine() ;
957 7 my $modification_character = $buffer->GetModificationCharacter() ;
958  
959 7 ▶if(0 <= $line_index && $line_index < $buffer->GetNumberOfLines())
Branch: 1 branch
BranchTrueFalseTotal
if (0 <= $line_index and $line_index < $buffer->GetNumberOfLines) { } 6 1 7
Condition66%2/3
0 <= $line_index and $line_index < $buffer->GetNumberOfLines
!ll&&!rl&&r
016
MC/DC50%1/2
0 <= $line_index and $line_index < $buffer->GetNumberOfLines
0 <= $line_index $line_index < $buffer->GetNumberOfLines
Truth table66%2/3
A and B
A= 0 <= $line_indexB= $line_index < $buffer->GetNumberOfLines
ABresult
0X0
100
111
960 {
961 6 my $line = $buffer->GetLine($line_index) ;
962 6 my $text = $line->{TEXT} ;
963 6 $line->{TEXT} = '' ;
964
965 6 $buffer->MarkBufferAsEdited() ;
966
967 6 PushUndoStep
968 (
969 $buffer
970 , "\$buffer->ClearLine($line_index) ;"
971 , [
972 "\$buffer->SetModificationPosition($line_index, 0) ;"
973 , '$buffer->Insert("' . Stringify($text) .'") ;'
974 , "\$buffer->SetModificationPosition($modification_line, $modification_character) ;"
975 ]
976
977 ) ;
978 }
979 else
980 {
981 1 $buffer->PrintError("GetLineText: Invalid line index: $line_index. Number of lines: " . $buffer->GetNumberOfLines(). "\n") ;
982 }
983 }
984  
985 #-------------------------------------------------------------------------------
986  
987 sub Delete
988 1573 ▶{
Subroutine Delete: called CC=8 SCAR=20.8
Pod documented
989  
990 =head2 Delete
991  
992 Deleted, from the modification position, the number of characters passed as argument.
993  
994 Deletes the selection if it exists; the deleted selection decrements the number of character to delete argument
995  
996 =cut
997  
998 1573 my $buffer = shift ;
999 1573 ▶my $a_number_of_character_to_delete = shift || 0 ;
Condition100%2/2
shift() || 0
l!l
1352221
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
1000  
1001 1573 ▶return if 0 >= $a_number_of_character_to_delete ;
Branch: 1 branch
BranchTrueFalseTotal
if 0 >= $a_number_of_character_to_delete 221 1352 1573
1002  
1003 1352 my $undo_block = new Text::Editor::Vip::CommandBlock($buffer, "\$buffer->Delete($a_number_of_character_to_delete) ;", ' #', "# undo for \$buffer->Delete($a_number_of_character_to_delete)", ' ') ;
1004  
1005 1352 ▶unless($buffer->{SELECTION}->IsEmpty())
Branch: 1 branch
BranchTrueFalseTotal
unless ($buffer->{"SELECTION"}->IsEmpty) 8 1344 1352
1006 {
1007 8 $buffer->DeleteSelection() ;
1008 8 $a_number_of_character_to_delete-- ;
1009 }
1010  
1011 1352 ▶return if 0 >= $a_number_of_character_to_delete ;
Branch: 1 branch
BranchTrueFalseTotal
if 0 >= $a_number_of_character_to_delete 6 1346 1352
1012  
1013 1346 my ($modification_line, $modification_character) = $buffer->GetModificationPosition() ;
1014 1346 my $line_length = $buffer->GetLineLength() ;
1015  
1016 1346 ▶if($modification_character < $line_length)
Branch: 1 branch
BranchTrueFalseTotal
if ($modification_character < $line_length) { } 677 669 1346
1017 {
1018 677 my $line_ref = \($buffer->GetLine($modification_line)->{TEXT}) ;
1019
1020 677 my $character_to_delete_on_this_line = min
1021 (
1022 $line_length - $modification_character
1023 , $a_number_of_character_to_delete
1024 ) ;
1025 677 my $deleted_text = substr
1026 (
1027 $$line_ref
1028 , $modification_character
1029 , $character_to_delete_on_this_line
1030 , ''
1031 ) ;
1032
1033 677 PushUndoStep
1034 (
1035 $buffer
1036 , "# deleting in current line"
1037 , [
1038 '$buffer->Insert("' . Stringify($deleted_text) . '") ;'
1039 , "\$buffer->SetModificationPosition($modification_line, $modification_character) ;"
1040 ]
1041 ) ;
1042
1043 677 $a_number_of_character_to_delete -= $character_to_delete_on_this_line ;
1044 }
1045 else
1046 {
1047 # at end of line, copy next line to this line
1048
1049 669 ▶ return if $modification_line == ($buffer->GetNumberOfLines() - 1) ;
Branch: 1 branch
BranchTrueFalseTotal
if $modification_line == $buffer->GetNumberOfLines - 1 1 668 669
1050
1051 668 $buffer->Insert($buffer->GetLine($modification_line + 1)->{TEXT}) ;
1052 668 $buffer->DeleteLine($modification_line + 1) ;
1053 668 $buffer->SetModificationPosition($modification_line, $modification_character) ;
1054
1055 668 $a_number_of_character_to_delete-- ; # delete '\n'
1056 }
1057
1058 1345 ▶if($a_number_of_character_to_delete)
Branch: 1 branch
BranchTrueFalseTotal
if ($a_number_of_character_to_delete) 2 1343 1345
1059 {
1060 2 $buffer->Delete($a_number_of_character_to_delete) ;
1061 }
1062  
1063 1345 $buffer->MarkBufferAsEdited() ;
1064 }
1065  
1066 #-------------------------------------------------------------------------------
1067  
1068 sub DeleteLine
1069 709 ▶{
Subroutine DeleteLine: called CC=5 SCAR=16.1
Pod documented
1070  
1071 =head2 DeleteLine
1072  
1073 Deleted, the line passed as argument. if no argument is passed, the current line is deleted.
1074 The selection and modification position are not modified.
1075  
1076 =cut
1077  
1078 709 my $buffer = shift ;
1079 709 my $a_line_to_delete_index = shift ;
1080  
1081 709 ▶$a_line_to_delete_index = $buffer->GetModificationLine() unless defined $a_line_to_delete_index ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $a_line_to_delete_index 1 708 709
1082  
1083 709 ▶return if $buffer->GetNumberOfLines() == 1 ; # buffer always has at least one line
Branch: 1 branch
BranchTrueFalseTotal
if $buffer->GetNumberOfLines == 1 0 709 709
1084  
1085 709 my ($modification_line, $modification_character) = $buffer->GetModificationPosition() ;
1086  
1087 709 my $text = Stringify($buffer->GetLineText($a_line_to_delete_index)) ;
1088  
1089 708 my $undo_block = new Text::Editor::Vip::CommandBlock($buffer, "# DeleteLine", ' ', '# undo for DeleteLine', ' ') ;
1090  
1091 708 ▶if($a_line_to_delete_index != ($buffer->GetNumberOfLines() - 1))
Branch: 1 branch
BranchTrueFalseTotal
if ($a_line_to_delete_index != $buffer->GetNumberOfLines - 1) { } 60 648 708
1092 {
1093 60 PushUndoStep
1094 (
1095 $buffer
1096 , "\$buffer->DeleteLine($a_line_to_delete_index) ;"
1097 , [
1098 "\$buffer->SetModificationPosition($a_line_to_delete_index, 0) ;"
1099 , "\$buffer->Insert(\"$text\\n\") ;"
1100 , "\$buffer->SetModificationPosition($modification_line, $modification_character) ;"
1101 ]
1102 ) ;
1103 }
1104 else
1105 {
1106 #deleting last line
1107 648 my $previous_line = $a_line_to_delete_index - 1 ;
1108 648 my $end_of_previous_line = $buffer->GetLineLength($previous_line) ;
1109
1110 648 PushUndoStep
1111 (
1112 $buffer
1113 , "\$buffer->DeleteLine($a_line_to_delete_index) ;"
1114 , [
1115 "\$buffer->SetModificationPosition($previous_line, $end_of_previous_line) ;"
1116 , "\$buffer->Insert(\"\\n$text\") ;"
1117 , "\$buffer->SetModificationPosition($modification_line, $modification_character) ;"
1118 ]
1119 ) ;
1120 }
1121
1122 708 ▶$buffer->{NODES}->DeleteNode($a_line_to_delete_index) if $buffer->GetNumberOfLines() > 1 ;
Branch: 1 branch
BranchTrueFalseTotal
if $buffer->GetNumberOfLines > 1 708 0 708
1123 708 $buffer->MarkBufferAsEdited() ;
1124 }
1125  
1126 #-------------------------------------------------------------------------------
1127  
1128 sub InsertNewLine
1129 2164 ▶{
Subroutine InsertNewLine: called CC=4 SCAR=13.9
Pod documented
1130  
1131 =head2 InsertNewLine
1132  
1133 Inserts a new line at the modification position. If the modification position is after the end of the
1134 current line, spaces are used to pad the current line.
1135  
1136 InsertNewLine takes one parameter that can be set to SMART_INDENTATION or NO_SMART_INDENTATION.
1137 If SMART_INDENTATION is used (default) , B<IndentNewLine> is called. B<IndentNewLine> does nothing by default.
1138 This lets you define your own indentation strategy. See B<IndentNewLine>.
1139  
1140 $buffer->Insert("hi\nThere\nWhats\nYour\nName\n") ;
1141  
1142 =cut
1143  
1144 2164 my $buffer = shift ;
1145 2164 ▶my $use_smart_indentation = shift || SMART_INDENTATION ;
Condition100%2/2
shift() || 1
l!l
21613
MC/DC100%1/1
shift() || 1
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
1146  
1147 2164 my $undo_block = new Text::Editor::Vip::CommandBlock($buffer, "InsertNewLine(\$buffer, $use_smart_indentation) ;", ' #', '# undo for InsertNewLine($use_smart_indentation)', ' ') ;
1148  
1149 2164 my ($modification_line, $modification_character) = $buffer->GetModificationPosition() ;
1150  
1151 2164 my $buffer_line = $buffer->GetLine($modification_line) ;
1152 2164 my $buffer_line_text = $buffer_line->{TEXT} ;
1153  
1154 2164 my $next_line_text = '' ;
1155  
1156 2164 ▶if($modification_character < length $buffer_line_text)
Branch: 1 branch
BranchTrueFalseTotal
if ($modification_character < length $buffer_line_text) 50 2114 2164
1157 {
1158 50 $next_line_text = substr($buffer_line_text, $modification_character) ;
1159 }
1160  
1161 2164 $buffer_line_text = substr($buffer_line_text, 0, $modification_character) ;
1162
1163 2164 $buffer_line->{TEXT} = $buffer_line_text ;
1164 2164 $buffer->{NODES}->InsertAfter($modification_line, {TEXT => $next_line_text} ) ;
1165  
1166 2164 $buffer->SetModificationPosition($modification_line + 1, 0) ;
1167  
1168 2164 PushUndoStep
1169 (
1170 $buffer
1171 , "\$buffer->InsertNewLine($use_smart_indentation) ;"
1172 , '$buffer->Backspace(1) ;'
1173 ) ;
1174  
1175 2164 ▶$buffer->IndentNewLine($modification_line + 1) if $use_smart_indentation ;
Branch: 1 branch
BranchTrueFalseTotal
if $use_smart_indentation 2164 0 2164
1176  
1177 2164 $buffer->MarkBufferAsEdited() ;
1178 }
1179  
1180 #-------------------------------------------------------------------------------
1181  
1182 sub Stringify
1183 4897 ▶{
Subroutine Stringify: called CC=4 SCAR=13.9
Pod documented
1184  
1185 =head2 Stringify
1186  
1187 Quotes a string or an array of string so it can be serialized in perl code
1188  
1189 =cut
1190  
1191 4897 my $text_to_stringify = shift ;
1192 4897 ▶$text_to_stringify = '' unless defined $text_to_stringify ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $text_to_stringify 0 4897 4897
1193  
1194 4897 my $stringified_text = '' ;
1195  
1196 4897 ▶my @text_to_stringify = ref($text_to_stringify) eq 'ARRAY' ? @$text_to_stringify: ($text_to_stringify) ;
Branch: 1 branch
BranchTrueFalseTotal
ref $text_to_stringify eq 'ARRAY' ? : 10 4887 4897
1197  
1198 4897 for(@text_to_stringify)
1199 {
1200 5574 s/\\/\\\\/g ;
1201
1202 5574 s/\$/\\\$/g ;
1203 5574 s/\@/\\\@/g ;
1204 5574 s/"/\\"/g ;
1205
1206 5574 s/\n/\\n/g ;
1207 5574 s/\t/\\t/g ;
1208 5574 s/\r/\\r/g ;
1209  
1210 5574 $stringified_text .= $_ ;
1211 }
1212
1213 4897 return($stringified_text) ;
1214 }
1215  
1216 #-------------------------------------------------------------------------------
1217  
1218 sub Insert
1219 1079 ▶{
Subroutine Insert: called CC=8 SCAR=20.8
Pod documented
1220  
1221 =head2 Insert
1222  
1223 Inserts a string or a list of strings, passed as an array reference, into the buffer.
1224  
1225 $buffer->Insert("bar") ;
1226
1227 my @text = ("Someone\n", "wants me\nNow") ;
1228 $buffer->Insert(\@text);
1229
1230 $buffer->Insert("\t something \n new") ;
1231  
1232 Only "\n" is considered special and forces the addition of a new line in the buffer.
1233  
1234 B<Insert> takes a second argument . When set to SMART_INDENTATION (the default),
1235 B<IndentNewLine> is called to indent the newly inserted line. The default B<IndentNewLine>
1236 does nothing but you can override it to implement any indentation you please. If you want to
1237 insert raw text, pass NO_SMART_INDENTATION as a second argument.
1238  
1239 NO_SMART_INDENTATION is defined in Text::Editor::Vip::Buffer::Constants.
1240  
1241 =cut
1242  
1243 1079 my $buffer = shift ;
1244 1079 my $text_to_insert = shift ;
1245 1079 ▶my $use_smart_indentation = shift || SMART_INDENTATION ;
Condition100%2/2
shift() || 1
l!l
351044
MC/DC100%1/1
shift() || 1
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
1246  
1247 1079 ▶$text_to_insert ='' unless defined $text_to_insert ;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $text_to_insert 1 1078 1079
1248 1079 my @text_to_insert ;
1249  
1250 1079 ▶if(ref($text_to_insert) eq 'ARRAY')
Branch: 1 branch
BranchTrueFalseTotal
if (ref $text_to_insert eq 'ARRAY') { } 10 1069 1079
1251 {
1252 10 @text_to_insert = @$text_to_insert ;
1253 }
1254 else
1255 {
1256 1069 @text_to_insert = ($text_to_insert) ;
1257 }
1258  
1259 1079 my $stringified_text_to_insert = Stringify($text_to_insert);
1260  
1261 1079 my $undo_block = new Text::Editor::Vip::CommandBlock
1262 (
1263 $buffer
1264 , "\$buffer->Insert(\"$stringified_text_to_insert\", $use_smart_indentation) ;", ' #'
1265 , "# undo for \$buffer->Insert(\"$stringified_text_to_insert\", $use_smart_indentation)", ' '
1266 ) ;
1267  
1268 1079 $buffer->DeleteSelection() ;
1269  
1270 1079 for(@text_to_insert)
1271 {
1272 1756 for(split /(\n)/) # transform a\nb\nccc into 3 lines
1273 {
1274 4588 ▶ if("\n" eq $_)
Branch: 1 branch
BranchTrueFalseTotal
if ("\n" eq $_) { } 2161 2427 4588
1275 {
1276 2161 $buffer->InsertNewLine($use_smart_indentation) ;
1277 }
1278 else
1279 {
1280 2427 my $line_ref = \($buffer->GetLine($buffer->GetModificationLine())->{TEXT}) ;
1281 2427 my $modification_character = $buffer->GetModificationCharacter() ;
1282 2427 my $line_length = length($$line_ref) ;
1283
1284 #do we need padding
1285 2427 ▶ if($modification_character - $line_length > 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($modification_character - $line_length > 0) 6 2421 2427
1286 {
1287 6 $buffer->SetModificationCharacter($line_length) ;
1288 6 $buffer->Insert(' ' x ($modification_character - $line_length)) ;
1289 }
1290
1291 # insert characters
1292 2427 substr($$line_ref, $modification_character, 0, $_) ;
1293
1294 2427 my $text_to_insert_length = length($_) ;
1295 2427 $stringified_text_to_insert = Stringify($_);
1296
1297 2427 PushUndoStep
1298 (
1299 $buffer
1300 , "\$buffer->Insert(\"$stringified_text_to_insert\", $use_smart_indentation) ;"
1301 , "\$buffer->Delete($text_to_insert_length) ;"
1302 ) ;
1303
1304 2427 $buffer->SetModificationCharacter($modification_character + length()) ;
1305 }
1306 }
1307
1308 1756 $buffer->MarkBufferAsEdited() ;
1309 }
1310 }
1311  
1312 #-------------------------------------------------------------------------------
1313  
1314 18 1 ;
1315  
1316 =head1 PLUGINS
1317  
1318 Vip::Buffer has a very simple plugin system. You can add a function to the buffer with
1319 L<ExpandWith>, L<LoadAndExpandWith> and L<ExpandedWithOrLoad>. The functions
1320 added through plugins are made available to the instance, calling the plugin sub, only.
1321  
1322 Think of it as a late inheritence that does the job it needs to do.
1323  
1324 Perl is full of wonders.
1325  
1326 =head1 BUGS
1327  
1328 =head1 AUTHOR
1329  
1330 Khemir Nadim ibn Hamouda
1331 CPAN ID: NKH
1332 mailto:nadim@khemir.net
1333 http:// no web site
1334  
1335 =head1 COPYRIGHT
1336  
1337 This program is free software; you can redistribute
1338 it and/or modify it under the same terms as Perl itself.
1339  
1340 The full text of the license can be found in the
1341 LICENSE file included with this module.
1342  
1343 =cut
« blib/lib/Text/Editor/Vip/Buffer/Plugins/Selection.pm ↑ Summary blib/lib/Text/Editor/Vip/Buffer/Plugins/PageUpDown.pm »