Herbert Breunung avatar Herbert Breunung committed f5b432d

polish sed.pl

Comments (0)

Files changed (3)

lib/Kephra/API/KeyMap.pm

-use strict;
+use v5.12;
 use warnings;
 use Wx;
-use Kephra::API;
 
 package Kephra::API::KeyMap;
+use Kephra::API qw(warning);
 
 my %definition;
 my %code;
-my %mod_key_value = ( shift => 1000, ctrl => 2000, alt  => 4000);
+my %mod_key_value = ( shift => 1000, ctrl => 2000, alt  => 4000, meta => 8000);
 my %key_value = (
 	left  => &Wx::WXK_LEFT,      right => &Wx::WXK_RIGHT,
 	up    => &Wx::WXK_UP,         down => &Wx::WXK_DOWN,
 	pageup=> &Wx::WXK_PAGEUP, pagedown => &Wx::WXK_PAGEDOWN,
 	home  => &Wx::WXK_HOME,        end => &Wx::WXK_END,
-	delete => &Wx::WXK_DELETE,  insert => &Wx::WXK_INSERT,
+	delete=> &Wx::WXK_DELETE,   insert => &Wx::WXK_INSERT,
 	back  => &Wx::WXK_BACK,        tab => &Wx::WXK_TAB,
 	esc   => &Wx::WXK_ESCAPE,    
 	enter => &Wx::WXK_RETURN,    space => &Wx::WXK_SPACE,
 	F1 => &Wx::WXK_F1, F2 => &Wx::WXK_F2,  F3 => &Wx::WXK_F3,  F4 => &Wx::WXK_F4,
 	F5 => &Wx::WXK_F5, F6 => &Wx::WXK_F6,  F7 => &Wx::WXK_F7,  F8 => &Wx::WXK_F8,
 	F9 => &Wx::WXK_F9,F10 => &Wx::WXK_F10,F11 => &Wx::WXK_F11,F12 => &Wx::WXK_F12,
-	pound => 35, plus => 43, minus => 45, sharp => 47, tilde => 92, 
+	pound     => 35, plus => 43,        minus => 45, sharp => 47,    tilde => 92, 
 	num_left  => &Wx::WXK_NUMPAD_LEFT,  num_right=> &Wx::WXK_NUMPAD_RIGHT,
 	num_up    => &Wx::WXK_NUMPAD_UP,    num_down => &Wx::WXK_NUMPAD_DOWN,
 	num_space => &Wx::WXK_NUMPAD_SPACE, num_tab  => &Wx::WXK_NUMPAD_TAB,

lib/Kephra/App/Editor.pm

 	my ($self, $font) = @_;
 	my ( $fontweight, $fontstyle ) = ( &Wx::wxNORMAL, &Wx::wxNORMAL );
 	$font = {
-		family => 'Courier New', # old default
+		family => 'Courier', # old default
 		#family => 'DejaVu Sans Mono', # new
 		size => 11,
 		style => 'normal',
 	 $self->StyleSetSpec(2,"fore:#aaaaaa");                                     # Comment
 	 $self->StyleSetSpec(3,"fore:#004000,back:#E0FFE0,$(font.text),eolfilled"); # POD: = at beginning of line
 	 $self->StyleSetSpec(&Wx::wxSTC_PL_NUMBER,"fore:#007f7f");                                     # Number
-	 $self->StyleSetSpec(5,"fore:#000077,bold");                                # Keywords
+	 $self->StyleSetSpec(5,"fore:#000077");                                     # Keywords # ,bold
 	 $self->StyleSetSpec(6,"fore:#ee7b00,back:#fff8f8");                        # Doublequoted string
 	 $self->StyleSetSpec(7,"fore:#f36600,back:#fffcff");                        # Single quoted string
 	 $self->StyleSetSpec(8,"fore:#555555");                                     # Symbols / Punctuation. Currently not used by LexPerl.
 
 	Wx::Event::EVT_KEY_DOWN($ed , sub {
 		my ($ed, $event) = @_;
-		my $def = Kephra::API::KeyMap::definition_from_event($event);
-		if    ($def eq 'ctrl+o'){ open_file( Kephra::App::Dialog::get_file_open() ) }
-		elsif ($def eq 'ctrl+q'){ $self->Close }
-		elsif ($def eq 'ctrl+s'){
-			Kephra::IO::LocalFile::write( $file, $encoding, $ed->GetText() );
-			$ed->SetSavePoint;
-		} 
-		else                    { $event->Skip }
+		given (Kephra::API::KeyMap::definition_from_event($event)){
+			when('ctrl+o'){ open_file( Kephra::App::Dialog::get_file_open() ) }
+			when('ctrl+q'){ $self->Close }
+			when('ctrl+s'){
+				Kephra::IO::LocalFile::write( $file, $encoding, $ed->GetText() );
+				$ed->SetSavePoint;
+			} 
+			default       { $event->Skip }
+		}
 	});
 	open_file(__FILE__); #say $Kephra::API::VERSION;
 	return $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 ProjectModifiedEvent.java.
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.