Add highlight style, title style, fputs_highlighted. Improve 'show style'

Have 'show style' and its subcommands using a style to style its output.
This allows the GDB user or developer to use 'show style' to visually see
with one command how all the current styles look like.

Add 2 new styles highlight style, title style and fputs_highlighted function.

Highlight style is used by fputs_highlighted to highlight the parts of
its char *STR argument that match a HIGHLIGHT regexp.
This (and the title style) will be used in a following patch.
This commit is contained in:
Philippe Waroquiers
2019-05-31 13:47:37 +02:00
parent 79b377b3cf
commit 9303eb2fb1
5 changed files with 161 additions and 34 deletions

View File

@@ -28,15 +28,20 @@ class cli_style_option
public:
/* Construct a CLI style option with a foreground color. */
cli_style_option (ui_file_style::basic_color fg);
cli_style_option (const char *name, ui_file_style::basic_color fg);
/* Construct a CLI style option with an intensity. */
cli_style_option (const char *name, ui_file_style::intensity i);
/* Return a ui_file_style corresponding to the settings in this CLI
style. */
ui_file_style style () const;
/* Return the style name. */
const char *name () { return m_name; };
/* Call once to register this CLI style with the CLI engine. */
void add_setshow_commands (const char *name,
enum command_class theclass,
void add_setshow_commands (enum command_class theclass,
const char *prefix_doc,
struct cmd_list_element **set_list,
void (*do_set) (const char *args, int from_tty),
@@ -52,6 +57,9 @@ public:
private:
/* The style name. */
const char *m_name;
/* The foreground. */
const char *m_foreground;
/* The background. */
@@ -93,6 +101,13 @@ extern cli_style_option variable_name_style;
/* The address style. */
extern cli_style_option address_style;
/* The highlight style. */
extern cli_style_option highlight_style;
/* The title style. */
extern cli_style_option title_style;
/* True if source styling is enabled. */
extern int source_styling;