Open GiorgosXou opened 1 year ago
THAT"S SO WIERD
Ha... there's might be a need of reinitialization (BEGIN...END_MOUSE) when a new pad (like the menu) is created
I think it has to do with the ncurses itself, thinking that the mouse escape sequences are part of a change to the stdscr, forcing it to redraw itself again and again (?)
I need to make a minimal reproducible example before I post the issue and i don't know if I have the time to do so... but I have to do so...
... forcing it to redraw itself again and again (?)
But if this is true, then why it gets fixed the momment I END_MOUSE
> suspend the app > open a subprocess > wait until it closes > BEGIN_MOUSE
???
May the lord of ncurses Thomas E. Dickey , saves me 🙏
(or anyone else lol)
Ok ok... I'll try to make a minimal reproducible example in c\c++ when i find the time (or I'll ask GPT-chat to do so, for me xD )
WTF somehow without changing anything in the source code, now it doesn't flicker... the last thing I remember doing was just to xset r rate 250 30
and play around with kbdrate
which I don't think that they have any anything to do with the issue itself... something more wierd is happening and I can't figure it out
The Issue is completly random, I can't pinpoint when it is happening besides that when it is happening, it gets solved by doing what i've said in the first comment
Sometimes it just works without flickering and some times it doesn't |
---|
I guess we could have some kind of drawing pipeline, where the context menu would be drawn on top, such that other items below it would be partially drawn, to only have 1 update per char location?
from dataclasses import dataclass
from typing import List
@dataclass
class Rect:
x: int
y: int
width: int
height: int
@dataclass
class Drawable:
rect: Rect
z_index: int
content: List[str]
# instead of having a single string with line feeds,
# a list containing each line for easier manipulation.
def render(self, screen, ...):
# Compute whether this intersect with other element,
# Draw the strings to make sure it doesn't replace character
# And don't overdraw a other item with an higher z_index
...
Intersections and redrawing is something that ncurses handles by itself during refresh (really efficiently actually), it's not that much of our business to handle them. Also even if we wanted, this issue kinda prevents as at the momment
Rect
and Drawable
are somewhat equivalent to the ncurses-WINDOW
\pad
[...] This issue apears from nowhere and I don't really know what is causing it really, besides that when it (randomly) appears on startup it gets solved the momment I do what i've said at the first comment
Do you expirience the same issue too? (just to make sure)
Oh well i didn't know that
Do you expirience the same issue too? (just to make sure)
I need to check
Do you expirience the same issue too? It doesn't seem to flicker, but it something isn't properly rendered
could you post a full terminal screenshot, because this seems to be that you just have a really small sized window
I guess having a rendering pipeline (without checking for collision) could be a good idea, so that everything is indexed properly, and the ui part is extracted
on those images you posted is you terminal smaller than 20 rows?
Base size:
Bigger:
This is another issue, it is related to the fact that when you right click, the terminal is too small to either open the menu on top or at the bottom of the position where you clicked, and such it crops it
maybe a smaller menu might be great
if you click on one of the upper icons or expand\unzoom the terminal even more this issue disapears, this is just a bad implementation i did, it is easilly improvable, the real issue is with the flickering though
Here's the bad implementation of the positioning of the menu :P https://github.com/GiorgosXou/TUIFIManager/blob/5b45e00ba4902318b75586a49e3dfeb1b3ce568d/TUIFIManager/TUIMenu.py#L54
Here you go, now it's better hehe
https://github.com/GiorgosXou/TUIFIManager/commit/73f0d4c00c5f298a40e9404e46f06d01219604e4
For some very wierd reason, the issue gets solved the momment I open a file to an external app (it doesn't matter if the external app is a TUI or not), I'm guessing this has to do with the
print(BEGIN_MOUSE)
in main\r vs \n vs \r\n etc.