Commits

Herbert Breunung  committed 59f9660

moving selection or line to begin or end of doc

  • Participants
  • Parent commits f6bbba4

Comments (0)

Files changed (12)

File lib/Kephra.pm

 
 Copyright 2011 Herbert Breunung.
 
-This program is released under the following license: gpl v2
+This program is released under the license: gpl v2
 
 =cut

File lib/Kephra/App/Bar/Document.pm

 Kephra::CommandList::register_cmd_namespace('document');
 Kephra::CommandList::register_switch_var('Kephra::API::docbar');
 Kephra::CommandList::register_cmd({
-	'-select-left'   => { sub =>'$_->select_page_left',    label =>'Previous Tab',keys => 'ctrl+pageup'},
-	'-select-right'  => { sub =>'$_->select_page_right',   label =>'Next Tab',    keys => 'ctrl+pagedown'},
-	'-select-leftmost'=>{ sub =>'$_->select_page_leftmost',label =>'First Tab',   keys => 'ctrl+shift+pageup'},
-	'-select-rightmost'=>{sub =>'$_->select_page_rightmost',label=>'Last Tab',    keys => 'ctrl+shift+pagedown'},
-	'-move-left'     => { sub =>'$_->move_page_left',      label =>'Move Left',   keys => 'alt+pageup'},
-	'-move-right'    => { sub =>'$_->move_page_right',     label =>'Move Right',  keys => 'alt+pagedown'},
-	'-move-leftmost' => { sub =>'$_->move_page_leftmost',  label =>'Move Leftmost',keys=> 'alt+shift+pageup'},
-	'-move-rightmost'=> { sub =>'$_->move_page_rightmost', label =>'Move Rightmost',keys=>'alt+shift+pagedown'},
+ '-select-left'     =>{sub=>'$_->select_page_left',     label=>'Previous Tab',  keys=>'ctrl+pageup'},
+ '-select-right'    =>{sub=>'$_->select_page_right',    label=>'Next Tab',      keys=>'ctrl+pagedown'},
+ '-select-leftmost' =>{sub=>'$_->select_page_leftmost', label=>'First Tab',     keys=>'ctrl+shift+pageup'},
+ '-select-rightmost'=>{sub=>'$_->select_page_rightmost',label=>'Last Tab',      keys=>'ctrl+shift+pagedown'},
+ '-move-left'       =>{sub=>'$_->move_page_left',       label=>'Move Left',     keys=>'alt+pageup'},
+ '-move-right'      =>{sub=>'$_->move_page_right',      label=>'Move Right',    keys=>'alt+pagedown'},
+ '-move-leftmost'   =>{sub=>'$_->move_page_leftmost',   label=>'Move Leftmost', keys=>'alt+shift+pageup'},
+ '-move-rightmost'  =>{sub=>'$_->move_page_rightmost',  label=>'Move Rightmost',keys=>'alt+shift+pagedown'},
 });
 
 

File lib/Kephra/Edit.pm

 	$text = '' unless defined $text and $text;
 }
 
-sub copy_line {
-}
+#sub last_position {	my ($self) = @_; 	$self->} GetFirstVisibleLine
 
 sub replace {
 	my ($self) = @_;

File lib/Kephra/Edit/Comment.pm

 package Kephra::App::Editor;
 
 Kephra::CommandList::register_cmd({
-	'-comment-toggle'=>{ sub=> '$ed->toggle_comment', label=> 'Toggle Comment', keys=> 'alt+#' },
+ '-comment-toggle'=>{ sub=>'$ed->toggle_comment', label=>'Toggle Comment', keys=>'alt+#' },
 });
 
 

File lib/Kephra/Edit/Format.pm

 package Kephra::App::Editor;
 
 Kephra::CommandList::register_cmd({
-	'-indent-level'     =>{ sub=> '$ed->indent_level',  label=> 'Indent Level',  keys=> 'alt+right' },
-	'-dedent-level'     =>{ sub=> '$ed->dedent_level',  label=> 'Dedent Level',  keys=> 'alt+left' },
-	'-move-line-up'     =>{ sub=> '$ed->move_sel_or_line_up',  label=>'Line Up', keys=> 'alt+up' },
-	'-move-line-down'   =>{ sub=> '$ed->move_sel_or_line_down',label=>'Line Down',keys=>'alt+down' },
-	'-goto-block-up'    =>{ sub=> '$ed->ParaUp',        label=> 'Block Up',      keys=> 'ctrl+up' },
-	'-goto-block-down'  =>{ sub=> '$ed->ParaDown',      label=> 'Block Down',    keys=> 'ctrl+down' },
-	'-select-block-up'  =>{ sub=> '$ed->ParaUpExtend',  label=> 'Block Up',      keys=> 'ctrl+shift+up' },
-	'-select-block-down'=>{ sub=> '$ed->ParaDownExtend',label=> 'Block Down',    keys=> 'ctrl+shift+down' },
+ '-goto-block-up'    =>{sub=>'$ed->ParaUp',                   label=>'Block Up',    keys=>'ctrl+up' },
+ '-goto-block-down'  =>{sub=>'$ed->ParaDown',                 label=>'Block Down',  keys=>'ctrl+down' },
+ '-select-block-up'  =>{sub=>'$ed->ParaUpExtend',             label=>'Block Up',    keys=>'ctrl+shift+up' },
+ '-select-block-down'=>{sub=>'$ed->ParaDownExtend',           label=>'Block Down',  keys=>'ctrl+shift+down' },
+ '-indent-level'     =>{sub=>'$ed->indent_level',             label=>'Indent Level',keys=>'alt+right' },
+ '-dedent-level'     =>{sub=>'$ed->dedent_level',             label=>'Dedent Level',keys=>'alt+left' },
+ '-move-line-up'     =>{sub=>'$ed->move_sel_or_line_up',      label=>'Line Up',     keys=>'alt+up' },
+ '-move-line-down'   =>{sub=>'$ed->move_sel_or_line_down',    label=>'Line Down',   keys=>'alt+down' },
+ '-move-page-up'     =>{sub=>'$ed->move_sel_or_line_page_up', label=>'Page Up',     keys=>'' },
+ '-move-page-down'   =>{sub=>'$ed->move_sel_or_line_page_down',label=>'Page Down',  keys=>'' },
+ '-move-begin'       =>{sub=>'$ed->move_sel_or_line_begin',   label=>'Doc Begin',   keys=>'alt+home' },
+ '-move-end'         =>{sub=>'$ed->move_sel_or_line_end',     label=>'Doc End',     keys=>'alt+end' },
+ '-move-word-left'   =>{sub=>'$ed->move_sel_or_word_left',    label=>'Word Left',   keys=>'alt+shift+left' },
+ '-move-word-right'  =>{sub=>'$ed->move_sel_or_word_right',   label=>'Word Right',  keys=>'alt+shift+right' },
 });
 
 
 	$self->EndUndoAction;
 	#Kephra::API::log("$start, $end", 1);
 }
-sub move_sel_or_line_up      { $_[0]->move_sel_or_line(-1) }
-sub move_sel_or_line_down    { $_[0]->move_sel_or_line(+1) }
+sub move_sel_or_line_up      { $_[0]->move_sel_or_line( -1) }
+sub move_sel_or_line_down    { $_[0]->move_sel_or_line( +1) }
+sub move_sel_or_line_page_up { $_[0]->move_sel_or_line(-20) }
+sub move_sel_or_line_page_down{$_[0]->move_sel_or_line(+20) }
+sub move_sel_or_line_begin   { $_[0]->move_sel_or_line( -$_[0]->GetCurrentLine) }
+sub move_sel_or_line_end     { 
+	$_[0]->move_sel_or_line(   $_[0]->GetLineCount - $_[0]->GetCurrentLine-1 )
+}
 sub move_sel_or_line {
 	my ($self, $movement) = @_;
 	my ($start, $end) = $self->GetSelection;

File lib/Kephra/Edit/Search.pm

 package Kephra::App::Editor;
 
 Kephra::CommandList::register_cmd({
-	'-goto-char-left'   =>{ sub=>'$ed->CharLeft',         label=>'Char Left',   keys=> 'left' },
-	'-goto-char-right'  =>{ sub=>'$ed->CharRight',        label=>'Char Right',  keys=> 'right' },
-	'-select-char-left' =>{ sub=>'$ed->CharLeftExtend',   label=>'Select Left', keys=> 'shift+left' },
-	'-select-char-right'=>{ sub=>'$ed->CharRightExtend',  label=>'Select Right',keys=> 'shift+right' },
-	'-goto-word-left'   =>{ sub=>'$ed->WordLeft',         label=>'Word Left',   keys=> 'ctrl+left' },
-	'-goto-word-right'  =>{ sub=>'$ed->WordRight',        label=>'Word Right',  keys=> 'ctrl+right' },
-	'-select-word-left' =>{ sub=>'$ed->WordLeftExtend',   label=>'Word Left',   keys=> 'ctrl+shift+left' },
-	'-select-word-right'=>{ sub=>'$ed->WordRightExtend',  label=>'Word Right',  keys=> 'ctrl+shift+right' },
-	'-goto-line-start'  =>{ sub=>'$ed->Home',             label=>'Line Start',  keys=> 'home'},
-	'-goto-line-end'    =>{ sub=>'$ed->LineEnd',          label=>'Line End',    keys=> 'end' },
-	'-select-line-start'=>{ sub=>'$ed->HomeExtend',       label=>'Line Start',  keys=> 'shift+home'},
-	'-select-line-end'  =>{ sub=>'$ed->LineEndExtend',    label=>'Line End',    keys=> 'shift+end' },
-	#'-goto-line-up'     =>{ sub=>'$ed->LineUp',           label=>'Line Up',     keys => 'up' },
-	#'-goto-line-down'   =>{ sub=>'$ed->LineDown',         label=>'Line Down',   keys => 'down' },
-	'-select-line-up'   =>{ sub=>'$ed->LineUpExtend',     label=>'Line Up',     keys=> 'shift+up' },
-	'-select-line-down' =>{ sub=>'$ed->LineDownExtend',   label=>'Line Down',   keys=> 'shift+down' },
-	'-goto-page-up'     =>{ sub=>'$ed->PageUp',           label=>'Page Up',     keys=> 'pageup' },
-	'-goto-page-down'   =>{ sub=>'$ed->PageDown',         label=>'Page Down',   keys=> 'pagedown' },
-	'-select-page-up'   =>{ sub=>'$ed->PageUpExtend',     label=>'Page Up',     keys=> 'shift+pageup' },
-	'-select-page-down' =>{ sub=>'$ed->PageDownExtend',   label=>'Page Down',   keys=> 'shift+pagedown'},
-	'-goto-doc-start'   =>{ sub=>'$ed->DocumentStart',    label=>'Doc Start',   keys=> 'ctrl+home'},
-	'-goto-doc-end'     =>{ sub=>'$ed->DocumentEnd',      label=>'Doc End',     keys=> 'ctrl+end' },
-	'-select-doc-start' =>{ sub=>'$ed->DocumentStartExtend',label=>'Doc Start', keys=> 'ctrl+shift+home'},
-	'-select-doc-end'   =>{ sub=>'$ed->DocumentEndExtend',label=>'Doc End',     keys=> 'ctrl+shift+end' },
-	'-goto-last-change' =>{ sub=>'$ed->goto_last_change', label=>'Last Change', keys=> 'ctrl+shift+g'},
-	'-find-next-comment'=>{ sub=>'$ed->next_comment',     label=>'Next Comment',keys=> 'ctrl+#' },
-	'-find-prev-comment'=>{ sub=>'$ed->prev_comment',     label=>'Prev Comment',keys=> 'ctrl+shift+#' },
+ '-goto-char-left'   =>{sub=>'$ed->CharLeft',          label=>'Char Left',    keys=>'left' },
+ '-goto-char-right'  =>{sub=>'$ed->CharRight',         label=>'Char Right',   keys=>'right' },
+ '-select-char-left' =>{sub=>'$ed->CharLeftExtend',    label=>'Select Left',  keys=>'shift+left' },
+ '-select-char-right'=>{sub=>'$ed->CharRightExtend',   label=>'Select Right', keys=>'shift+right' },
+ '-goto-word-left'   =>{sub=>'$ed->WordLeft',          label=>'Word Left',    keys=>'ctrl+left' },
+ '-goto-word-right'  =>{sub=>'$ed->WordRight',         label=>'Word Right',   keys=>'ctrl+right' },
+ '-select-word-left' =>{sub=>'$ed->WordLeftExtend',    label=>'Word Left',    keys=>'ctrl+shift+left' },
+ '-select-word-right'=>{sub=>'$ed->WordRightExtend',   label=>'Word Right',   keys=>'ctrl+shift+right' },
+ '-goto-line-start'  =>{sub=>'$ed->Home',              label=>'Line Start',   keys=>'home'},
+ '-goto-line-end'    =>{sub=>'$ed->LineEnd',           label=>'Line End',     keys=>'end' },
+ '-select-line-start'=>{sub=>'$ed->HomeExtend',        label=>'Line Start',   keys=>'shift+home'},
+ '-select-line-end'  =>{sub=>'$ed->LineEndExtend',     label=>'Line End',     keys=>'shift+end' },
+ #'-goto-line-up'     =>{sub=>'$ed->LineUp',            label=>'Line Up',     keys =>'up' },
+ #'-goto-line-down'   =>{sub=>'$ed->LineDown',          label=>'Line Down',   keys => 'down' },
+ '-select-line-up'   =>{sub=>'$ed->LineUpExtend',      label=>'Line Up',      keys=>'shift+up' },
+ '-select-line-down' =>{sub=>'$ed->LineDownExtend',    label=>'Line Down',    keys=>'shift+down' },
+ '-goto-page-up'     =>{sub=>'$ed->PageUp',            label=>'Page Up',      keys=>'pageup' },
+ '-goto-page-down'   =>{sub=>'$ed->PageDown',          label=>'Page Down',    keys=>'pagedown' },
+ '-select-page-up'   =>{sub=>'$ed->PageUpExtend',      label=>'Page Up',      keys=>'shift+pageup' },
+ '-select-page-down' =>{sub=>'$ed->PageDownExtend',    label=>'Page Down',    keys=>'shift+pagedown'},
+ '-goto-doc-start'   =>{sub=>'$ed->DocumentStart',     label=>'Doc Start',    keys=>'ctrl+home'},
+ '-goto-doc-end'     =>{sub=>'$ed->DocumentEnd',       label=>'Doc End',      keys=>'ctrl+end' },
+ '-select-doc-start' =>{sub=>'$ed->DocumentStartExtend',label=>'Doc Start',   keys=>'ctrl+shift+home'},
+ '-select-doc-end'   =>{sub=>'$ed->DocumentEndExtend', label=>'Doc End',      keys=>'ctrl+shift+end' },
+ '-goto-last-change' =>{sub=>'$ed->goto_last_change',  label=>'Last Change',  keys=>'ctrl+shift+g'},
+ '-find-next-comment'=>{sub=>'$ed->next_comment',      label=>'Next Comment', keys=>'ctrl+#' },
+ '-find-prev-comment'=>{sub=>'$ed->prev_comment',      label=>'Prev Comment', keys=>'ctrl+shift+#' },
 });
 
 

File lib/Kephra/Internals.pod

 
 =head2  Why Perl
 
-=head2  What Part Of Perl We Use
+=over 4
+
+=item * flexible, human friendly syntax
+
+=item * has very good native Regex support
+
+=item * mature technology
+
+=item * CPAN
+
+=back
+
+=head2  What Part Of Perl We Use Or Avoid
 
 =head2  Principles
 

File lib/Kephra/KeyMap.pm

 	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,
 	back  => &Wx::WXK_BACK,        tab => &Wx::WXK_TAB,
 	esc   => &Wx::WXK_ESCAPE,    
 	enter => &Wx::WXK_RETURN,    space => &Wx::WXK_SPACE,
-	delete => &Wx::WXK_DELETE,  insert => &Wx::WXK_INSERT,
 	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,

File lib/Kephra/StyleGuide.pod

+=head1 Kephra Coding Style
+
+=head2 Technical Details
+
+    bracketing     = K & R
+    indention size = 4
+    use of tabs    = yes
+
+
+=head2 Organisation
+
+1 module - 1 namespace
+
+=head2 Naming
+
+We try to reuse same names for similar purposes,
+especially when its the same purpose through several modules,
+or the same data part through different structures.
+
+We also try to lean toward natural Perl names (eg 'sub' 'coderef', 'push').
+
+
+=head3 module/class Names
+
+titlecase / camelcase       ~~ LikeThis
+
+
+=head3 sub/method Names
+
+lowercase words separated by _ ~~ like_this
+
+routines only to be called inside a module start with one _
+avoid to call these from outside by all means
+
+create not make when we generate something
+
+=head3 Variable Names
+
+lowercase words separated by _ ~~ like_this
+We say active, no more current or recent.
+
+$self  reference of the class itself
+
+$ed    in most cases the active editor pane
+       (was renamed from $ep to prevent simple copy and paste of old code)
+
+$file  full file path, unless oyur specific like file_name, file_path etc.
+
+=head3 Command Names
+
+words separated by -
+
+=head3 Event Names
+
+words separated by .
+
+=head3 Key Definitions
+
+keys separated by +

File lib/Kephra/Versioning.pod

+=head1 Kephra Versioning Schema
+
+=head2 Goals
+
+=over 2
+
+=item * simple (as linear as possible - as a watch)
+
+=item * measures development status not time
+
+=item * no extras (Alpha, Beta, Release Candidate, Patchlevel)
+
+=back
+
+=head2 General Pattern
+
+  Revision . Stable . Testing . Development
+
+=head3 Development
+
+Development number is changed after every important commit.
+Normally after every day of development.
+
+Development releases come with no warranty whatsoever.
+
+=head3 Testing
+
+Testing number is raised if a new feature of importance has to attract
+the attention of the testers.
+
+Testing releases come with all known bugs disabled (if possible).
+Interfaces glitches may occur.
+
+=head3 Stable
+
+Stable number goes up if several greater new features are in
+and all known bugs are out.
+If there are still bugs,
+they have to be disabled with the feature there are sitting on.
+
+Stable releases should have a polished interface and no bugs.
+If one appears in 0.3 it will be fixed ASAP with 0.3.0.1 a.s.o.
+During a time window before releasing a stable version,
+all new features will go into a new branch, which will become 0.3.1.
+The next testing should be released soon after the stable is out.
+
+=head3 Revision
+
+Has the word vision in it. When I got my initial vision we are at 1.0.
+If I have a new one after that or we change a fundamental technology
+there is gonna be a 2.0. 
+Or in case we just want to break backward compatibelity of the Kephra::API.
+
+=head2 What Changed?
+
+We dropped the special patchlevel number.
+The version 0.3 Patchlevel 5 is now 0.3.0.5.

File lib/StyleGuide.pod

-=head1 Kephra Coding Style
-
-=head2 Technical Details
-
-    bracketing     = K & R
-    indention size = 4
-    use of tabs    = yes
-
-
-=head2 Organisation
-
-1 module - 1 namespace
-
-=head2 Naming
-
-We try to reuse same names for similar purposes,
-especially when its the same purpose through several modules,
-or the same data part through different structures.
-
-We also try to lean toward natural Perl names (eg 'sub' 'coderef', 'push').
-
-
-=head3 module/class Names
-
-titlecase / camelcase       ~~ LikeThis
-
-
-=head3 sub/method Names
-
-lowercase words separated by _ ~~ like_this
-
-routines only to be called inside a module start with one _
-avoid to call these from outside by all means
-
-create not make when we generate something
-
-=head3 Variable Names
-
-lowercase words separated by _ ~~ like_this
-We say active, no more current or recent.
-
-$self  reference of the class itself
-
-$ed    in most cases the active editor pane
-       (was renamed from $ep to prevent simple copy and paste of old code)
-
-$file  full file path, unless oyur specific like file_name, file_path etc.
-
-=head3 Command Names
-
-words separated by -
-
-=head3 Event Names
-
-words separated by .
-
-=head3 Key Definitions
-
-keys separated by +

File lib/Versioning.pod

-=head1 Kephra Versioning Schema
-
-=head2 Goals
-
-=over 2
-
-=item * simple (as linear as possible - as a watch)
-
-=item * measures development status not time
-
-=item * no extras (Alpha, Beta, Release Candidate, Patchlevel)
-
-=back
-
-=head2 General Pattern
-
-  Revision . Stable . Testing . Development
-
-=head3 Development
-
-Development number is changed after every important commit.
-Normally after every day of development.
-
-Development releases come with no warranty whatsoever.
-
-=head3 Testing
-
-Testing number is raised if a new feature of importance has to attract
-the attention of the testers.
-
-Testing releases come with all known bugs disabled (if possible).
-Interfaces glitches may occur.
-
-=head3 Stable
-
-Stable number goes up if several greater new features are in
-and all known bugs are out.
-If there are still bugs,
-they have to be disabled with the feature there are sitting on.
-
-Stable releases should have a polished interface and no bugs.
-If one appears in 0.3 it will be fixed ASAP with 0.3.0.1 a.s.o.
-During a time window before releasing a stable version,
-all new features will go into a new branch, which will become 0.3.1.
-The next testing should be released soon after the stable is out.
-
-=head3 Revision
-
-Has the word vision in it. When I got my initial vision we are at 1.0.
-If I have a new one after that or we change a fundamental technology
-there is gonna be a 2.0. 
-Or in case we just want to break backward compatibelity of the Kephra::API.
-
-=head2 What Changed?
-
-We dropped the special patchlevel number.
-The version 0.3 Patchlevel 5 is now 0.3.0.5.