The ttydefaults.h header is not available on musl. Readline provides the
same functionality with its CTRL macro and it makes the intent of the
code a bit clearer (that we check for CTRL-D).
Unused-result from sensitive APIs, printf/scanf formatting types, set
but never used variables, and uninitialized variables.
Also there's one select(enum) that doesn't cover all cases.
Remove exception specifications to appease modern compilers and reduce
warning counts.
I sort of hate to remove all these exception-decls, but they are in fact
deprecated, and my compiler loves to complain.
The help output changed with the toggle-filenames option, but
the test for help wasn't updated.
Maybe the help needs to be updated a bit to include the two
filename column modes, now that I think about it. But we should
discuss the merits of that first, I suppose.
Add a separate BASENAME bit to distinguish from the FILENAME bit.
When BASENAME is active show the base filename in the filename column.
When FILENAME is active show the whole path for each filename. Cycle
through the three modes with toggle_filename() still. Note that we are
never in both FILENAME and BASENAME mode.
The user can cycle through the three modes by pressing the hotkey an
extra time. First press shows the basename, second press shows the full
path (filename), and the third press hides the filename column again.
Display the basename instead of the whole path for each file when
the filename column is displayed. Make the column the same width all
the time, taking the maximum basename width of all loaded files and
padding with spaces.
Also fix the attributes when the filename column is displayed. Insert
the correct filename-matching color for as many characters as we add for
the filename column. Use the full filename when looking up the color
because we don't want files in different paths to have the same color,
and we don't want the color to change based on whether we are displaying
the base or the whole filename.
Mostly addresses #277. I won't claim it fully closes it, because there
are at least two ways it could be improved:
1. It doesn't draw a nice coloured divider in the column after the
filename, and that would provide maximum visual clarity and
consistency with the existing presentation.
2. It would be nice if the filenames weren't shown on every single line,
but only on the first line of a contiguous chunk of log lines from a
single file (or on the top line of the screen if the first line of
the chunk was already scrolled off the top).
3. It doesn't yet include the filename in the text copied to the
clipboard when the 'c' hotkey is pressed.