Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear image w3mimgdisplay op behaving erratically in some terminal emulators #94

dvejmz opened this issue Oct 17, 2017 · 0 comments


Copy link

dvejmz commented Oct 17, 2017


Images are not being cleared out correctly in some terminal emulators (see list below). When invoking w3mimgdisplay from an X11 environment, sending op. 6 (clear image) doesn't remove the image from the screen completely, leaving in some cases a black patch or not doing anything at all.

This issue comes from the ranger community and has been a problem there for quite some time now, as you can see from this list of issues:

This is a non-exhaustive list of all the terminal emulators where w3mimgdisplay has been found to be partially broken at least, especially the image clearing op:

  • Konsole: "clear image" functionality doesn't work
  • Terminator: "clear image" functionality doesn't work
  • gnome-terminal: "clear image" functionality works partially. Image is "blacked out" instead of being completely cleared off (see below)
  • Termite
  • st

Conversely, w3mimgdisplay seems to work almost perfectly in xterm (which is to be expected) and, to a slightly lesser degree, in rxvt and derivatives.

I've not tried with more emulators yet but will do as soon as I have some more free time, although I wager few of them will support it any better than xterm, rxvt (and forks) would do...

I'm not very familiar with the codebase but a quick glance at it might point us in the direction of this file


Perhaps this function or the way XClearArea from the X11 libs is invoked from within?

static int
x11_clear(w3mimg_op * self, int x, int y, int w, int h)
    struct x11_info *xi;
    if (self == NULL)
	return 0;
    xi = (struct x11_info *)self->priv;
    if (xi == NULL)
	return 0;

    if (x < 0)
	x = 0;
    if (y < 0)
	y = 0;

    XClearArea(xi->display, xi->window, x, y, w, h, False);
    return 1;

Do you think it'd be feasible to fix this somehow?


Can't really tell what environments all the people reporting these problems in the past were running but mine is:


I've tested w3mimgdisplay in isolation with the "draw" and "clear" image commands. For that I used this script (credit to this guy for the script), which you can see me launching in the examples below.

For clarity, the commands that I'm running in the examples below are

# ./ -d mfw.jpg
echo -e '0;1;0;0;133;200;;;;;mfw.jpg\n4;\n3;' | /usr/libexec/w3m/w3mimgdisplay
# ./ -c mfw.jpg
echo -e '6;0;0;133;200;\n4;\n3;' | /usr/libexec/w3m/w3mimgdisplay

Nevermind the pic, it was the first one I grabbed :)







Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant