Had to fix patches #5 and again #9 (the caption string of options
shouldn't end with '.')
--
أحمد المحمودي (Ahmed El-Mahmoudy)
Digital design engineer
GPG KeyID: 0x9DCA0B27 (@ subkeys.pgp.net)
GPG Fingerprint: 087D 3767 8CAC 65B1 8F6C 156E D325 C3C8 9DCA 0B27
Provide different color for text areas in insert mode.
The color is controlled by
document.browse.links.active_link.insert_mode_colors.background
document.browse.links.active_link.insert_mode_colors.text
Also avoid overloading local variable i in get_current_link().
By: yozoh...@gmail.com
---
src/config/options.inc | 12
src/document/document.c |2 ++
src/document/options.c |2 ++
src/document/options.h |1 +
src/viewer/text/link.c | 17 -
5 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/src/config/options.inc b/src/config/options.inc
index 340ab93..7098854 100644
--- a/src/config/options.inc
+++ b/src/config/options.inc
@@ -294,6 +294,18 @@ static struct option_info config_options_info[] = {
text, 0, black,
N_(Default text color.)),
+ INIT_OPT_TREE(document.browse.links.active_link, N_(Insert mode
colors),
+ insert_mode_colors, 0,
+ N_(Insert mode colors.)),
+
+ INIT_OPT_COLOR(document.browse.links.active_link.insert_mode_colors,
N_(Background color for text field in insert mode),
+ background, 0, #ff,
+ N_(Background color for text field in insert mode)),
+
+ INIT_OPT_COLOR(document.browse.links.active_link.insert_mode_colors,
N_(Text color for text field in insert mode),
+ text, 0, black,
+ N_(Text color for text field in insert mode.)),
+
INIT_OPT_BOOL(document.browse.links.active_link, N_(Enable color),
enable_color, 0, 0,
N_(Enable use of the active link background and text color
diff --git a/src/document/document.c b/src/document/document.c
index 5424f6f..19ee2d0 100644
--- a/src/document/document.c
+++ b/src/document/document.c
@@ -234,6 +234,8 @@ update_cached_document_options(struct session *ses)
memset(active_link, 0, sizeof(active_link)); /* Safer. */
active_link.color.foreground =
get_opt_color(document.browse.links.active_link.colors.text, ses);
active_link.color.background =
get_opt_color(document.browse.links.active_link.colors.background, ses);
+ active_link.insert_mode_color.foreground =
get_opt_color(document.browse.links.active_link.insert_mode_colors.text, ses);
+ active_link.insert_mode_color.background =
get_opt_color(document.browse.links.active_link.insert_mode_colors.background,
ses);
active_link.enable_color =
get_opt_bool(document.browse.links.active_link.enable_color, ses);
active_link.invert =
get_opt_bool(document.browse.links.active_link.invert, ses);
active_link.underline =
get_opt_bool(document.browse.links.active_link.underline, ses);
diff --git a/src/document/options.c b/src/document/options.c
index b681fda..9208d64 100644
--- a/src/document/options.c
+++ b/src/document/options.c
@@ -52,6 +52,8 @@ init_document_options(struct session *ses, struct
document_options *doo)
doo-active_link.color.foreground =
get_opt_color(document.browse.links.active_link.colors.text, ses);
doo-active_link.color.background =
get_opt_color(document.browse.links.active_link.colors.background, ses);
+ doo-active_link.insert_mode_color.foreground =
get_opt_color(document.browse.links.active_link.insert_mode_colors.text, ses);
+ doo-active_link.insert_mode_color.background =
get_opt_color(document.browse.links.active_link.insert_mode_colors.background,
ses);
if (get_opt_bool(document.colors.increase_contrast, ses))
doo-color_flags |= COLOR_INCREASE_CONTRAST;
diff --git a/src/document/options.h b/src/document/options.h
index d3bd29a..52c1956 100644
--- a/src/document/options.h
+++ b/src/document/options.h
@@ -20,6 +20,7 @@ struct active_link_options {
unsigned int bold:1;
unsigned int invert:1;
struct active_link_options_colors color;
+ struct active_link_options_colors insert_mode_color;
};
/** This mostly acts as a option cache so rendering will be faster. However it
diff --git a/src/viewer/text/link.c b/src/viewer/text/link.c
index a9021b0..eaa15f1 100644
--- a/src/viewer/text/link.c
+++ b/src/viewer/text/link.c
@@ -165,7 +165,7 @@ get_link_cursor_offset(struct document_view *doc_view,
struct link *link)
/** Initialise a static template character with the colour and attributes
* appropriate for an active link and return that character. */
static inline struct screen_char *
-init_link_drawing(struct document_view *doc_view, struct link *link, int
invert)
+init_link_drawing(struct document_view *doc_view, struct link *link, int
invert, int input)
{
struct document_options *doc_opts;
static