Follow-up Comment #4, bug #14484 (project screen): There is some things that can be improved.
First there is a change in display.c, which shouldn't be part of this patch. There is also some weird white space problems (usually I would correct those myself when applying, but as there are other parts of patch that need to be corrected, you can fix them ;) + int count=1; is intended with 4 spaces instead of tab and there are spaces missing around '=' + case WINESC_WIN_COUNT: is intended with 8 spaces instead of 2 tabs + wmbc_printf(wmbc, "%*d", esc->num, count ); There is unnecessary space before closing bracket. +winmsg_esc_ex(WinCount, Window *win) +{ + int count=1; + + if (esc->num == 0) + esc->num = 1; + + if (!win) { + wmbc_printf(wmbc, "%*s", esc->num, esc->num > 1 ? "--" : "-"); + } else { + Window *count_ptr = win; + + for (;; count++) { + if (count_ptr->w_prev_mru == NULL) { + break; + } + + count_ptr = count_ptr->w_prev_mru; + if (count_ptr == win) { + break; + } + } + wmbc_printf(wmbc, "%*d", esc->num, count ); + } + + wmc_set(cond); +} The function itself can be a lot simpler. Check how screen loops through window list in almost all files, it can be done with 2 lines of code. One for looping and other one for counting. int count, can be moved into else part to reduce scope. And as mentioned in comment by Sadrul we may also want to consider something like %-C to only show current group count (see esc->flags.minus), which will add few more lines. _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?14484> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/