ChatControlBase was split from ChatControl into its own module in commit
80221afc2c. With this split the import of the CommandContainer modules
was removed as well, likely because their members are not referenced
anywhere. However, importing these modules even when they are not used
directly is crucial because the contained CommandContainers are only
registered with the command system when their definitions are evaluated.
Import the modules with CommandContainers in chat_control_base.py to fix
the command system. Also add a comment stating more clearly why the
imports need to be kept around.
The definition of various constants was refactored to use enumerations
in commit 2fbadc91e9. One reference in the command system was not
changed to use the new enum, however.
Do not reload the conversation in the history window when the user
selects another search result from the same day. Just clearing the
previous highlighting is enough. This prevents flickering and provides
a much more pleasant user experience.
Search results in the history window to are scrolled to and highlighted
once the user clicks on one of them. Messages are searched by text in
the log database, but then looked up in the history text buffer via a
visible or invisible timestamp obtained from the database record.
Timestamps in the history text buffer, depending on user configuration,
may only have a coarse granularity. Philipp Hörist discovered that this
may lead to the highlighting of the wrong line in the history text view
and proposed an alternative solution that is implemented in this patch.
Timestamps are abolished as a means of searching messages. Instead, add
a mark with the unique message id (log line id) at the start of every
message in the history text buffer when the conversation is loaded.
After fetching the search results from the database this id can be used
to unambiguously find the corresponding message in the history text
buffer.
The method get_search_results_for_query provides a means to search via a
passed in SQL query. This feature has been unused and dead since its initial
commit back in 2005 (commit e542fff69f), so just remove it.
The message to be highlighted is searched via an already formatted
timestamp, and the match contains the whole timestamp with any
preceding characters (like "["). Therefore, calling backward_char on
the start iterator of the match just goes back to the previous line
and is not needed.
A single message may span multiple paragraphs. Highlight all paragraphs
of a search result because a keyword could be in any of them.
Every message already has the 'eol' tag on its newline character.
Highlight from the start of a search match up to the next 'eol' tag.
context.get_background_color() first calls the CellRenderer to render
the cell before giving back the color.
When we call this inside a CellRenderer, this is an endless loop