mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
template -> template_ for C++ compatibility
This commit is contained in:
parent
13f3da8416
commit
2e721e051a
@ -206,9 +206,9 @@ get_opt_rec(struct option *tree, const unsigned char *name_)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tree && tree->flags & OPT_AUTOCREATE && !no_autocreate) {
|
if (tree && tree->flags & OPT_AUTOCREATE && !no_autocreate) {
|
||||||
struct option *template = get_opt_rec(tree, "_template_");
|
struct option *template_ = get_opt_rec(tree, "_template_");
|
||||||
|
|
||||||
assertm(template != NULL, "Requested %s should be autocreated but "
|
assertm(template_ != NULL, "Requested %s should be autocreated but "
|
||||||
"%.*s._template_ is missing!", name_, sep - name_,
|
"%.*s._template_ is missing!", name_, sep - name_,
|
||||||
name_);
|
name_);
|
||||||
if_assert_failed {
|
if_assert_failed {
|
||||||
@ -221,7 +221,7 @@ get_opt_rec(struct option *tree, const unsigned char *name_)
|
|||||||
* option. By having _template_ OPT_AUTOCREATE and _template_
|
* option. By having _template_ OPT_AUTOCREATE and _template_
|
||||||
* inside, you can have even multi-level autocreating. */
|
* inside, you can have even multi-level autocreating. */
|
||||||
|
|
||||||
option = copy_option(template, 0);
|
option = copy_option(template_, 0);
|
||||||
if (!option) {
|
if (!option) {
|
||||||
mem_free(aname);
|
mem_free(aname);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -453,10 +453,10 @@ add_opt_rec(struct option *tree, unsigned char *path, struct option *option)
|
|||||||
option->box_item->visible = get_opt_bool("config.show_template", NULL);
|
option->box_item->visible = get_opt_bool("config.show_template", NULL);
|
||||||
|
|
||||||
if (tree->flags & OPT_AUTOCREATE && !option->desc) {
|
if (tree->flags & OPT_AUTOCREATE && !option->desc) {
|
||||||
struct option *template = get_opt_rec(tree, "_template_");
|
struct option *template_ = get_opt_rec(tree, "_template_");
|
||||||
|
|
||||||
assert(template);
|
assert(template_);
|
||||||
option->desc = template->desc;
|
option->desc = template_->desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
option->root = tree;
|
option->root = tree;
|
||||||
@ -670,34 +670,34 @@ delete_option(struct option *option)
|
|||||||
|
|
||||||
/*! @relates option */
|
/*! @relates option */
|
||||||
struct option *
|
struct option *
|
||||||
copy_option(struct option *template, int flags)
|
copy_option(struct option *template_, int flags)
|
||||||
{
|
{
|
||||||
struct option *option = mem_calloc(1, sizeof(*option));
|
struct option *option = mem_calloc(1, sizeof(*option));
|
||||||
|
|
||||||
if (!option) return NULL;
|
if (!option) return NULL;
|
||||||
|
|
||||||
option->name = null_or_stracpy(template->name);
|
option->name = null_or_stracpy(template_->name);
|
||||||
option->flags = (template->flags | OPT_ALLOC);
|
option->flags = (template_->flags | OPT_ALLOC);
|
||||||
option->type = template->type;
|
option->type = template_->type;
|
||||||
option->min = template->min;
|
option->min = template_->min;
|
||||||
option->max = template->max;
|
option->max = template_->max;
|
||||||
option->capt = template->capt;
|
option->capt = template_->capt;
|
||||||
option->desc = template->desc;
|
option->desc = template_->desc;
|
||||||
option->change_hook = template->change_hook;
|
option->change_hook = template_->change_hook;
|
||||||
|
|
||||||
if (!(flags & CO_NO_LISTBOX_ITEM))
|
if (!(flags & CO_NO_LISTBOX_ITEM))
|
||||||
option->box_item = init_option_listbox_item(option);
|
option->box_item = init_option_listbox_item(option);
|
||||||
if (option->box_item) {
|
if (option->box_item) {
|
||||||
if (template->box_item) {
|
if (template_->box_item) {
|
||||||
option->box_item->type = template->box_item->type;
|
option->box_item->type = template_->box_item->type;
|
||||||
option->box_item->depth = template->box_item->depth;
|
option->box_item->depth = template_->box_item->depth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option_types[template->type].dup) {
|
if (option_types[template_->type].dup) {
|
||||||
option_types[template->type].dup(option, template, flags);
|
option_types[template_->type].dup(option, template_, flags);
|
||||||
} else {
|
} else {
|
||||||
option->value = template->value;
|
option->value = template_->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return option;
|
return option;
|
||||||
|
@ -345,11 +345,11 @@ str_wr(struct option *o, struct string *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
str_dup(struct option *opt, struct option *template, int flags)
|
str_dup(struct option *opt, struct option *template_, int flags)
|
||||||
{
|
{
|
||||||
unsigned char *new = mem_alloc(MAX_STR_LEN);
|
unsigned char *new = mem_alloc(MAX_STR_LEN);
|
||||||
|
|
||||||
if (new) safe_strncpy(new, template->value.string, MAX_STR_LEN);
|
if (new) safe_strncpy(new, template_->value.string, MAX_STR_LEN);
|
||||||
opt->value.string = new;
|
opt->value.string = new;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,10 +441,10 @@ color_wr(struct option *opt, struct string *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tree_dup(struct option *opt, struct option *template, int flags)
|
tree_dup(struct option *opt, struct option *template_, int flags)
|
||||||
{
|
{
|
||||||
LIST_OF(struct option) *new = init_options_tree();
|
LIST_OF(struct option) *new = init_options_tree();
|
||||||
LIST_OF(struct option) *tree = template->value.tree;
|
LIST_OF(struct option) *tree = template_->value.tree;
|
||||||
struct option *option;
|
struct option *option;
|
||||||
|
|
||||||
if (!new) return;
|
if (!new) return;
|
||||||
|
@ -197,7 +197,7 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx)
|
|||||||
/* Initialize styles. */
|
/* Initialize styles. */
|
||||||
|
|
||||||
for (type = 0; type < RSS_STYLES; type++) {
|
for (type = 0; type < RSS_STYLES; type++) {
|
||||||
struct screen_char *template = &rss->styles[type];
|
struct screen_char *template_ = &rss->styles[type];
|
||||||
static const unsigned char *names[RSS_STYLES] =
|
static const unsigned char *names[RSS_STYLES] =
|
||||||
{ "title", "author", "author-date-sep", "date" };
|
{ "title", "author", "author-date-sep", "date" };
|
||||||
struct css_selector *selector = NULL;
|
struct css_selector *selector = NULL;
|
||||||
@ -205,7 +205,7 @@ dom_rss_push_document(struct dom_stack *stack, struct dom_node *root, void *xxx)
|
|||||||
selector = find_css_selector(&css->selectors,
|
selector = find_css_selector(&css->selectors,
|
||||||
CST_ELEMENT, CSR_ROOT,
|
CST_ELEMENT, CSR_ROOT,
|
||||||
names[type], strlen(names[type]));
|
names[type], strlen(names[type]));
|
||||||
init_template_by_style(template, &document->options,
|
init_template_by_style(template_, &document->options,
|
||||||
selector ? &selector->properties : NULL);
|
selector ? &selector->properties : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,21 +63,21 @@ static inline void
|
|||||||
render_dom_flush(struct dom_renderer *renderer, unsigned char *string)
|
render_dom_flush(struct dom_renderer *renderer, unsigned char *string)
|
||||||
{
|
{
|
||||||
struct source_renderer *data = renderer->data;
|
struct source_renderer *data = renderer->data;
|
||||||
struct screen_char *template = &data->styles[DOM_NODE_TEXT];
|
struct screen_char *template_ = &data->styles[DOM_NODE_TEXT];
|
||||||
int length = string - renderer->position;
|
int length = string - renderer->position;
|
||||||
|
|
||||||
assert_source(renderer, renderer->position, 0);
|
assert_source(renderer, renderer->position, 0);
|
||||||
assert_source(renderer, string, 0);
|
assert_source(renderer, string, 0);
|
||||||
|
|
||||||
if (length <= 0) return;
|
if (length <= 0) return;
|
||||||
render_dom_text(renderer, template, renderer->position, length);
|
render_dom_text(renderer, template_, renderer->position, length);
|
||||||
renderer->position = string;
|
renderer->position = string;
|
||||||
|
|
||||||
assert_source(renderer, renderer->position, 0);
|
assert_source(renderer, renderer->position, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template,
|
render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template_,
|
||||||
struct dom_node *node)
|
struct dom_node *node)
|
||||||
{
|
{
|
||||||
unsigned char *string = node->string.string;
|
unsigned char *string = node->string.string;
|
||||||
@ -94,7 +94,7 @@ render_dom_node_text(struct dom_renderer *renderer, struct screen_char *template
|
|||||||
assert_source(renderer, renderer->position, 0);
|
assert_source(renderer, renderer->position, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
render_dom_text(renderer, template, string, length);
|
render_dom_text(renderer, template_, string, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
@ -106,7 +106,7 @@ render_dom_node_enhanced_text(struct dom_renderer *renderer, struct dom_node *no
|
|||||||
regmatch_t regmatch;
|
regmatch_t regmatch;
|
||||||
unsigned char *string = node->string.string;
|
unsigned char *string = node->string.string;
|
||||||
int length = node->string.length;
|
int length = node->string.length;
|
||||||
struct screen_char *template = &data->styles[node->type];
|
struct screen_char *template_ = &data->styles[node->type];
|
||||||
unsigned char *alloc_string;
|
unsigned char *alloc_string;
|
||||||
|
|
||||||
if (check_dom_node_source(renderer, string, length)) {
|
if (check_dom_node_source(renderer, string, length)) {
|
||||||
@ -127,7 +127,7 @@ render_dom_node_enhanced_text(struct dom_renderer *renderer, struct dom_node *no
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
render_dom_text(renderer, template, string, offset);
|
render_dom_text(renderer, template_, string, offset);
|
||||||
|
|
||||||
string += offset;
|
string += offset;
|
||||||
length -= offset;
|
length -= offset;
|
||||||
@ -139,7 +139,7 @@ render_dom_node_enhanced_text(struct dom_renderer *renderer, struct dom_node *no
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (length > 0)
|
if (length > 0)
|
||||||
render_dom_text(renderer, template, string, length);
|
render_dom_text(renderer, template_, string, length);
|
||||||
|
|
||||||
mem_free_if(alloc_string);
|
mem_free_if(alloc_string);
|
||||||
}
|
}
|
||||||
@ -233,11 +233,11 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
|
|||||||
{
|
{
|
||||||
struct dom_renderer *renderer = stack->current->data;
|
struct dom_renderer *renderer = stack->current->data;
|
||||||
struct source_renderer *data = renderer->data;
|
struct source_renderer *data = renderer->data;
|
||||||
struct screen_char *template = &data->styles[node->type];
|
struct screen_char *template_ = &data->styles[node->type];
|
||||||
|
|
||||||
assert(node && renderer->document);
|
assert(node && renderer->document);
|
||||||
|
|
||||||
render_dom_node_text(renderer, template, node);
|
render_dom_node_text(renderer, template_, node);
|
||||||
|
|
||||||
if (is_dom_string_set(&node->data.attribute.value)) {
|
if (is_dom_string_set(&node->data.attribute.value)) {
|
||||||
int quoted = node->data.attribute.quoted == 1;
|
int quoted = node->data.attribute.quoted == 1;
|
||||||
@ -267,7 +267,7 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (skips > 0) {
|
if (skips > 0) {
|
||||||
render_dom_text(renderer, template, value, skips);
|
render_dom_text(renderer, template_, value, skips);
|
||||||
value += skips;
|
value += skips;
|
||||||
valuelen -= skips;
|
valuelen -= skips;
|
||||||
}
|
}
|
||||||
@ -294,10 +294,10 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
|
|||||||
|
|
||||||
if (skips > 0) {
|
if (skips > 0) {
|
||||||
value += valuelen - skips;
|
value += valuelen - skips;
|
||||||
render_dom_text(renderer, template, value, skips);
|
render_dom_text(renderer, template_, value, skips);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
render_dom_text(renderer, template, value, valuelen);
|
render_dom_text(renderer, template_, value, valuelen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void *
|
|||||||
/* Initialize styles for all the DOM node types. */
|
/* Initialize styles for all the DOM node types. */
|
||||||
|
|
||||||
for (type = 0; type < DOM_NODES; type++) {
|
for (type = 0; type < DOM_NODES; type++) {
|
||||||
struct screen_char *template = &data->styles[type];
|
struct screen_char *template_ = &data->styles[type];
|
||||||
struct dom_string *name = get_dom_node_type_name(type);
|
struct dom_string *name = get_dom_node_type_name(type);
|
||||||
struct css_selector *selector = NULL;
|
struct css_selector *selector = NULL;
|
||||||
|
|
||||||
@ -371,7 +371,7 @@ render_dom_document_start(struct dom_stack *stack, struct dom_node *node, void *
|
|||||||
selector = find_css_selector(&css->selectors,
|
selector = find_css_selector(&css->selectors,
|
||||||
CST_ELEMENT, CSR_ROOT,
|
CST_ELEMENT, CSR_ROOT,
|
||||||
name->string, name->length);
|
name->string, name->length);
|
||||||
init_template_by_style(template, &document->options,
|
init_template_by_style(template_, &document->options,
|
||||||
selector ? &selector->properties : NULL);
|
selector ? &selector->properties : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,16 +28,16 @@
|
|||||||
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
init_template(struct screen_char *template, struct document_options *options,
|
init_template(struct screen_char *template_, struct document_options *options,
|
||||||
enum screen_char_attr attr, color_T foreground, color_T background)
|
enum screen_char_attr attr, color_T foreground, color_T background)
|
||||||
{
|
{
|
||||||
struct text_style style = INIT_TEXT_STYLE(attr, foreground, background);
|
struct text_style style = INIT_TEXT_STYLE(attr, foreground, background);
|
||||||
|
|
||||||
get_screen_char_template(template, options, style);
|
get_screen_char_template(template_, options, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
init_template_by_style(struct screen_char *template, struct document_options *options,
|
init_template_by_style(struct screen_char *template_, struct document_options *options,
|
||||||
LIST_OF(struct css_property) *properties)
|
LIST_OF(struct css_property) *properties)
|
||||||
{
|
{
|
||||||
struct text_style style = options->default_style;
|
struct text_style style = options->default_style;
|
||||||
@ -72,7 +72,7 @@ init_template_by_style(struct screen_char *template, struct document_options *op
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get_screen_char_template(template, options, style);
|
get_screen_char_template(template_, options, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ add_search_node(struct dom_renderer *renderer, int width)
|
|||||||
#define WIDTH(renderer, add) ((renderer)->canvas_x + (add))
|
#define WIDTH(renderer, add) ((renderer)->canvas_x + (add))
|
||||||
|
|
||||||
static void
|
static void
|
||||||
render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
render_dom_line(struct dom_renderer *renderer, struct screen_char *template_,
|
||||||
unsigned char *string, int length)
|
unsigned char *string, int length)
|
||||||
{
|
{
|
||||||
struct document *document = renderer->document;
|
struct document *document = renderer->document;
|
||||||
@ -128,7 +128,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
|||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
|
||||||
|
|
||||||
assert(renderer && template && string && length);
|
assert(renderer && template_ && string && length);
|
||||||
|
|
||||||
string = convert_string(convert, string, length, document->options.cp,
|
string = convert_string(convert, string, length, document->options.cp,
|
||||||
mode, &length, NULL, NULL);
|
mode, &length, NULL, NULL);
|
||||||
@ -155,7 +155,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
|||||||
int tab_width = 7 - (X(renderer) & 7);
|
int tab_width = 7 - (X(renderer) & 7);
|
||||||
int width = WIDTH(renderer, length - x + tab_width);
|
int width = WIDTH(renderer, length - x + tab_width);
|
||||||
|
|
||||||
template->data = ' ';
|
template_->data = ' ';
|
||||||
|
|
||||||
if (!realloc_line(document, width, Y(renderer)))
|
if (!realloc_line(document, width, Y(renderer)))
|
||||||
break;
|
break;
|
||||||
@ -163,7 +163,7 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
|||||||
/* Only loop over the expanded tab chars and let the
|
/* Only loop over the expanded tab chars and let the
|
||||||
* ``main loop'' add the actual tab char. */
|
* ``main loop'' add the actual tab char. */
|
||||||
for (; tab_width-- > 0; renderer->canvas_x++)
|
for (; tab_width-- > 0; renderer->canvas_x++)
|
||||||
copy_screen_chars(POS(renderer), template, 1);
|
copy_screen_chars(POS(renderer), template_, 1);
|
||||||
charlen = 1;
|
charlen = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -174,22 +174,22 @@ render_dom_line(struct dom_renderer *renderer, struct screen_char *template,
|
|||||||
charlen = utf8charlen(text);
|
charlen = utf8charlen(text);
|
||||||
data = utf8_to_unicode(&text, end);
|
data = utf8_to_unicode(&text, end);
|
||||||
|
|
||||||
template->data = (unicode_val_T)data;
|
template_->data = (unicode_val_T)data;
|
||||||
|
|
||||||
if (unicode_to_cell(data) == 2) {
|
if (unicode_to_cell(data) == 2) {
|
||||||
copy_screen_chars(POS(renderer),
|
copy_screen_chars(POS(renderer),
|
||||||
template, 1);
|
template_, 1);
|
||||||
|
|
||||||
X(renderer)++;
|
X(renderer)++;
|
||||||
template->data = UCS_NO_CHAR;
|
template_->data = UCS_NO_CHAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
template->data = isscreensafe(*text) ? *text:'.';
|
template_->data = isscreensafe(*text) ? *text:'.';
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_screen_chars(POS(renderer), template, 1);
|
copy_screen_chars(POS(renderer), template_, 1);
|
||||||
}
|
}
|
||||||
mem_free(string);
|
mem_free(string);
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ split_dom_line(unsigned char *line, int length, int *linelen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
render_dom_text(struct dom_renderer *renderer, struct screen_char *template,
|
render_dom_text(struct dom_renderer *renderer, struct screen_char *template_,
|
||||||
unsigned char *string, int length)
|
unsigned char *string, int length)
|
||||||
{
|
{
|
||||||
int linelen;
|
int linelen;
|
||||||
@ -231,7 +231,7 @@ render_dom_text(struct dom_renderer *renderer, struct screen_char *template,
|
|||||||
unsigned char *newline = split_dom_line(string, length, &linelen);
|
unsigned char *newline = split_dom_line(string, length, &linelen);
|
||||||
|
|
||||||
if (linelen)
|
if (linelen)
|
||||||
render_dom_line(renderer, template, string, linelen);
|
render_dom_line(renderer, template_, string, linelen);
|
||||||
|
|
||||||
if (newline) {
|
if (newline) {
|
||||||
renderer->canvas_y++;
|
renderer->canvas_y++;
|
||||||
@ -254,7 +254,7 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length,
|
|||||||
unsigned char *where;
|
unsigned char *where;
|
||||||
struct link *link;
|
struct link *link;
|
||||||
struct point *point;
|
struct point *point;
|
||||||
struct screen_char template;
|
struct screen_char template_;
|
||||||
color_T fgcolor;
|
color_T fgcolor;
|
||||||
|
|
||||||
if (!realloc_document_links(document, document->nlinks + 1))
|
if (!realloc_document_links(document, document->nlinks + 1))
|
||||||
@ -294,10 +294,10 @@ add_dom_link(struct dom_renderer *renderer, unsigned char *string, int length,
|
|||||||
link->color.foreground = fgcolor;
|
link->color.foreground = fgcolor;
|
||||||
link->number = document->nlinks;
|
link->number = document->nlinks;
|
||||||
|
|
||||||
init_template(&template, &document->options,
|
init_template(&template_, &document->options,
|
||||||
0, link->color.foreground, link->color.background);
|
0, link->color.foreground, link->color.background);
|
||||||
|
|
||||||
render_dom_text(renderer, &template, string, length);
|
render_dom_text(renderer, &template_, string, length);
|
||||||
|
|
||||||
for (point = link->points; length > 0; length--, point++, x++) {
|
for (point = link->points; length > 0; length--, point++, x++) {
|
||||||
point->x = x;
|
point->x = x;
|
||||||
|
@ -42,11 +42,11 @@ struct dom_renderer {
|
|||||||
#define Y(renderer) ((renderer)->canvas_y)
|
#define Y(renderer) ((renderer)->canvas_y)
|
||||||
|
|
||||||
|
|
||||||
void init_template_by_style(struct screen_char *template,
|
void init_template_by_style(struct screen_char *template_,
|
||||||
struct document_options *options,
|
struct document_options *options,
|
||||||
LIST_OF(struct css_property) *properties);
|
LIST_OF(struct css_property) *properties);
|
||||||
|
|
||||||
void render_dom_text(struct dom_renderer *renderer, struct screen_char *template,
|
void render_dom_text(struct dom_renderer *renderer, struct screen_char *template_,
|
||||||
unsigned char *string, int length);
|
unsigned char *string, int length);
|
||||||
struct link *add_dom_link(struct dom_renderer *renderer, unsigned char *string,
|
struct link *add_dom_link(struct dom_renderer *renderer, unsigned char *string,
|
||||||
int length, unsigned char *uristring, int urilength);
|
int length, unsigned char *uristring, int urilength);
|
||||||
|
@ -14,33 +14,33 @@
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
get_screen_char_template(struct screen_char *template,
|
get_screen_char_template(struct screen_char *template_,
|
||||||
struct document_options *options,
|
struct document_options *options,
|
||||||
struct text_style style)
|
struct text_style style)
|
||||||
{
|
{
|
||||||
template->attr = 0;
|
template_->attr = 0;
|
||||||
template->data = ' ';
|
template_->data = ' ';
|
||||||
|
|
||||||
if (style.attr) {
|
if (style.attr) {
|
||||||
if (style.attr & AT_UNDERLINE) {
|
if (style.attr & AT_UNDERLINE) {
|
||||||
template->attr |= SCREEN_ATTR_UNDERLINE;
|
template_->attr |= SCREEN_ATTR_UNDERLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.attr & AT_BOLD) {
|
if (style.attr & AT_BOLD) {
|
||||||
template->attr |= SCREEN_ATTR_BOLD;
|
template_->attr |= SCREEN_ATTR_BOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.attr & AT_ITALIC) {
|
if (style.attr & AT_ITALIC) {
|
||||||
template->attr |= SCREEN_ATTR_ITALIC;
|
template_->attr |= SCREEN_ATTR_ITALIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (style.attr & AT_GRAPHICS) {
|
if (style.attr & AT_GRAPHICS) {
|
||||||
template->attr |= SCREEN_ATTR_FRAME;
|
template_->attr |= SCREEN_ATTR_FRAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
struct color_pair colors = INIT_COLOR_PAIR(style.color.background, style.color.foreground);
|
struct color_pair colors = INIT_COLOR_PAIR(style.color.background, style.color.foreground);
|
||||||
set_term_color(template, &colors, options->color_flags, options->color_mode);
|
set_term_color(template_, &colors, options->color_flags, options->color_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ struct text_style {
|
|||||||
|
|
||||||
#define INIT_TEXT_STYLE(attr, fg, bg) { attr, {fg, bg}}
|
#define INIT_TEXT_STYLE(attr, fg, bg) { attr, {fg, bg}}
|
||||||
|
|
||||||
void get_screen_char_template(struct screen_char *template, struct document_options *options, struct text_style style);
|
void get_screen_char_template(struct screen_char *template_, struct document_options *options, struct text_style style);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ get_frame_char(struct html_context *html_context, struct part *part,
|
|||||||
int x, int y, unsigned char data,
|
int x, int y, unsigned char data,
|
||||||
color_T bgcolor, color_T fgcolor)
|
color_T bgcolor, color_T fgcolor)
|
||||||
{
|
{
|
||||||
struct screen_char *template;
|
struct screen_char *template_;
|
||||||
|
|
||||||
assert(html_context);
|
assert(html_context);
|
||||||
if_assert_failed return NULL;
|
if_assert_failed return NULL;
|
||||||
@ -289,14 +289,14 @@ get_frame_char(struct html_context *html_context, struct part *part,
|
|||||||
assert(part->document->data);
|
assert(part->document->data);
|
||||||
if_assert_failed return NULL;
|
if_assert_failed return NULL;
|
||||||
|
|
||||||
template = &POS(x, y);
|
template_ = &POS(x, y);
|
||||||
template->data = data;
|
template_->data = data;
|
||||||
template->attr = SCREEN_ATTR_FRAME;
|
template_->attr = SCREEN_ATTR_FRAME;
|
||||||
set_screen_char_color(template, bgcolor, fgcolor,
|
set_screen_char_color(template_, bgcolor, fgcolor,
|
||||||
part->document->options.color_flags,
|
part->document->options.color_flags,
|
||||||
part->document->options.color_mode);
|
part->document->options.color_mode);
|
||||||
|
|
||||||
return template;
|
return template_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -304,17 +304,17 @@ draw_frame_hchars(struct part *part, int x, int y, int width,
|
|||||||
unsigned char data, color_T bgcolor, color_T fgcolor,
|
unsigned char data, color_T bgcolor, color_T fgcolor,
|
||||||
struct html_context *html_context)
|
struct html_context *html_context)
|
||||||
{
|
{
|
||||||
struct screen_char *template;
|
struct screen_char *template_;
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
if_assert_failed return;
|
if_assert_failed return;
|
||||||
|
|
||||||
template = get_frame_char(html_context, part, x + width - 1, y, data, bgcolor, fgcolor);
|
template_ = get_frame_char(html_context, part, x + width - 1, y, data, bgcolor, fgcolor);
|
||||||
if (!template) return;
|
if (!template_) return;
|
||||||
|
|
||||||
/* The template char is the last we need to draw so only decrease @width. */
|
/* The template char is the last we need to draw so only decrease @width. */
|
||||||
for (width -= 1; width; width--, x++) {
|
for (width -= 1; width; width--, x++) {
|
||||||
copy_screen_chars(&POS(x, y), template, 1);
|
copy_screen_chars(&POS(x, y), template_, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,10 +323,10 @@ draw_frame_vchars(struct part *part, int x, int y, int height,
|
|||||||
unsigned char data, color_T bgcolor, color_T fgcolor,
|
unsigned char data, color_T bgcolor, color_T fgcolor,
|
||||||
struct html_context *html_context)
|
struct html_context *html_context)
|
||||||
{
|
{
|
||||||
struct screen_char *template = get_frame_char(html_context, part, x, y,
|
struct screen_char *template_ = get_frame_char(html_context, part, x, y,
|
||||||
data, bgcolor, fgcolor);
|
data, bgcolor, fgcolor);
|
||||||
|
|
||||||
if (!template) return;
|
if (!template_) return;
|
||||||
|
|
||||||
/* The template char is the first vertical char to be drawn. So
|
/* The template char is the first vertical char to be drawn. So
|
||||||
* copy it to the rest. */
|
* copy it to the rest. */
|
||||||
@ -334,7 +334,7 @@ draw_frame_vchars(struct part *part, int x, int y, int height,
|
|||||||
if (realloc_line(html_context, part->document, Y(y), X(x)) < 0)
|
if (realloc_line(html_context, part->document, Y(y), X(x)) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
copy_screen_chars(&POS(x, y), template, 1);
|
copy_screen_chars(&POS(x, y), template_, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ struct plain_renderer {
|
|||||||
struct conv_table *convert_table;
|
struct conv_table *convert_table;
|
||||||
|
|
||||||
/* The default template char data for text */
|
/* The default template char data for text */
|
||||||
struct screen_char template;
|
struct screen_char template_;
|
||||||
|
|
||||||
/* The maximum width any line can have (used for wrapping text) */
|
/* The maximum width any line can have (used for wrapping text) */
|
||||||
int max_width;
|
int max_width;
|
||||||
@ -187,7 +187,7 @@ print_document_link(struct plain_renderer *renderer, int lineno,
|
|||||||
int link_end = line_pos + len;
|
int link_end = line_pos + len;
|
||||||
unsigned char saved_char;
|
unsigned char saved_char;
|
||||||
struct document_options *doc_opts = &document->options;
|
struct document_options *doc_opts = &document->options;
|
||||||
struct screen_char template = renderer->template;
|
struct screen_char template_ = renderer->template_;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!len) return 0;
|
if (!len) return 0;
|
||||||
@ -217,12 +217,12 @@ print_document_link(struct plain_renderer *renderer, int lineno,
|
|||||||
|
|
||||||
new_link->color.background = doc_opts->default_style.color.background;
|
new_link->color.background = doc_opts->default_style.color.background;
|
||||||
|
|
||||||
set_term_color(&template, &new_link->color,
|
set_term_color(&template_, &new_link->color,
|
||||||
doc_opts->color_flags, doc_opts->color_mode);
|
doc_opts->color_flags, doc_opts->color_mode);
|
||||||
|
|
||||||
for (i = len; i; i--) {
|
for (i = len; i; i--) {
|
||||||
template.data = line[line_pos++];
|
template_.data = line[line_pos++];
|
||||||
copy_screen_chars(pos++, &template, 1);
|
copy_screen_chars(pos++, &template_, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
@ -230,7 +230,7 @@ print_document_link(struct plain_renderer *renderer, int lineno,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
decode_esc_color(unsigned char *text, int *line_pos, int width,
|
decode_esc_color(unsigned char *text, int *line_pos, int width,
|
||||||
struct screen_char *template, enum color_mode mode,
|
struct screen_char *template_, enum color_mode mode,
|
||||||
int *was_reversed)
|
int *was_reversed)
|
||||||
{
|
{
|
||||||
struct screen_char ch;
|
struct screen_char ch;
|
||||||
@ -252,7 +252,7 @@ decode_esc_color(unsigned char *text, int *line_pos, int width,
|
|||||||
end = buf + k;
|
end = buf + k;
|
||||||
begin = tail = buf;
|
begin = tail = buf;
|
||||||
|
|
||||||
get_screen_char_color(template, &color, 0, mode);
|
get_screen_char_color(template_, &color, 0, mode);
|
||||||
set_term_color(&ch, &color, 0, COLOR_MODE_16);
|
set_term_color(&ch, &color, 0, COLOR_MODE_16);
|
||||||
b1 = background = (ch.c.color[0] >> 4) & 7;
|
b1 = background = (ch.c.color[0] >> 4) & 7;
|
||||||
f1 = foreground = ch.c.color[0] & 15;
|
f1 = foreground = ch.c.color[0] & 15;
|
||||||
@ -306,7 +306,7 @@ decode_esc_color(unsigned char *text, int *line_pos, int width,
|
|||||||
}
|
}
|
||||||
color.background = get_term_color16(background);
|
color.background = get_term_color16(background);
|
||||||
color.foreground = get_term_color16(foreground);
|
color.foreground = get_term_color16(foreground);
|
||||||
set_term_color(template, &color, 0, mode);
|
set_term_color(template_, &color, 0, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
@ -314,8 +314,8 @@ add_document_line(struct plain_renderer *renderer,
|
|||||||
unsigned char *line, int line_width)
|
unsigned char *line, int line_width)
|
||||||
{
|
{
|
||||||
struct document *document = renderer->document;
|
struct document *document = renderer->document;
|
||||||
struct screen_char *template = &renderer->template;
|
struct screen_char *template_ = &renderer->template_;
|
||||||
struct screen_char saved_renderer_template = *template;
|
struct screen_char saved_renderer_template = *template_;
|
||||||
struct screen_char *pos, *startpos;
|
struct screen_char *pos, *startpos;
|
||||||
struct document_options *doc_opts = &document->options;
|
struct document_options *doc_opts = &document->options;
|
||||||
int was_reversed = 0;
|
int was_reversed = 0;
|
||||||
@ -427,12 +427,12 @@ add_document_line(struct plain_renderer *renderer,
|
|||||||
|
|
||||||
expanded += tab_width;
|
expanded += tab_width;
|
||||||
|
|
||||||
template->data = ' ';
|
template_->data = ' ';
|
||||||
do
|
do
|
||||||
copy_screen_chars(pos++, template, 1);
|
copy_screen_chars(pos++, template_, 1);
|
||||||
while (tab_width--);
|
while (tab_width--);
|
||||||
|
|
||||||
*template = saved_renderer_template;
|
*template_ = saved_renderer_template;
|
||||||
|
|
||||||
} else if (line_char == ASCII_BS) {
|
} else if (line_char == ASCII_BS) {
|
||||||
if (!(expanded + cells)) {
|
if (!(expanded + cells)) {
|
||||||
@ -475,32 +475,32 @@ add_document_line(struct plain_renderer *renderer,
|
|||||||
&& (pos - 1)->attr) {
|
&& (pos - 1)->attr) {
|
||||||
/* There is some preceding text,
|
/* There is some preceding text,
|
||||||
* and it has an attribute; copy it */
|
* and it has an attribute; copy it */
|
||||||
template->attr |= (pos - 1)->attr;
|
template_->attr |= (pos - 1)->attr;
|
||||||
} else {
|
} else {
|
||||||
/* Default to bold; seems more useful
|
/* Default to bold; seems more useful
|
||||||
* than underlining the underscore */
|
* than underlining the underscore */
|
||||||
template->attr |= SCREEN_ATTR_BOLD;
|
template_->attr |= SCREEN_ATTR_BOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (pos->data == '_') {
|
} else if (pos->data == '_') {
|
||||||
/* Underline _^Hx */
|
/* Underline _^Hx */
|
||||||
|
|
||||||
template->attr |= SCREEN_ATTR_UNDERLINE;
|
template_->attr |= SCREEN_ATTR_UNDERLINE;
|
||||||
|
|
||||||
} else if (pos->data == next_char) {
|
} else if (pos->data == next_char) {
|
||||||
/* Embolden x^Hx */
|
/* Embolden x^Hx */
|
||||||
|
|
||||||
template->attr |= SCREEN_ATTR_BOLD;
|
template_->attr |= SCREEN_ATTR_BOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle _^Hx^Hx as both bold and underlined */
|
/* Handle _^Hx^Hx as both bold and underlined */
|
||||||
if (template->attr)
|
if (template_->attr)
|
||||||
template->attr |= pos->attr;
|
template_->attr |= pos->attr;
|
||||||
} else if (line_char == 27) {
|
} else if (line_char == 27) {
|
||||||
decode_esc_color(line, &line_pos, width,
|
decode_esc_color(line, &line_pos, width,
|
||||||
&saved_renderer_template,
|
&saved_renderer_template,
|
||||||
doc_opts->color_mode, &was_reversed);
|
doc_opts->color_mode, &was_reversed);
|
||||||
*template = saved_renderer_template;
|
*template_ = saved_renderer_template;
|
||||||
} else {
|
} else {
|
||||||
int added_chars = 0;
|
int added_chars = 0;
|
||||||
|
|
||||||
@ -531,21 +531,21 @@ add_document_line(struct plain_renderer *renderer,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
template->data = (unicode_val_T)data;
|
template_->data = (unicode_val_T)data;
|
||||||
copy_screen_chars(pos++, template, 1);
|
copy_screen_chars(pos++, template_, 1);
|
||||||
|
|
||||||
if (cell == 2) {
|
if (cell == 2) {
|
||||||
template->data = UCS_NO_CHAR;
|
template_->data = UCS_NO_CHAR;
|
||||||
copy_screen_chars(pos++,
|
copy_screen_chars(pos++,
|
||||||
template, 1);
|
template_, 1);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
{
|
{
|
||||||
if (!isscreensafe(line_char))
|
if (!isscreensafe(line_char))
|
||||||
line_char = '.';
|
line_char = '.';
|
||||||
template->data = line_char;
|
template_->data = line_char;
|
||||||
copy_screen_chars(pos++, template, 1);
|
copy_screen_chars(pos++, template_, 1);
|
||||||
|
|
||||||
/* Detect copy of nul chars to screen,
|
/* Detect copy of nul chars to screen,
|
||||||
* this should not occur. --Zas */
|
* this should not occur. --Zas */
|
||||||
@ -553,7 +553,7 @@ add_document_line(struct plain_renderer *renderer,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*template = saved_renderer_template;
|
*template_ = saved_renderer_template;
|
||||||
}
|
}
|
||||||
next:
|
next:
|
||||||
line_pos += charlen;
|
line_pos += charlen;
|
||||||
@ -567,9 +567,9 @@ next:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_template(struct screen_char *template, struct document_options *options)
|
init_template(struct screen_char *template_, struct document_options *options)
|
||||||
{
|
{
|
||||||
get_screen_char_template(template, options, options->default_style);
|
get_screen_char_template(template_, options, options->default_style);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct node *
|
static struct node *
|
||||||
@ -734,7 +734,7 @@ render_plain_document(struct cache_entry *cached, struct document *document,
|
|||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
|
|
||||||
/* Setup the style */
|
/* Setup the style */
|
||||||
init_template(&renderer.template, &document->options);
|
init_template(&renderer.template_, &document->options);
|
||||||
|
|
||||||
add_document_lines(&renderer);
|
add_document_lines(&renderer);
|
||||||
}
|
}
|
||||||
|
@ -224,7 +224,7 @@ gettimeofday(struct timeval* p, void* tz)
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
mkstemp(char *template)
|
mkstemp(char *template_)
|
||||||
{
|
{
|
||||||
char pathname[MAX_PATH];
|
char pathname[MAX_PATH];
|
||||||
|
|
||||||
@ -232,9 +232,9 @@ mkstemp(char *template)
|
|||||||
GetTempPath(MAX_PATH, pathname);
|
GetTempPath(MAX_PATH, pathname);
|
||||||
|
|
||||||
/* Create a temporary file. */
|
/* Create a temporary file. */
|
||||||
GetTempFileName(pathname, "ABC", 0, template);
|
GetTempFileName(pathname, "ABC", 0, template_);
|
||||||
|
|
||||||
return open(template, O_WRONLY | O_BINARY | O_EXCL);
|
return open(template_, O_WRONLY | O_BINARY | O_EXCL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -19,7 +19,7 @@ unsigned char *user_appdata_directory(void);
|
|||||||
|
|
||||||
/* Stub functions: */
|
/* Stub functions: */
|
||||||
|
|
||||||
int mkstemp (char *template);
|
int mkstemp (char *template_);
|
||||||
int gettimeofday (struct timeval *tv, void *tz);
|
int gettimeofday (struct timeval *tv, void *tz);
|
||||||
|
|
||||||
/* fake termios for Win32 (excluding CygWin) */
|
/* fake termios for Win32 (excluding CygWin) */
|
||||||
|
@ -396,7 +396,7 @@ normalize_bencoding_path(const unsigned char *path, int pathlen,
|
|||||||
* checked for sanity. */
|
* checked for sanity. */
|
||||||
static enum bittorrent_state
|
static enum bittorrent_state
|
||||||
add_bittorrent_file(struct bittorrent_meta *meta, unsigned char *path,
|
add_bittorrent_file(struct bittorrent_meta *meta, unsigned char *path,
|
||||||
struct bittorrent_file *template)
|
struct bittorrent_file *template_)
|
||||||
{
|
{
|
||||||
struct bittorrent_file *file;
|
struct bittorrent_file *file;
|
||||||
int malicious;
|
int malicious;
|
||||||
@ -417,7 +417,7 @@ add_bittorrent_file(struct bittorrent_meta *meta, unsigned char *path,
|
|||||||
return BITTORRENT_STATE_OUT_OF_MEM;
|
return BITTORRENT_STATE_OUT_OF_MEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_struct(file, template);
|
copy_struct(file, template_);
|
||||||
memcpy(file->name, path, pathlen);
|
memcpy(file->name, path, pathlen);
|
||||||
mem_free(path);
|
mem_free(path);
|
||||||
|
|
||||||
|
@ -271,12 +271,12 @@ file_read_line(unsigned char *line, size_t *size, FILE *file, int *lineno)
|
|||||||
* set appropriately before calling mkstemp.
|
* set appropriately before calling mkstemp.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
safe_mkstemp(unsigned char *template)
|
safe_mkstemp(unsigned char *template_)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_OS_WIN32
|
#ifndef CONFIG_OS_WIN32
|
||||||
mode_t saved_mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
|
mode_t saved_mask = umask(S_IXUSR | S_IRWXG | S_IRWXO);
|
||||||
#endif
|
#endif
|
||||||
int fd = mkstemp(template);
|
int fd = mkstemp(template_);
|
||||||
#ifndef CONFIG_OS_WIN32
|
#ifndef CONFIG_OS_WIN32
|
||||||
umask(saved_mask);
|
umask(saved_mask);
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,7 +56,7 @@ unsigned char *file_read_line(unsigned char *line, size_t *linesize,
|
|||||||
/** Safe wrapper for mkstemp().
|
/** Safe wrapper for mkstemp().
|
||||||
* It enforces permissions by calling umask(0177), call mkstemp(), then
|
* It enforces permissions by calling umask(0177), call mkstemp(), then
|
||||||
* restore previous umask(). */
|
* restore previous umask(). */
|
||||||
int safe_mkstemp(unsigned char *template);
|
int safe_mkstemp(unsigned char *template_);
|
||||||
|
|
||||||
/** Recursively create directories in @a path. The last element in the path is
|
/** Recursively create directories in @a path. The last element in the path is
|
||||||
* taken to be a filename, and simply ignored */
|
* taken to be a filename, and simply ignored */
|
||||||
|
@ -169,12 +169,12 @@ 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)
|
||||||
{
|
{
|
||||||
struct document_options *doc_opts;
|
struct document_options *doc_opts;
|
||||||
static struct screen_char template;
|
static struct screen_char template_;
|
||||||
enum color_flags color_flags;
|
enum color_flags color_flags;
|
||||||
enum color_mode color_mode;
|
enum color_mode color_mode;
|
||||||
struct color_pair colors;
|
struct color_pair colors;
|
||||||
|
|
||||||
template.attr = SCREEN_ATTR_STANDOUT;
|
template_.attr = SCREEN_ATTR_STANDOUT;
|
||||||
|
|
||||||
doc_opts = &doc_view->document->options;
|
doc_opts = &doc_view->document->options;
|
||||||
|
|
||||||
@ -182,10 +182,10 @@ init_link_drawing(struct document_view *doc_view, struct link *link, int invert)
|
|||||||
color_mode = doc_opts->color_mode;
|
color_mode = doc_opts->color_mode;
|
||||||
|
|
||||||
if (doc_opts->active_link.underline)
|
if (doc_opts->active_link.underline)
|
||||||
template.attr |= SCREEN_ATTR_UNDERLINE;
|
template_.attr |= SCREEN_ATTR_UNDERLINE;
|
||||||
|
|
||||||
if (doc_opts->active_link.bold)
|
if (doc_opts->active_link.bold)
|
||||||
template.attr |= SCREEN_ATTR_BOLD;
|
template_.attr |= SCREEN_ATTR_BOLD;
|
||||||
|
|
||||||
if (doc_opts->active_link.enable_color) {
|
if (doc_opts->active_link.enable_color) {
|
||||||
colors.foreground = doc_opts->active_link.color.foreground;
|
colors.foreground = doc_opts->active_link.color.foreground;
|
||||||
@ -218,9 +218,9 @@ init_link_drawing(struct document_view *doc_view, struct link *link, int invert)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_term_color(&template, &colors, color_flags, color_mode);
|
set_term_color(&template_, &colors, color_flags, color_mode);
|
||||||
|
|
||||||
return &template;
|
return &template_;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Give the current link the appropriate colour and attributes. */
|
/** Give the current link the appropriate colour and attributes. */
|
||||||
@ -228,7 +228,7 @@ void
|
|||||||
draw_current_link(struct session *ses, struct document_view *doc_view)
|
draw_current_link(struct session *ses, struct document_view *doc_view)
|
||||||
{
|
{
|
||||||
struct terminal *term = ses->tab->term;
|
struct terminal *term = ses->tab->term;
|
||||||
struct screen_char *template;
|
struct screen_char *template_;
|
||||||
struct link *link;
|
struct link *link;
|
||||||
int cursor_offset;
|
int cursor_offset;
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
@ -244,8 +244,8 @@ draw_current_link(struct session *ses, struct document_view *doc_view)
|
|||||||
if (!link) return;
|
if (!link) return;
|
||||||
|
|
||||||
i = !link_is_textinput(link) || ses->insert_mode == INSERT_MODE_OFF;
|
i = !link_is_textinput(link) || ses->insert_mode == INSERT_MODE_OFF;
|
||||||
template = init_link_drawing(doc_view, link, i);
|
template_ = init_link_drawing(doc_view, link, i);
|
||||||
if (!template) return;
|
if (!template_) return;
|
||||||
|
|
||||||
xpos = doc_view->box.x - doc_view->vs->x;
|
xpos = doc_view->box.x - doc_view->vs->x;
|
||||||
ypos = doc_view->box.y - doc_view->vs->y;
|
ypos = doc_view->box.y - doc_view->vs->y;
|
||||||
@ -272,14 +272,14 @@ draw_current_link(struct session *ses, struct document_view *doc_view)
|
|||||||
|
|
||||||
if (i == cursor_offset) {
|
if (i == cursor_offset) {
|
||||||
int blockable = (!link_is_textinput(link)
|
int blockable = (!link_is_textinput(link)
|
||||||
&& co->c.color != template->c.color);
|
&& co->c.color != template_->c.color);
|
||||||
|
|
||||||
set_cursor(term, x, y, blockable);
|
set_cursor(term, x, y, blockable);
|
||||||
set_window_ptr(ses->tab, x, y);
|
set_window_ptr(ses->tab, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
template->data = co->data;
|
template_->data = co->data;
|
||||||
copy_screen_chars(co, template, 1);
|
copy_screen_chars(co, template_, 1);
|
||||||
set_screen_dirty(term->screen, y, y);
|
set_screen_dirty(term->screen, y, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user