substack/terminal-menu — pull request #10 by smurthas (2014-04-21 16:13:46+00:00)
Title: Fix issue with single item menus

Previously, menus with only one item in them would leave the foreground and background reversed when drawing the bottom padding lines. This explicitly resets the colors back to normal before it draws the padding.

A single item menu is almost non-sensical, however, it is allowed by the module, so (in my thinking) it should work properly.

I also considered wrapping it in `if (this.items.length === 1) { ... }`, but thought that this was simpler and more future-proof because the bug is actually caused by any menu that is initially rendered with the last item selected and it seemed possible that a future feature could let the module user specify which item to select by default on render (which could easily be the last item).