@@ -424,59 +424,61 @@ namespace Files.View {
424424
425425 View . Slot ? to_activate = null ;
426426 var prefs = Files . Preferences . get_default ();
427- switch (keyval) {
428- case Gdk . Key . Left :
429- if (current_position > 0 ) {
430- if (prefs. show_file_preview) {
431- clear_file_details ();
432- }
433-
434- to_activate = slot_list. nth_data (current_position - 1 );
435- }
436-
437- break ;
438427
439- case Gdk . Key . Right :
440- if (current_slot. get_selected_files () == null ) {
441- return true ;
442- }
428+ uint up_key;
429+ uint down_key;
443430
444- Files . File ? selected_file = current_slot. get_selected_files (). data;
445- if (selected_file == null ) {
446- return true ;
447- }
431+ // Determine which key is the "drill down" key based on the layout direction
432+ if (Gtk . StateFlags . DIR_RTL in scrolled_window. get_style_context (). get_state ()) {
433+ up_key = Gdk . Key . Right ;
434+ down_key = Gdk . Key . Left ;
435+ } else {
436+ up_key = Gdk . Key . Left ;
437+ down_key = Gdk . Key . Right ;
438+ }
448439
449- GLib . File current_location = selected_file . location;
450- GLib . File ? next_location = null ;
451- if (current_position < slot_list . length () - 1 ) { // Can be assumed to limited in length
452- next_location = slot_list . nth_data (current_position + 1 ) . location ;
440+ if (keyval == up_key) {
441+ if (current_position > 0 ) {
442+ if (prefs . show_file_preview) {
443+ clear_file_details () ;
453444 }
454445
455- if (next_location != null && next_location. equal (current_location)) {
456- to_activate = slot_list. nth_data (current_position + 1 );
457- } else if (selected_file. is_folder ()) {
458- add_location (current_location, current_slot);
459- return true ;
460- }
446+ to_activate = slot_list. nth_data (current_position - 1 );
447+ }
461448
462- break ;
449+ } else if (keyval == down_key) {
450+ if (current_slot. get_selected_files () == null ) {
451+ return true ;
452+ }
463453
464- case Gdk . Key . BackSpace :
465- if (current_position > 0 ) {
466- truncate_list_after_slot (slot_list. nth_data (current_position - 1 ));
467- } else {
468- ctab. go_up ();
469- return true ;
470- }
454+ Files . File ? selected_file = current_slot. get_selected_files (). data;
455+ if (selected_file == null ) {
456+ return true ;
457+ }
471458
472- if (prefs. show_file_preview) {
473- clear_file_details ();
474- }
459+ GLib . File current_location = selected_file. location;
460+ GLib . File ? next_location = null ;
461+ if (current_position < slot_list. length () - 1 ) { // Can be assumed to limited in length
462+ next_location = slot_list. nth_data (current_position + 1 ). location;
463+ }
475464
476- break ;
465+ if (next_location != null && next_location. equal (current_location)) {
466+ to_activate = slot_list. nth_data (current_position + 1 );
467+ } else if (selected_file. is_folder ()) {
468+ add_location (current_location, current_slot);
469+ return true ;
470+ }
471+ } else if (keyval == Gdk . Key . BackSpace ) {
472+ if (current_position > 0 ) {
473+ truncate_list_after_slot (slot_list. nth_data (current_position - 1 ));
474+ } else {
475+ ctab. go_up ();
476+ return true ;
477+ }
477478
478- default:
479- break ;
479+ if (prefs. show_file_preview) {
480+ clear_file_details ();
481+ }
480482 }
481483
482484 if (to_activate != null ) {
0 commit comments