Commits

Herbert Breunung  committed 60579f3

kepp focus when opening file through file browser

  • Participants
  • Parent commits cb963c0

Comments (0)

Files changed (3)

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

 
 
 1;
-
-__END__
-
-
-file_open => {
-   call  => '',
-   state => '',
-   event => '',
-   label => 'Open',
-   help  => 'open one ore multiple files',
-   keys  => 'Ctrl + O',
-   icon  => '',
-},
-
-# enable=> '',

File lib/Kephra/App/Panel/Editor.pm

     my $doc = Kephra::API::active_doc();
     my $main_doc_bar = _active_docbar();
 
+    # doc is alreadopen
     if ( $file_path and Kephra::DocumentStash::file_loaded($file_path) ){
         $main_doc_bar->raise_panel( Kephra::DocumentStash::get_by_path($file_path)->{editor} );
     } elsif ($doc and $doc->editor->is_empty and $file_path) {
         $doc->load($file_path);
         $main_doc_bar->SetPageText( $main_doc_bar->GetSelection , $doc->file_name );
+        $doc->editor->set_focus()
     } else {
         $doc = Kephra::Document->new();
         $doc->load($file_path);

File lib/Kephra/App/Panel/FileBrowser.pm

         my $lib =  Cwd::cwd() . '/lib/'. $fb->GetItemText($event->GetItem) . '.pm';
         $lib =~ s|::|/|g;
         Kephra::File::open($lib);
+        Wx::Window::SetFocus( $fb );
         #print "$lib\n" if -e $lib;
     } );