@@ -27,6 +27,7 @@ static const struct dimension win_dim = { 0, 6, 80, 60 };
2727
2828struct joblist_pane {
2929 struct top * top ;
30+ int jobid_width ;
3031 WINDOW * win ;
3132 json_t * jobs_all ;
3233 json_t * jobs ;
@@ -85,15 +86,17 @@ void joblist_pane_draw (struct joblist_pane *joblist)
8586 mvwprintw (joblist -> win ,
8687 0 ,
8788 0 ,
88- "%12s %8s %8s %2s %6s %6s %7s %-*s" ,
89+ "%*s %8s %8s %2s %6s %6s %7s %-*s" ,
90+ joblist -> jobid_width ,
8991 "JOBID" , "QUEUE" , "USER" , "ST" ,
9092 "NTASKS" , "NNODES" , "RUNTIME" ,
9193 name_width , "NAME" );
9294 else
9395 mvwprintw (joblist -> win ,
9496 0 ,
9597 0 ,
96- "%12s %8s %2s %6s %6s %7s %-*s" ,
98+ "%*s %8s %2s %6s %6s %7s %-*s" ,
99+ joblist -> jobid_width ,
97100 "JOBID" ,"USER" , "ST" , "NTASKS" , "NNODES" , "RUNTIME" ,
98101 name_width , "NAME" );
99102
@@ -413,6 +416,24 @@ void joblist_pane_set_current (struct joblist_pane *joblist, bool next)
413416 }
414417}
415418
419+ /*
420+ * Workaround for mvwprintw(3) issues with multibyte jobid 'ƒ' character.
421+ *
422+ * Empirically, the JOBID column must be formatted as %12s when the 'ƒ'
423+ * character appears in f58 encoded jobids, but %13s when ascii 'f' is used.
424+ * Guess at the current jobid encoding by determining if the f58 encoding
425+ * of jobid 0 has a length of 2 (ascii) or 3 (utf-8).
426+ *
427+ */
428+ static int estimate_jobid_width (void )
429+ {
430+ const char * id = idf58 (0 );
431+ if (strlen (id ) == 2 )
432+ return 13 ;
433+ else
434+ return 12 ;
435+ }
436+
416437struct joblist_pane * joblist_pane_create (struct top * top )
417438{
418439 struct joblist_pane * joblist ;
@@ -422,6 +443,7 @@ struct joblist_pane *joblist_pane_create (struct top *top)
422443 if (!(joblist -> ucache = ucache_create ()))
423444 fatal (errno , "could not create ucache" );
424445 joblist -> top = top ;
446+ joblist -> jobid_width = estimate_jobid_width ();
425447 joblist -> current = FLUX_JOBID_ANY ;
426448 joblist -> show_queue = queues_configured (top -> queues );
427449 if (!(joblist -> win = newwin (win_dim .y_length ,
0 commit comments