@@ -246,7 +246,7 @@ schedule_write_to_child(unsigned long id, unsigned int num, ...) {
246246 }
247247 screen -> write_buf_sz = screen -> write_buf_used + sz ;
248248 screen -> write_buf = PyMem_RawRealloc (screen -> write_buf , screen -> write_buf_sz );
249- if (screen -> write_buf == NULL ) { fatal ("Out of memory." ); }
249+ if (screen -> write_buf == NULL ) fatal ("Out of memory." );
250250 }
251251 va_start (ap , num );
252252 for (unsigned int i = 0 ; i < num ; i ++ ) {
@@ -259,7 +259,7 @@ schedule_write_to_child(unsigned long id, unsigned int num, ...) {
259259 if (screen -> write_buf_sz > BUFSIZ && screen -> write_buf_used < BUFSIZ ) {
260260 screen -> write_buf_sz = BUFSIZ ;
261261 screen -> write_buf = PyMem_RawRealloc (screen -> write_buf , screen -> write_buf_sz );
262- if (screen -> write_buf == NULL ) { fatal ("Out of memory." ); }
262+ if (screen -> write_buf == NULL ) fatal ("Out of memory." );
263263 }
264264 if (screen -> write_buf_used ) wakeup_io_loop (self , false);
265265 screen_mutex (unlock , write );
@@ -589,8 +589,13 @@ prepare_to_render_os_window(OSWindow *os_window, monotonic_t now, unsigned int *
589589
590590static inline void
591591render_os_window (OSWindow * os_window , monotonic_t now , unsigned int active_window_id , color_type active_window_bg , unsigned int num_visible_windows , bool all_windows_have_same_bg ) {
592+ static bool first_time = true;
593+ if (first_time ) {
594+ setup_scroll (os_window );
595+ first_time = false;
596+ }
592597 // ensure all pixels are cleared to background color at least once in every buffer
593- if (os_window -> clear_count ++ < 3 ) blank_os_window (os_window );
598+ if (os_window -> clear_count ++ < 2 ) blank_os_window (os_window );
594599 Tab * tab = os_window -> tabs + os_window -> active_tab ;
595600 BorderRects * br = & tab -> border_rects ;
596601 bool static_live_resize_in_progress = os_window -> live_resize .in_progress && OPT (resize_draw_strategy ) == RESIZE_DRAW_STATIC ;
@@ -603,19 +608,24 @@ render_os_window(OSWindow *os_window, monotonic_t now, unsigned int active_windo
603608 draw_borders (br -> vao_idx , br -> num_border_rects , br -> rect_buf , br -> is_dirty , os_window -> viewport_width , os_window -> viewport_height , active_window_bg , num_visible_windows , all_windows_have_same_bg , os_window );
604609 br -> is_dirty = false;
605610 }
606- if (TD .screen && os_window -> num_tabs >= OPT (tab_bar_min_tabs )) draw_cells (TD .vao_idx , 0 , TD .xstart , TD .ystart , TD .dx * x_ratio , TD .dy * y_ratio , TD .screen , os_window , true, false);
607611 for (unsigned int i = 0 ; i < tab -> num_windows ; i ++ ) {
608612 Window * w = tab -> windows + i ;
609613 if (w -> visible && WD .screen ) {
614+ before_render ();
610615 bool is_active_window = i == tab -> active_window ;
611- draw_cells (WD .vao_idx , WD .gvao_idx , WD .xstart , WD .ystart , WD .dx * x_ratio , WD .dy * y_ratio , WD .screen , os_window , is_active_window , true);
612- if (WD .screen -> start_visual_bell_at != 0 ) {
613- monotonic_t bell_left = OPT (visual_bell_duration ) - (now - WD .screen -> start_visual_bell_at );
614- set_maximum_wait (bell_left );
616+ if (WD .screen -> render_not_only_pixel_scroll ) {
617+ WD .screen -> render_not_only_pixel_scroll = false;
618+ draw_cells (WD .vao_idx , WD .gvao_idx , WD .xstart , WD .ystart , WD .dx * x_ratio , WD .dy * y_ratio , WD .screen , os_window , is_active_window , true);
619+ if (WD .screen -> start_visual_bell_at != 0 ) {
620+ monotonic_t bell_left = OPT (visual_bell_duration ) - (now - WD .screen -> start_visual_bell_at );
621+ set_maximum_wait (bell_left );
622+ }
615623 }
624+ after_render (os_window , (WD .screen -> scrolled_by_pixels * 2.0 ) / os_window -> viewport_height );
616625 w -> cursor_visible_at_last_render = WD .screen -> cursor_render_info .is_visible ; w -> last_cursor_x = WD .screen -> cursor_render_info .x ; w -> last_cursor_y = WD .screen -> cursor_render_info .y ; w -> last_cursor_shape = WD .screen -> cursor_render_info .shape ;
617626 }
618627 }
628+ if (TD .screen && os_window -> num_tabs >= OPT (tab_bar_min_tabs )) draw_cells (TD .vao_idx , 0 , TD .xstart , TD .ystart , TD .dx , TD .dy , TD .screen , os_window , true, false);
619629 swap_window_buffers (os_window );
620630 os_window -> last_active_tab = os_window -> active_tab ; os_window -> last_num_tabs = os_window -> num_tabs ; os_window -> last_active_window_id = active_window_id ;
621631 os_window -> focused_at_last_render = os_window -> is_focused ;
@@ -688,7 +698,7 @@ render(monotonic_t now, bool input_read) {
688698 bool needs_render = w -> is_damaged || w -> live_resize .in_progress ;
689699 if (w -> viewport_size_dirty ) {
690700 w -> clear_count = 0 ;
691- update_surface_size (w -> viewport_width , w -> viewport_height , w -> offscreen_texture_id );
701+ update_surface_size (w -> viewport_width , w -> viewport_height , w -> offscreen_texture_id , w -> scroll_texture_id );
692702 w -> viewport_size_dirty = false;
693703 needs_render = true;
694704 }
0 commit comments