Commits

Herbert Breunung  committed 3944456

added got last edit, a few of these+save and were ready for usage

  • Participants
  • Parent commits 4112270

Comments (0)

Files changed (2)

File lib/Kephra/App/Editor.pm

 	#Wx::Event::EVT_MENU( $self, 1000, sub { $_[1]->Skip; } );
 	#Wx::Event::EVT_STC_SAVEPOINTREACHED($self, -1, \&Kephra::File::savepoint_reached);
 	#Wx::Event::EVT_STC_SAVEPOINTLEFT($self, -1, \&Kephra::File::savepoint_left);
-	#Wx::Event::EVT_STC_CHANGE       ($self, -1, sub { my ($ed, $event) = @_; $event->Skip; } );
+	Wx::Event::EVT_STC_CHANGE       ($self, -1, sub {
+		my ($ed, $event) = @_;
+		$event->Skip;
+		$ed->{'edit_pos'} = $ed->GetCurrentPos;
+	} );
 	Wx::Event::EVT_KEY_DOWN ($self, sub {
 		my ($ed, $event) = @_;
 		my $key = Kephra::App::Util::keycode_from_event($event);
 		elsif ($key ==      ord('#')    + 4000){$self->toggle_comment() }
 		#elsif ($key ==      ord('#')    + 5000){$self->decomment() }
 		elsif ($key ==      ord('G')    + 3000){$self->goto_last_edit() } # last selection?
-		elsif ($key ==      ord('G')    + 5000){$self->goto_last_edit() }
+		elsif ($key ==      ord('G')    + 5000){ }
 		elsif ($key ==      ord('Q')    + 2000){Kephra::File::close_active() }
 		elsif ($key ==      ord('Q')    + 4000){Kephra::API::app()->close_save }
+		elsif ($key ==      ord('Y')    + 2000){$self->select_form() }
+		elsif ($key ==      ord('Y')    + 3000){$self->select_content() }
 		elsif ($key ==      ord('Z')    + 3000){$self->redo() }
 		else {$event->Skip}
 	});

File lib/Kephra/Edit.pm

 #package Kephra::Edit;
 package Kephra::App::Editor;
 
+sub undo { $_[0]->Undo }
+sub redo { $_[0]->Redo }
 
 sub move_sel_or_word_left  { $_[0]->move_sel_or_word(-1) }
 sub move_sel_or_word_right { $_[0]->move_sel_or_word(+1) }
 	$self->GotoPos( $found != -1 ? $found : $start );
 }
 
-sub goto_last_edit{}
-sub redo { $_[0]->Redo }
+sub goto_last_edit {
+	my ($self) = @_;
+	$self->GotoPos( $self->{'edit_pos'} ) if exists $self->{'edit_pos'};
+}
+
+sub select_form {}
+sub select_content {}
 
 1;