mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[options] Added bool option document.plain.sixel
This commit is contained in:
parent
c8f55f5df0
commit
ed1afeb648
@ -868,6 +868,12 @@ static union option_info config_options_info[] = {
|
|||||||
N_("Change ascii border characters to frame borders. Usage example: "
|
N_("Change ascii border characters to frame borders. Usage example: "
|
||||||
"mysql --pager=elinks")),
|
"mysql --pager=elinks")),
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIBSIXEL
|
||||||
|
INIT_OPT_BOOL("document.plain", N_("Sixel"),
|
||||||
|
"sixel", OPT_ZERO, 0,
|
||||||
|
N_("Whether to display sixel images in plain text documents.")),
|
||||||
|
#endif
|
||||||
|
|
||||||
INIT_OPT_TREE("document", N_("URI passing"),
|
INIT_OPT_TREE("document", N_("URI passing"),
|
||||||
"uri_passing", OPT_SORT | OPT_AUTOCREATE,
|
"uri_passing", OPT_SORT | OPT_AUTOCREATE,
|
||||||
N_("Rules for passing URIs to external commands. When one "
|
N_("Rules for passing URIs to external commands. When one "
|
||||||
|
@ -115,6 +115,7 @@ init_document_options(struct session *ses, struct document_options *doo)
|
|||||||
doo->image_link.tagging = get_opt_int("document.browse.images.image_link_tagging", ses);
|
doo->image_link.tagging = get_opt_int("document.browse.images.image_link_tagging", ses);
|
||||||
doo->image_link.show_any_as_links = get_opt_bool("document.browse.images.show_any_as_links", ses);
|
doo->image_link.show_any_as_links = get_opt_bool("document.browse.images.show_any_as_links", ses);
|
||||||
#ifdef CONFIG_LIBSIXEL
|
#ifdef CONFIG_LIBSIXEL
|
||||||
|
doo->sixel = get_opt_bool("document.plain.sixel", ses);
|
||||||
if (ses && ses->tab->term) {
|
if (ses && ses->tab->term) {
|
||||||
doo->cell_width = ses->tab->term->cell_width;
|
doo->cell_width = ses->tab->term->cell_width;
|
||||||
doo->cell_height = ses->tab->term->cell_height;
|
doo->cell_height = ses->tab->term->cell_height;
|
||||||
|
@ -161,6 +161,10 @@ struct document_options {
|
|||||||
unsigned int utf8:1;
|
unsigned int utf8:1;
|
||||||
#endif /* CONFIG_UTF8 */
|
#endif /* CONFIG_UTF8 */
|
||||||
unsigned int dump:1;
|
unsigned int dump:1;
|
||||||
|
|
||||||
|
#ifdef CONFIG_LIBSIXEL
|
||||||
|
unsigned int sixel:1;
|
||||||
|
#endif
|
||||||
/** Active link coloring.
|
/** Active link coloring.
|
||||||
* This is mostly here to make use of this option cache so
|
* This is mostly here to make use of this option cache so
|
||||||
* link drawing is faster. --jonas */
|
* link drawing is faster. --jonas */
|
||||||
|
@ -56,6 +56,8 @@ struct plain_renderer {
|
|||||||
|
|
||||||
/* Are we doing line compression */
|
/* Are we doing line compression */
|
||||||
unsigned int compress:1;
|
unsigned int compress:1;
|
||||||
|
|
||||||
|
unsigned int sixel:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define realloc_document_links(doc, size) \
|
#define realloc_document_links(doc, size) \
|
||||||
@ -642,7 +644,7 @@ add_document_line(struct plain_renderer *renderer,
|
|||||||
template_->attr |= pos->attr;
|
template_->attr |= pos->attr;
|
||||||
} else if (line_char == 27) {
|
} else if (line_char == 27) {
|
||||||
#ifdef CONFIG_LIBSIXEL
|
#ifdef CONFIG_LIBSIXEL
|
||||||
if (line_pos + 1 < width && line[line_pos + 1] == 'P') { // && line_pos + 2 < width && line[line_pos + 2] == 'q') {
|
if (renderer->sixel && line_pos + 1 < width && line[line_pos + 1] == 'P') { // && line_pos + 2 < width && line[line_pos + 2] == 'q') {
|
||||||
while (1) {
|
while (1) {
|
||||||
char *end = (char *)memchr(line + line_pos + 1, 27, width - line_pos - 1);
|
char *end = (char *)memchr(line + line_pos + 1, 27, width - line_pos - 1);
|
||||||
|
|
||||||
@ -1013,6 +1015,9 @@ render_plain_document(struct cache_entry *cached, struct document *document,
|
|||||||
renderer.lineno = 0;
|
renderer.lineno = 0;
|
||||||
renderer.convert_table = convert_table;
|
renderer.convert_table = convert_table;
|
||||||
renderer.compress = document->options.plain_compress_empty_lines;
|
renderer.compress = document->options.plain_compress_empty_lines;
|
||||||
|
#ifdef CONFIG_LIBSIXEL
|
||||||
|
renderer.sixel = document->options.sixel;
|
||||||
|
#endif
|
||||||
renderer.max_width = document->options.wrap ? document->options.document_width
|
renderer.max_width = document->options.wrap ? document->options.document_width
|
||||||
: INT_MAX;
|
: INT_MAX;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user