File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -93,18 +93,34 @@ static void fmt(const char *str, int width)
9393 if (c == ' ' || c == '\t' || c == '\n' )
9494 last = ptr ;
9595 if ((width > 0 && w > width && last ) || c == '\n' ) {
96- while (s != last )
96+ while (s != last ) {
97+ #ifdef _WIN32
98+ int n = utf_ff (s , last );
99+ fwrite (s , n , 1 , stdout );
100+ s += n ;
101+ #else
97102 putc (* s ++ , stdout );
103+ #endif
104+ }
98105 if (c != '\n' )
99106 putc ('\n' , stdout );
107+ fflush (stdout );
100108 w = 0 ;
101109 last = s ;
102110 continue ;
103111 }
104112 }
105- while (s != eptr )
113+ while (s != eptr ) {
114+ #ifdef _WIN32
115+ int n = utf_ff (s , eptr );
116+ fwrite (s , n , 1 , stdout );
117+ s += n ;
118+ #else
106119 putc (* s ++ , stdout );
120+ #endif
121+ }
107122 putc ('\n' , stdout );
123+ fflush (stdout );
108124}
109125
110126static char * trim (char * str )
@@ -226,7 +242,6 @@ int main(int argc, const char **argv)
226242 str = instead_cmd ("look" , & rc );
227243 if (!rc && str ) {
228244 fmt (trim (str ), opt_width );
229- fflush (stdout );
230245 }
231246 free (str );
232247 if (opt_autoload ) {
@@ -275,7 +290,6 @@ int main(int argc, const char **argv)
275290 }
276291 if (str ) {
277292 fmt (trim (str ), opt_width );
278- fflush (stdout );
279293 free (str );
280294 }
281295 if (!parser_mode && !cmd_mode )
You can’t perform that action at this time.
0 commit comments