move the scrollback with the selection cursor
This commit is contained in:
		
							parent
							
								
									ae51cb0e98
								
							
						
					
					
						commit
						70da200dd9
					
				
							
								
								
									
										10
									
								
								termite.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								termite.c
									
									
									
									
									
								
							@ -148,6 +148,10 @@ static void toggle_visual(VteTerminal *vte, select_info *select, select_mode mod
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void move(VteTerminal *vte, select_info *select, long col, long row) {
 | 
			
		||||
    GtkAdjustment *adjust = gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(vte));
 | 
			
		||||
    double scroll_row = gtk_adjustment_get_value(adjust);
 | 
			
		||||
    long n_rows = vte_terminal_get_row_count(vte);
 | 
			
		||||
 | 
			
		||||
    const long end_col = vte_terminal_get_column_count(vte) - 1;
 | 
			
		||||
    /*const long end_row = vte_terminal_get_row_count(vte) - 1;*/
 | 
			
		||||
 | 
			
		||||
@ -155,6 +159,12 @@ static void move(VteTerminal *vte, select_info *select, long col, long row) {
 | 
			
		||||
    select->cursor_row = MAX(select->cursor_row + row, 0);
 | 
			
		||||
    /*select->cursor_row = CLAMP(select->cursor_row + row, 0, end_row);*/
 | 
			
		||||
 | 
			
		||||
    if (select->cursor_row < scroll_row) {
 | 
			
		||||
        gtk_adjustment_set_value(adjust, (double)select->cursor_row);
 | 
			
		||||
    } else if (select->cursor_row - n_rows >= (long)scroll_row) {
 | 
			
		||||
        gtk_adjustment_set_value(adjust, (double)(select->cursor_row - n_rows + 1));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    update_selection(vte, select);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user