mirror of
https://github.com/rkd77/elinks.git
synced 2025-06-30 22:19:29 -04:00
[sixel] Depend on libdom
Instead of counting image numbers, save offset from start of html document.
This commit is contained in:
parent
c16b5f6f79
commit
7e9130e624
@ -703,6 +703,14 @@ endif
|
||||
if conf_data.get('CONFIG_LIBSIXEL')
|
||||
sixeldeps = dependency('libsixel', static: st)
|
||||
deps += sixeldeps
|
||||
if not conf_data.get('CONFIG_LIBDOM')
|
||||
libdomdeps = dependency('libdom', static: st, version: '>=0.4.2', required: false)
|
||||
if not libdomdeps.found()
|
||||
libdomdeps = dependency('libdom', static: true, version: '>=0.4.2')
|
||||
endif
|
||||
deps += libdomdeps
|
||||
conf_data.set('CONFIG_LIBDOM', true)
|
||||
endif
|
||||
endif
|
||||
|
||||
if conf_data.get('CONFIG_OS_DOS')
|
||||
|
@ -308,11 +308,13 @@ html_img_sixel(struct html_context *html_context, char *a,
|
||||
int xw = (im->width + document->options.cell_width - 1) / document->options.cell_width;
|
||||
int y;
|
||||
|
||||
im->image_number = html_context->image_number++;
|
||||
while (*a && *a != '<') a--;
|
||||
|
||||
im->image_number = *a == '<' ? a + 1 - document->text.source : 0;
|
||||
|
||||
for (y = 0; y < how_many; y++) {
|
||||
int x;
|
||||
html_context->current_number = im->image_number + 33;
|
||||
html_context->current_number = im->image_number;
|
||||
for (x = 0; x < xw; x++) {
|
||||
put_chrs(html_context, "█", 7);
|
||||
}
|
||||
|
@ -448,6 +448,9 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
|
||||
foreach (im2, doc_view->document->images) {
|
||||
struct image im;
|
||||
|
||||
if (!im2->image_number) {
|
||||
continue;
|
||||
}
|
||||
copy_struct(&im, im2);
|
||||
|
||||
int x = 0;
|
||||
@ -455,7 +458,7 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
|
||||
|
||||
if (!found) {
|
||||
for (;x < data[im.y].length; x++) {
|
||||
if ((im.image_number == data[im.y].ch.chars[x].number - 33)) {
|
||||
if (im.image_number == data[im.y].ch.chars[x].number) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user