Kephra / lib / Kephra /

use strict;
use warnings;

use Wx;
use Kephra::Config;
use Kephra::CommandList;

#package Kephra::Edit;

package Kephra::App::Editor;
	'-undo'             =>{sub=>'$ed->Undo',             label=>'Undo',          keys=> 'ctrl+z'},
	'-redo'             =>{sub=>'$ed->Redo',             label=>'Redo',          keys=> 'ctrl+shift+z'},
	'-copy'             =>{sub=>'$ed->Copy',             label=>'Copy',          keys=> 'ctrl+c' },
	'-copy-line'        =>{sub=>'$ed->LineCopy',         label=>'Copy Line',     keys=> 'ctrl+shift+c'},
	'-cut'              =>{sub=>'$ed->Cut',              label=>'Cut',           keys=> 'ctrl+x'},
	'-delete'           =>{sub=>'$ed->Clear',            label=>'Delete',        keys=> 'delete'},
	'-delete-back'      =>{sub=>'$ed->DeleteBack',       label=>'Del Back',      keys=> 'back'},
	'-delete-word-left' =>{sub=>'$ed->DelWordLeft',      label=>'Del Word Left', keys=> 'ctrl+back'},
	'-delete-word-right'=>{sub=>'$ed->DelWordRight',     label=>'Del Word Right',keys=> 'ctrl+delete'},
	'-delete-line'      =>{sub=>'$ed->LineDelete',       label=>'Del Line',      keys=> 'ctrl+shift+delete'},
	'-insert'           =>{sub=>'$ed->Paste',            label=>'Insert',        keys=> 'ctrl+v'}, # thats what sometimes called paste
	'-insert-newline'   =>{sub=>'$ed->NewLine',          label=>'Newline',       keys=> 'enter'},
	'-replace'          =>{sub=>'$ed->replace',          label=>'Replace',       keys=> 'ctrl+shift+v'},
	'-double'           =>{sub=>'$ed->SelectionDuplicate',label=>'Double',       keys=> 'ctrl+d'},
	'-select-form'      =>{sub=>'$ed->select_form',      label=>'Form',          keys=> 'ctrl+y'},
	'-select-content'   =>{sub=>'$ed->select_content',   label=>'Content',       keys=> 'ctrl+shift+y'},

sub get_clipboard_text {
	my $text;
	my $cboard = &Wx::wxTheClipboard;
	if ( $cboard->IsSupported( &Wx::wxDF_TEXT ) ) {
		my $data = Wx::TextDataObject->new;
		my $ok = $cboard->GetData( $data );
		if ( $ok ) { $text = $data->GetText; }
		else { # todo: error handling
	$text = '' unless defined $text and $text;

#sub visual_height {	my ($self) = @_; 	$self->GetFirstVisibleLine; $self->}

sub replace {
	my ($self) = @_;
	return unless $self->CanPaste;
	my ($begin, $end_a) = $self->GetSelection();
	$self->SetSelection($begin, $begin);
	my $end_b = $self->GetCurrentPos();
	$self->SetSelection($end_b, $end_b + $end_a - $begin);
	$self->SetSelection($begin, $begin + $end_b - $begin);

sub select_form {
	my ($self) = @_;


sub select_content {
	my ($self) = @_;


Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.