@@ -118,6 +118,7 @@ static term_T *first_term = NULL;
118118 * Functions with separate implementation for MS-Windows and Unix-like systems.
119119 */
120120static int term_and_job_init (term_T * term , int rows , int cols , char_u * cmd );
121+ static void term_report_winsize (term_T * term , int rows , int cols );
121122static void term_free (term_T * term );
122123
123124/**************************************
@@ -765,24 +766,7 @@ term_update_window(win_T *wp)
765766 vterm_set_size (vterm , rows , cols );
766767 ch_logn (term -> tl_job -> jv_channel , "Resizing terminal to %d lines" ,
767768 rows );
768-
769- #if defined(UNIX )
770- /* Use an ioctl() to report the new window size to the job. */
771- if (term -> tl_job != NULL && term -> tl_job -> jv_channel != NULL )
772- {
773- int fd = -1 ;
774- int part ;
775-
776- for (part = PART_OUT ; part < PART_COUNT ; ++ part )
777- {
778- fd = term -> tl_job -> jv_channel -> ch_part [part ].ch_fd ;
779- if (isatty (fd ))
780- break ;
781- }
782- if (part < PART_COUNT && mch_report_winsize (fd , rows , cols ) == OK )
783- mch_stop_job (term -> tl_job , (char_u * )"winch" );
784- }
785- #endif
769+ term_report_winsize (term , rows , cols );
786770 }
787771
788772 /* The cursor may have been moved when resizing. */
@@ -921,6 +905,7 @@ void (*winpty_config_free)(void*);
921905void (* winpty_spawn_config_free )(void * );
922906void (* winpty_error_free )(void * );
923907LPCWSTR (* winpty_error_msg )(void * );
908+ BOOL (* winpty_set_size )(void * , int , int , void * );
924909
925910/**************************************
926911 * 2. MS-Windows implementation.
@@ -953,6 +938,7 @@ dyn_winpty_init(void)
953938 {"winpty_spawn_config_free" , (FARPROC * )& winpty_spawn_config_free },
954939 {"winpty_spawn_config_new" , (FARPROC * )& winpty_spawn_config_new },
955940 {"winpty_error_msg" , (FARPROC * )& winpty_error_msg },
941+ {"winpty_set_size" , (FARPROC * )& winpty_set_size },
956942 {NULL , NULL }
957943 };
958944
@@ -1122,6 +1108,15 @@ term_free(term_T *term)
11221108 vterm_free (term -> tl_vterm );
11231109}
11241110
1111+ /*
1112+ * Request size to terminal.
1113+ */
1114+ static void
1115+ term_report_winsize (term_T * term , int rows , int cols )
1116+ {
1117+ winpty_set_size (term -> tl_winpty , cols , rows , NULL );
1118+ }
1119+
11251120# else
11261121
11271122/**************************************
@@ -1161,6 +1156,30 @@ term_free(term_T *term)
11611156 if (term -> tl_vterm != NULL )
11621157 vterm_free (term -> tl_vterm );
11631158}
1159+
1160+ /*
1161+ * Request size to terminal.
1162+ */
1163+ static void
1164+ term_report_winsize (term_T * term , int rows , int cols )
1165+ {
1166+ /* Use an ioctl() to report the new window size to the job. */
1167+ if (term -> tl_job != NULL && term -> tl_job -> jv_channel != NULL )
1168+ {
1169+ int fd = -1 ;
1170+ int part ;
1171+
1172+ for (part = PART_OUT ; part < PART_COUNT ; ++ part )
1173+ {
1174+ fd = term -> tl_job -> jv_channel -> ch_part [part ].ch_fd ;
1175+ if (isatty (fd ))
1176+ break ;
1177+ }
1178+ if (part < PART_COUNT && mch_report_winsize (fd , rows , cols ) == OK )
1179+ mch_stop_job (term -> tl_job , (char_u * )"winch" );
1180+ }
1181+ }
1182+
11641183# endif
11651184
11661185#endif /* FEAT_TERMINAL */
0 commit comments