st-flexipatch icon indicating copy to clipboard operation
st-flexipatch copied to clipboard

glitches after opening new windows?

Open 0xGodspeed opened this issue 3 years ago • 30 comments

image image no idea what causes this the patches i have enabled are:

alpha
anysize
anysize_nobar
boxdraw
clipboard
columns
font2
ligatures
newterm
openurlonclick
scrollback
scrollback_mouse
sixel
sync
w3m
xresources
xresources_reload

0xGodspeed avatar Jul 29 '21 08:07 0xGodspeed

This looks to be caused by the anysize patch.

I can replicate this by making the st terminal floating and resizing it vertically. It's a bit silly that it tries to center the content of the terminal, other terminals don't do this as far as I can see.

bakkeby avatar Jul 29 '21 09:07 bakkeby

so is there a fix for this?

0xGodspeed avatar Jul 29 '21 09:07 0xGodspeed

Try this, enabled via ANYSIZE_SIMPLE_PATCH. I don't understand why the anysize patch is so convoluted. I don't think you need the ANYSIZE_NOBAR_PATCH, but you can enable it if you observe any graphical issues.

bakkeby avatar Jul 29 '21 10:07 bakkeby

it works fine with anysize_simple_patch also i just noticed another thing whenever i exit neovim ;420;720t gets printed on the terminal Peek 2021-07-29 20-06

0xGodspeed avatar Jul 29 '21 14:07 0xGodspeed

You are right, I see it as well.

It comes from the sixel patch, I am not entirely sure why it is needed:

    #if SIXEL_PATCH
    case 't':
        /* TODO should probably not be hard-coded */
        ttywrite(";420;720t", 10, 1);
        break;
    #endif // SIXEL_PATCH

bakkeby avatar Jul 29 '21 14:07 bakkeby

what is that case for?

0xGodspeed avatar Jul 29 '21 14:07 0xGodspeed

I don't know, I checked https://github.com/charlesdaniels/st and it's the same behaviour there.

Thankfully the commit comment has an explanation: https://github.com/charlesdaniels/st/commit/b50be8225dd2cd6de35a9b6219c556bac355255c

bakkeby avatar Jul 29 '21 15:07 bakkeby

i also just realized sixel doesn't work in my terminal. lsix doesn't display any images

0xGodspeed avatar Jul 29 '21 15:07 0xGodspeed

I removed the case, couldn't replicate the scenario about the scrollback buffer.

bakkeby avatar Jul 29 '21 15:07 bakkeby

As for sixel, you may want to try img2sixel as well. If it doesn't show anything then maybe double check that you indeed still have the SIXEL_PATCH enabled.

bakkeby avatar Jul 29 '21 15:07 bakkeby

img2sixel is in libsixel package right? is there a binary for it? i dont know why but the aur package doesn't compile properly

0xGodspeed avatar Jul 29 '21 15:07 0xGodspeed

I'm not aware of a binary for it, I use the aur/libsixel installed using paru.

bakkeby avatar Jul 29 '21 16:07 bakkeby

i tried and img2sixel isn't working i do have sixel_patch enabled

0xGodspeed avatar Jul 29 '21 18:07 0xGodspeed

I don't know then, maybe double check if sixel graphics is working in other terminals.

There's mlterm where this works out of the box (although the placement of the image is always at the top of the terminal window and is subject to cropping).

In xterm you can enable sixel support by adding this to your ~/.Xresources file:

xterm*decTerminalID : vt340

I must say I like how smooth the scrolling of images is in xterm.

bakkeby avatar Jul 30 '21 08:07 bakkeby

yeah they work in xterm

0xGodspeed avatar Jul 30 '21 11:07 0xGodspeed

eh it's fine, i don't need sixel that much anyway thanks for resolving everything else!

0xGodspeed avatar Jul 30 '21 11:07 0xGodspeed

@godspeedfw Yeah the current hint in the patches.def.h about removing lines to get SIXEL to work is a bit misleading. I dunno why it was removed removed from the Makefile, but it will work if you add SIXEL_C = sixel.c sixel_hls.c like here (but to line 6): https://github.com/bakkeby/st-flexipatch/blob/245c409863f97e637902837be4482dd398b38d3a/Makefile#L11-L12 I cloned the repo again, added that, run make and sudo make install and lsix just worked.

schrmh avatar Aug 03 '21 23:08 schrmh

nope, still doesn't work for me

0xGodspeed avatar Aug 05 '21 07:08 0xGodspeed

and I think it was removed because SIXEL_C is defined in config.mk which is included in the Makefile

0xGodspeed avatar Aug 05 '21 07:08 0xGodspeed

So what is in your config.mk?

bakkeby avatar Aug 05 '21 07:08 bakkeby

# st version
VERSION = 0.8.4

# Customize below to fit your system

# paths
PREFIX = /usr/local
MANPREFIX = $(PREFIX)/share/man

X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib

PKG_CONFIG = pkg-config

# Uncomment this for the alpha patch / ALPHA_PATCH
XRENDER = -lXrender

# Uncomment this for the themed cursor patch / THEMED_CURSOR_PATCH
#XCURSOR = -lXcursor

# Uncomment the lines below for the ligatures patch / LIGATURES_PATCH
LIGATURES_C = hb.c
LIGATURES_H = hb.h
LIGATURES_INC = `$(PKG_CONFIG) --cflags harfbuzz`
LIGATURES_LIBS = `$(PKG_CONFIG) --libs harfbuzz`

# Uncomment this for the SIXEL patch / SIXEL_PATCH
SIXEL_C = sixel.c sixel_hls.c

# includes and libs, uncomment harfbuzz for the ligatures patch
INCS = -I$(X11INC) \
       `$(PKG_CONFIG) --cflags fontconfig` \
       `$(PKG_CONFIG) --cflags freetype2` \
       $(LIGATURES_INC)
LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft ${XRENDER} ${XCURSOR}\
       `$(PKG_CONFIG) --libs fontconfig` \
       `$(PKG_CONFIG) --libs freetype2` \
       $(LIGATURES_LIBS)

# flags
STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS)
STLDFLAGS = $(LIBS) $(LDFLAGS)

# OpenBSD:
#CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
#       `pkg-config --libs fontconfig` \
#       `pkg-config --libs freetype2`

# compiler and linker
# CC = c99

0xGodspeed avatar Aug 05 '21 08:08 0xGodspeed

Do you still have SIXEL_PATCH enabled in your patches.h file?

#define SIXEL_PATCH 1

bakkeby avatar Aug 05 '21 08:08 bakkeby

yes

0xGodspeed avatar Aug 05 '21 08:08 0xGodspeed

I went through the patches again from your first post. Looks like there is a conflict between the w3m patch and the sixel patch that causes this.

bakkeby avatar Aug 05 '21 08:08 bakkeby

You're right, sixel works after I disable w3m. There is no need to make changes in the Makefile either.

0xGodspeed avatar Aug 05 '21 08:08 0xGodspeed

I dunno why it was removed removed from the Makefile

@schrmh I moved all of the ligatures and sixel stuff out of the Makefile into config.mk to make it easier and more consistent for people, i.e. you only need to uncomment things in config.mk now instead of having to fiddle in both that and the Makefile.

I'll update the misleading comment in patches.def.h.

bakkeby avatar Aug 05 '21 08:08 bakkeby

so, can the conflict between w3m and sixel be fixed?

0xGodspeed avatar Aug 05 '21 08:08 0xGodspeed

So to get w3m images to show you need to have both W3M_PATCH and SINGLE_DRAWABLE_BUFFER_PATCH enabled, in which case the SIXEL_PATCH will work as well.

But as far as I can tell you can't combine the above with the ALPHA_PATCH as w3m images do not show then.

bakkeby avatar Aug 05 '21 08:08 bakkeby

do w3m images not show even when transparency is 0 with ALPHA_PATCH enabled?

0xGodspeed avatar Aug 05 '21 08:08 0xGodspeed

nvm i checked and they don't

0xGodspeed avatar Aug 05 '21 08:08 0xGodspeed