lib/Kephra/App/Editor/View.pm

filter: Statementstmt 7.4% 6 / 81 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 8.7% 2 / 23 Podpod n/a totaltotal 6.0% 8 / 133 CC 14 SCAR 24.5
CC
14
Cov
6%
set_margin
42.0
toggle_view_right_margin
12.0
toggle_view_line_nr_margin
12.0
CRAP 11.6
« lib/Kephra/App/Editor/Property.pm ↑ Summary lib/Kephra/App/Editor/Goto.pm »
1 1 ▶use v5.12;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package Kephra::App::Editor::View;
5 package Kephra::App::Editor;
6  
7 0 ▶sub set_margin {
Subroutine set_margin: not called CC=6 SCAR=37.4
8 0 my ($self, $style) = @_;
9  
10 0 ▶ if (not defined $style or not $style or $style eq 'default') {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $style && $style or $style eq 'default') { } 0 0 0
elsif ($style eq 'no') { } 0 0 0
Condition0%0/6
not defined $style && $style or $style eq "default"
l!l&&r!l&&!r
000
defined $style && $style
!ll&&!rl&&r
000
MC/DC0%0/3
not defined $style && $style or $style eq "default"
defined $style $style $style eq "default"
Truth table0%0/4
not(A && B) or C
A= defined $styleB= $styleC= $style eq "default"
ABCresult
0XX1
10X1
1111
1100
11 0 $self->SetMarginType( 0, &Wx::wxSTC_MARGIN_SYMBOL );
12 0 $self->SetMarginType( 1, &Wx::wxSTC_MARGIN_NUMBER );
13 0 $self->SetMarginType( 2, &Wx::wxSTC_MARGIN_SYMBOL );
14 0 $self->SetMarginType( 3, &Wx::wxSTC_MARGIN_SYMBOL );
15 0 $self->SetMarginMask( 0, 0x01FFFFFF );
16 0 $self->SetMarginMask( 1, 0 );
17 0 $self->SetMarginMask( 2, 0x01FFFFFF); # | &Wx::wxSTC_MASK_FOLDERS
18 0 $self->SetMarginMask( 3, &Wx::wxSTC_MASK_FOLDERS );
19 0 $self->SetMarginSensitive( 0, 1 );
20 0 $self->SetMarginSensitive( 1, 1 );
21 0 $self->SetMarginSensitive( 2, 1 );
22 0 $self->SetMarginSensitive( 3, 0 );
23 0 $self->SetMarginWidth(0, 1);
24 0 $self->SetMarginWidth(1, 47);
25 0 $self->SetMarginWidth(2, 22);
26 0 $self->SetMarginWidth(3, 2);
27 # extra text margin
28 }
29 0 elsif ($style eq 'no') { $self->SetMarginWidth($_, 0) for 1..3 }
30  
31 # extra margin left and right inside the white text area
32 0 $self->SetMargins(2, 2);
33 0 $self;
34 }
35  
36 0 ▶sub view_whitespace_mode { int $_[0]->GetViewWhiteSpace }
Subroutine view_whitespace_mode: not called CC=1 SCAR=6.9
37 0 ▶sub toggle_view_whitespace {
Subroutine toggle_view_whitespace: not called CC=1 SCAR=6.9
38 0 my ($self) = @_;
39 0 my $visible = ! $self->view_whitespace_mode;
40 0 $self->SetViewWhiteSpace( $visible );
41 0 $self->GetParent->GetMenuBar->Check(16110, $visible);
42 }
43  
44 0 ▶sub view_eol_mode { int $_[0]->GetViewEOL }
Subroutine view_eol_mode: not called CC=1 SCAR=6.9
45 0 ▶sub toggle_view_eol {
Subroutine toggle_view_eol: not called CC=1 SCAR=6.9
46 0 my ($self) = @_;
47 0 my $visible = ! $self->view_eol_mode;
48 0 $self->SetViewEOL( $visible );
49 0 $self->GetParent->GetMenuBar->Check(16120, $visible);
50 }
51  
52 0 ▶sub indent_guide_mode { int $_[0]->GetIndentationGuides }
Subroutine indent_guide_mode: not called CC=1 SCAR=6.9
53 0 ▶sub toggle_view_indent_guide {
Subroutine toggle_view_indent_guide: not called CC=1 SCAR=6.9
54 0 my ($self) = @_;
55 0 my $visible = ! $self->indent_guide_mode;
56 0 $self->SetIndentationGuides( $visible );
57 0 $self->GetParent->GetMenuBar->Check(16130, $visible);
58 }
59  
60 0 ▶sub right_margin_mode { int $_[0]->GetEdgeMode }
Subroutine right_margin_mode: not called CC=1 SCAR=6.9
61 0 ▶sub toggle_view_right_margin {
Subroutine toggle_view_right_margin: not called CC=3 SCAR=24.8
62 0 my ($self) = @_;
63 0 my $visible = ! $self->right_margin_mode;
64 0 ▶ $self->SetEdgeMode( $visible ? &Wx::wxSTC_EDGE_LINE : 0 );
Branch: 1 branch
BranchTrueFalseTotal
$visible ? : 0 0 0
65 0 ▶ $self->GetParent->GetMenuBar->Check(16140, $visible ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$visible ? : 0 0 0
66 }
67  
68 0 ▶sub line_nr_margin_mode { int $_[0]->GetMarginWidth(1) }
Subroutine line_nr_margin_mode: not called CC=1 SCAR=6.9
69 0 ▶sub toggle_view_line_nr_margin {
Subroutine toggle_view_line_nr_margin: not called CC=3 SCAR=24.8
70 0 my ($self) = @_;
71 0 my $visible = ! $self->line_nr_margin_mode;
72 0 ▶ $self->SetMarginWidth(1, ($visible ? 47 : 0) );
Branch: 1 branch
BranchTrueFalseTotal
$visible ? : 0 0 0
73 0 ▶ $self->GetParent->GetMenuBar->Check(16210, $visible ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$visible ? : 0 0 0
74 }
75  
76 0 ▶sub marker_margin_mode { int $_[0]->GetMarginWidth(2) }
Subroutine marker_margin_mode: not called CC=1 SCAR=6.9
77 0 ▶sub toggle_view_marker_margin {
Subroutine toggle_view_marker_margin: not called CC=3 SCAR=24.8
78 0 my ($self) = @_;
79 0 my $visible = ! $self->marker_margin_mode;
80 0 ▶ $self->SetMarginWidth(2, ($visible ? 22 : 0) );
Branch: 1 branch
BranchTrueFalseTotal
$visible ? : 0 0 0
81 0 ▶ $self->GetParent->GetMenuBar->Check(16220, $visible ? 1 : 0);
Branch: 1 branch
BranchTrueFalseTotal
$visible ? : 0 0 0
82 }
83  
84 0 ▶sub line_wrap_mode { int $_[0]->GetWrapMode }
Subroutine line_wrap_mode: not called CC=1 SCAR=6.9
85 0 ▶sub toggle_view_line_wrap {
Subroutine toggle_view_line_wrap: not called CC=1 SCAR=6.9
86 0 my ($self) = @_;
87 0 my $on = ! $self->line_wrap_mode;
88 0 $self->SetWrapMode( $on );
89 0 $self->GetParent->GetMenuBar->Check( 16420, $on );
90 }
91  
92 0 ▶sub view_caret_line_mode { int $_[0]->GetCaretLineVisible }
Subroutine view_caret_line_mode: not called CC=1 SCAR=6.9
93 0 ▶sub toggle_view_caret_line {
Subroutine toggle_view_caret_line: not called CC=1 SCAR=6.9
94 0 my ($self) = @_;
95 0 my $on = ! $self->view_caret_line_mode;
96 0 $self->SetCaretLineVisible( $on );
97 0 $self->GetParent->GetMenuBar->Check( 16430, $on );
98 }
99  
100 0 ▶sub get_zoom_level { $_[0]->GetZoom }
Subroutine get_zoom_level: not called CC=1 SCAR=6.9
101 0 ▶sub set_zoom_level {
Subroutine set_zoom_level: not called CC=1 SCAR=6.9
102 0 my ($self, $level) = @_;
103 0 $self->SetZoom( $level );
104 0 $self->GetParent->GetMenuBar->Check( 16340+$level, 1 );
105 }
106  
107 0 ▶sub zoom_in {
Subroutine zoom_in: not called CC=2 SCAR=17.9
108 0 my ($self, $level) = @_;
109 0 my $lvl = $self->get_zoom_level();
110 0 $lvl++;
111 0 ▶ $lvl = 20 if $lvl > 20;
Branch: 1 branch
BranchTrueFalseTotal
if $lvl > 20 0 0 0
112 0 $self->set_zoom_level( $lvl );
113 }
114 0 ▶sub zoom_out {
Subroutine zoom_out: not called CC=2 SCAR=17.9
115 0 my ($self, $level) = @_;
116 0 my $lvl = $self->get_zoom_level( );
117 0 $lvl--;
118 0 ▶ $lvl = -10 if $lvl < -10;
Branch: 1 branch
BranchTrueFalseTotal
if $lvl < -10 0 0 0
119 0 $self->set_zoom_level( $lvl );
120 }
121  
122 1 1;
« lib/Kephra/App/Editor/Property.pm ↑ Summary lib/Kephra/App/Editor/Goto.pm »