@@ -23,7 +23,7 @@ use crate::{
2323 renderer:: { DrawCommand , WindowDrawCommand } ,
2424 running_tracker:: RunningTracker ,
2525 settings:: Settings ,
26- window:: { UserEvent , WindowCommand } ,
26+ window:: { UserEvent , WindowCommand , WindowSettings } ,
2727} ;
2828
2929#[ cfg( target_os = "macos" ) ]
@@ -553,32 +553,34 @@ impl Editor {
553553 }
554554 }
555555
556- if let Some ( Window {
557- window_type : WindowType :: Message { .. } ,
558- ..
559- } ) = window
560- {
561- // When the user presses ":" to type a command, the cursor is sent to the gutter
562- // in position 1 (right after the ":"). In all other cases, we want to skip
563- // positioning to avoid confusing movements.
564- let intentional = grid_left == 1 ;
565- // If the cursor was already in this message, we can still move within it.
566- let already_there = self . cursor . parent_window_id == grid;
567- // This ^ check alone is a bit buggy though, since it fails when the cursor is
568- // technically still in the edit window but "temporarily" at the cmdline. (#1207)
569- let using_cmdline = self
570- . current_mode_index
571- . map ( |current| current == MODE_CMDLINE )
572- . unwrap_or ( false ) ;
573-
574- if !intentional && !already_there && !using_cmdline {
575- trace ! (
576- "Cursor unexpectedly sent to message buffer {} ({}, {})" ,
577- grid,
578- grid_left,
579- grid_top
580- ) ;
581- return ;
556+ if self . settings . get :: < WindowSettings > ( ) . cursor_hack {
557+ if let Some ( Window {
558+ window_type : WindowType :: Message { .. } ,
559+ ..
560+ } ) = window
561+ {
562+ // When the user presses ":" to type a command, the cursor is sent to the gutter
563+ // in position 1 (right after the ":"). In all other cases, we want to skip
564+ // positioning to avoid confusing movements.
565+ let intentional = grid_left == 1 ;
566+ // If the cursor was already in this message, we can still move within it.
567+ let already_there = self . cursor . parent_window_id == grid;
568+ // This ^ check alone is a bit buggy though, since it fails when the cursor is
569+ // technically still in the edit window but "temporarily" at the cmdline. (#1207)
570+ let using_cmdline = self
571+ . current_mode_index
572+ . map ( |current| current == MODE_CMDLINE )
573+ . unwrap_or ( false ) ;
574+
575+ if !intentional && !already_there && !using_cmdline {
576+ trace ! (
577+ "Cursor unexpectedly sent to message buffer {} ({}, {})" ,
578+ grid,
579+ grid_left,
580+ grid_top
581+ ) ;
582+ return ;
583+ }
582584 }
583585 }
584586
0 commit comments