File Coverage

lib/Kephra/Document/Change.pm
Criterion Covered Total %
statement 6 26 23.0
branch 0 4 0.0
condition 0 3 0.0
subroutine 2 9 22.2
pod 0 7 0.0
total 8 49 16.3


line stmt bran cond sub pod time code
1             package Kephra::Document::Change;
2             our $VERSION = '0.07';
3            
4 1     1   962 use strict;
  1         45  
  1         29  
5 1     1   4 use warnings;
  1         1  
  1         297  
6             #
7             # changing the current document
8             #
9             # set document with a given nr as current document
10 0     0 0   sub to_nr { to_number(@_) }
11             sub to_number {
12 0     0 0   my $new_doc = Kephra::Document::Data::validate_doc_nr(shift);
13 0           my $old_doc = Kephra::Document::Data::current_nr();
14 0 0 0       if ($new_doc != $old_doc and $new_doc > -1) {
15 0           Kephra::Document::Data::update_attributes($old_doc);
16 0 0         Kephra::File::save_current() if Kephra::File::_config()->{save}{change_doc};
17 0           Kephra::Document::Data::set_current_nr($new_doc);
18 0           Kephra::Document::Data::set_previous_nr($old_doc);
19 0           Kephra::App::Window::refresh_title();
20 0           Kephra::App::TabBar::raise_tab_by_doc_nr($new_doc);
21 0           Kephra::App::StatusBar::refresh_all_cells();
22 0           Kephra::EventTable::trigger_group( 'doc_change' );
23 0           Kephra::App::EditPanel::gets_focus();
24 0           return 1;
25             } else {
26             #print "not changed\n"
27             }
28 0           return 0;
29             }
30             #sub to_path{} # planing
31             # change to the previous used document
32 0     0 0   sub switch_back { to_number( Kephra::Document::Data::previous_nr() ) }
33             # change to the previous used document
34 0     0 0   sub tab_left { Kephra::App::TabBar::raise_tab_left() }
35 0     0 0   sub tab_right { Kephra::App::TabBar::raise_tab_right() }
36 0     0 0   sub move_left { Kephra::App::TabBar::rotate_tab_left() }
37 0     0 0   sub move_right{ Kephra::App::TabBar::rotate_tab_right()}
38            
39             1;