bakkeby / st-flexipatch

An st build with preprocessor directives to decide which patches to include during build time
MIT License
348 stars 105 forks source link

glitches after opening new windows? #35

Open 0xGodspeed opened 3 years ago

0xGodspeed commented 3 years ago

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
bakkeby commented 3 years ago

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.

0xGodspeed commented 3 years ago

so is there a fix for this?

bakkeby commented 3 years ago

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.

0xGodspeed commented 3 years ago

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

bakkeby commented 3 years ago

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
0xGodspeed commented 3 years ago

what is that case for?

bakkeby commented 3 years ago

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

0xGodspeed commented 3 years ago

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

bakkeby commented 3 years ago

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

bakkeby commented 3 years ago

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.

0xGodspeed commented 3 years ago

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

bakkeby commented 3 years ago

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

0xGodspeed commented 3 years ago

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

bakkeby commented 3 years ago

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.

0xGodspeed commented 3 years ago

yeah they work in xterm

0xGodspeed commented 3 years ago

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

schrmh commented 3 years ago

@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.

0xGodspeed commented 3 years ago

nope, still doesn't work for me

0xGodspeed commented 3 years ago

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

bakkeby commented 3 years ago

So what is in your config.mk?

0xGodspeed commented 3 years ago
# 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
bakkeby commented 3 years ago

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

#define SIXEL_PATCH 1
0xGodspeed commented 3 years ago

yes

bakkeby commented 3 years ago

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.

0xGodspeed commented 3 years ago

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

bakkeby commented 3 years ago

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.

0xGodspeed commented 3 years ago

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

bakkeby commented 3 years ago

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.

0xGodspeed commented 3 years ago

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

0xGodspeed commented 3 years ago

nvm i checked and they don't