@@ -1848,7 +1848,8 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only)
1848
1848
{
1849
1849
struct window_copy_mode_data * data = wp -> modedata ;
1850
1850
struct screen * s = & data -> screen ;
1851
- u_int ox , oy , px , py ;
1851
+ u_int scrolled_past_bottom = 0 ;
1852
+ u_int ox , oy , px , py ;
1852
1853
1853
1854
oy = screen_hsize (data -> backing ) + data -> cy - data -> oy ;
1854
1855
ox = window_copy_find_length (wp , oy );
@@ -1862,6 +1863,8 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only)
1862
1863
1863
1864
data -> cx = data -> lastcx ;
1864
1865
if (scroll_only || data -> cy == screen_size_y (s ) - 1 ) {
1866
+ scrolled_past_bottom = data -> oy == 0 ;
1867
+
1865
1868
window_copy_scroll_up (wp , 1 );
1866
1869
if (scroll_only && data -> cy > 0 )
1867
1870
window_copy_redraw_lines (wp , data -> cy - 1 , 2 );
@@ -1883,6 +1886,11 @@ window_copy_cursor_down(struct window_pane *wp, int scroll_only)
1883
1886
window_copy_cursor_end_of_line (wp );
1884
1887
else if (s -> sel .lineflag == LINE_SEL_RIGHT_LEFT )
1885
1888
window_copy_cursor_start_of_line (wp );
1889
+
1890
+ if (scrolled_past_bottom && !s -> sel .flag &&
1891
+ s -> sel .lineflag == LINE_SEL_NONE &&
1892
+ options_get_number (& wp -> window -> options , "exit-copy-past-bottom" ))
1893
+ window_pane_reset_mode (wp );
1886
1894
}
1887
1895
1888
1896
void
0 commit comments