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.
It should pass only the matched length, not the original string length.
Caught by -fsanitize=address while trying to parse "some string (DEBUG)"
Probaby deserves a unit test.
TMPDIR is not always defined in the environment but the code doesn't check
for that. Let's used std::tmpfile instead.
Maybe an easier fix is to perform the tmpdir lookup better, but that is
also noisy since the search for a decent tmpdir is based on lore.
std::tmpfile() is rather clean. However it does not leave a nice filename
name around for debugging, so I understand why it might not be preferred.
Fixes#495
The generic format picks up extra text in the timestamp, which
caused the date time scanner to reject some matches. I think
it's okay to allow for some trailing junk, so it no longer
ensures the size of the match is the same as the input.
The default colors change resulted in some parts of the lnav
UI being colored incorrectly. I've reworked it a bit so that
the ansi color pairs are preserved and the default colors are
only used with the color pairs for roles. I've also replaced
references to ansi colors with roles in a few places to make
things work consistently.
My first attempt at this wasn't right and would exit the prompt
when an escape sequence was received and the prompt was empty
(like going back through history).
* Remove all the wordexp related unused headers and code.
* stdout does not appear to be reassignable on OpenBSD.
* defining _WCHAR_H_CPLUSPLUS_98_CONFORMANCE_ seems to fix the const
correctness related redefinitions between wchar.h imported from
the system libc and the one imported by clang++ STL.