diff --git a/src/document/options.c b/src/document/options.c index 7c84f572..5247ec9f 100644 --- a/src/document/options.c +++ b/src/document/options.c @@ -114,6 +114,13 @@ init_document_options(struct session *ses, struct document_options *doo) doo->image_link.display_style = get_opt_int("document.browse.images.display_style", 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); +#ifdef CONFIG_LIBSIXEL + if (ses && ses->tab->term) { + doo->cell_width = ses->tab->term->cell_width; + doo->cell_height = ses->tab->term->cell_height; + } +#endif + } int diff --git a/src/document/options.h b/src/document/options.h index 218d9499..86f8c202 100644 --- a/src/document/options.h +++ b/src/document/options.h @@ -62,7 +62,10 @@ struct document_options { int meta_link_display; int default_form_input_size; int document_width; - +#ifdef CONFIG_LIBSIXEL + int cell_width; + int cell_height; +#endif /** @name The default (fallback) colors. * @{ */ struct text_style default_style; diff --git a/src/terminal/sixel.c b/src/terminal/sixel.c index fed3f906..9811a693 100644 --- a/src/terminal/sixel.c +++ b/src/terminal/sixel.c @@ -849,7 +849,7 @@ add_image_to_document(struct document *doc, struct string *pixels, int lineno) im->height = height; add_string_to_string(&im->pixels, pixels); - ile = (height + 12) / 13; + ile = (height + doc->options.cell_height - 1) / doc->options.cell_height; add_to_list(doc->images, im); end: sixel_frame_unref(frame);