Hi, These patches represent a very short (~30 minute) hack I did for tmux because it annoyed me enough I wanted to try and fix it. :)
I make use a of "new-window -a" a lot, and as such over time when windows are created and removed, large "gaps" between the winlink indexes are created, which can lead to annoyingly high winlink indexes, despite there being only a handful of them in a session. So this patch series tries to address that. I've added a new target-session command "renumber-windows" which will renumber all windows in a session starting from base-index if it's set. For kicks, and to keep users of "new-window -a" happy, I've also added a session-option "automatic-renumber-windows" which will renumber windows in a session each time a window is destroyed. It seems to work, but in the space of thirty minutes, I suspect it to be below par. Namely, I am not at all sure of the implementation of window.c:window_renumber_windows() -- this seems far too fragile, although does still work. I'd have liked to have used winlink_add() but it didn't quite do what I wanted; despite there being some level of error-checking in it. Perhaps I should just duplicate that in window_renumber_windows() although I don't like that approach either. If there's a better way, or if I should somehow create one, I will do. It's just a bit more work than the thirty minutes I allowed myself to write all of this. Anyway, enjoy. Feedback welcome. Thomas Adam (4): Add cmd-renumber-windows definition Add definition for window_renumber_windows Add "automatic-renumber-windows" session option Add docs for automatic-renumber-windows, etc. trunk/Makefile.am | 1 + trunk/cmd-renumber-windows.c | 53 ++++++++++++++++++++++++++++++++++++++++++ trunk/cmd.c | 1 + trunk/options-table.c | 4 +++ trunk/server-fn.c | 5 ++++ trunk/tmux.1 | 21 ++++++++++++++++ trunk/tmux.h | 2 + trunk/window.c | 27 +++++++++++++++++++++ 8 files changed, 114 insertions(+), 0 deletions(-) create mode 100644 trunk/cmd-renumber-windows.c -- 1.7.5.4 ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA The must-attend event for mobile developers. Connect with experts. Get tools for creating Super Apps. See the latest technologies. Sessions, hands-on labs, demos & much more. Register early & save! http://p.sf.net/sfu/rim-blackberry-1 _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users