| 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::Edit; | ||||||||||
| 5 | |||||||||||
| 6 | package Kephra::App::Editor; | ||||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | sub copy { | ||||||||
|
Subroutine
copy: not called CC=2 SCAR=17.9
| |||||||||||
| 9 | 0 | my $self = shift; | |||||||||
| 10 | 0 | my ($start_pos, $end_pos) = $self->GetSelection; | |||||||||
| 11 | 0 | ▶ | $start_pos == $end_pos ? $self->LineCopy : $self->Copy; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 12 | } | ||||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | sub cut { | ||||||||
|
Subroutine
cut: not called CC=2 SCAR=17.9
| |||||||||||
| 15 | 0 | my $self = shift; | |||||||||
| 16 | 0 | my ($start_pos, $end_pos) = $self->GetSelection; | |||||||||
| 17 | 0 | ▶ | $start_pos == $end_pos ? $self->LineCut : $self->Cut; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 0 | ▶ | sub duplicate { | ||||||||
|
Subroutine
duplicate: not called CC=2 SCAR=17.9
| |||||||||||
| 21 | 0 | my $self = shift; | |||||||||
| 22 | 0 | my ($start_pos, $end_pos) = $self->GetSelection; | |||||||||
| 23 | 0 | ▶ | $start_pos == $end_pos ? $self->LineDuplicate : $self->SelectionDuplicate; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub replace { | ||||||||
|
Subroutine
replace: not called CC=2 SCAR=17.9
| |||||||||||
| 27 | 0 | my $self = shift; | |||||||||
| 28 | 0 | my $sel = $self->GetSelectedText(); | |||||||||
| 29 | 0 | ▶ | return unless $sel; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | my ($old_start, $old_end) = $self->GetSelection; | |||||||||
| 31 | 0 | $self->BeginUndoAction(); | |||||||||
| 32 | 0 | $self->SetSelectionEnd( $old_start ); | |||||||||
| 33 | 0 | $self->Paste; | |||||||||
| 34 | 0 | my $new_start = $self->GetSelectionStart( ); | |||||||||
| 35 | 0 | my $new_end = $self->GetSelectionEnd( ); | |||||||||
| 36 | 0 | $self->SetSelection( $new_end, $new_end + $old_end - $old_start); | |||||||||
| 37 | 0 | $self->Cut; | |||||||||
| 38 | 0 | $self->SetSelection( $new_start, $new_end); | |||||||||
| 39 | 0 | $self->EndUndoAction(); | |||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | |||||||||||
| 43 | 0 | ▶ | sub insert_text { | ||||||||
|
Subroutine
insert_text: not called CC=2 SCAR=17.9
| |||||||||||
| 44 | 0 | my ($self, $text, $pos) = @_; | |||||||||
| 45 | 0 | ▶ | $pos = $self->GetCurrentPos unless defined $pos; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 0 | $self->InsertText($pos, $text); | |||||||||
| 47 | 0 | $pos += length $text; | |||||||||
| 48 | 0 | $self->SetSelection( $pos, $pos ); | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 0 | ▶ | sub delete_line { | ||||||||
|
Subroutine
delete_line: not called CC=1 SCAR=6.9
| |||||||||||
| 52 | 0 | my ($self) = @_; | |||||||||
| 53 | 0 | $self->LineDelete; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub fast_undo { | ||||||||
|
Subroutine
fast_undo: not called CC=3 SCAR=24.8
| |||||||||||
| 57 | 0 | my ($self) = @_; | |||||||||
| 58 | 0 | for (1..5){ | |||||||||
| 59 | 0 | ▶ | last unless $self->CanUndo; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | 0 | $self->Undo; | |||||||||
| 61 | } | ||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 0 | ▶ | sub fast_redo { | ||||||||
|
Subroutine
fast_redo: not called CC=3 SCAR=24.8
| |||||||||||
| 65 | 0 | my ($self) = @_; | |||||||||
| 66 | 0 | for (1..5){ | |||||||||
| 67 | 0 | ▶ | last unless $self->CanRedo; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 68 | 0 | $self->Redo; | |||||||||
| 69 | } | ||||||||||
| 70 | } | ||||||||||
| 71 | |||||||||||
| 72 | 0 | ▶ | sub total_undo { | ||||||||
|
Subroutine
total_undo: not called CC=2 SCAR=17.9
| |||||||||||
| 73 | 0 | my ($self) = @_; | |||||||||
| 74 | 0 | ▶ | $self->Undo while $self->CanUndo; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 0 | ▶ | sub total_redo { | ||||||||
|
Subroutine
total_redo: not called CC=2 SCAR=17.9
| |||||||||||
| 78 | 0 | my ($self) = @_; | |||||||||
| 79 | 0 | ▶ | $self->Redo while $self->CanRedo; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 80 | } | ||||||||||
| 81 | |||||||||||
| 82 | |||||||||||
| 83 | 1 | 1; | |||||||||