mabe02 / lanterna

Java library for creating text-based GUIs
GNU Lesser General Public License v3.0
2.27k stars 242 forks source link

window's left border may covered by double-width character behind the window #450

Closed bleehome closed 4 years ago

bleehome commented 4 years ago

image

avl42 commented 4 years ago

Hmm, I guess, the lower window (the one with numbered lines) updates its contents, while the other one already sits on top of it.

As of now, the Window on top has no reason to redraw itself, so also won't redraw its frame.

As a workaround until fix (can't make promises for "when"), you can try to also force a refresh on the window on top, whenever the bottom window's content changes...

mabe02 commented 4 years ago

This is indeed an interesting problem, I never thought of this... Are you using the TextGUI layer (BasicWindow, etc) for this?

mabe02 commented 4 years ago

Also, does the same thing happen in both a "real" terminal and SwingTerminal? The UI framework uses painter's algorithm so this kind of thing shouldn't happen...

bleehome commented 4 years ago

This is indeed an interesting problem, I never thought of this... Are you using the TextGUI layer (BasicWindow, etc) for this?

Yes,I use MultiWindowTextGUI and BasicWindow, and a ANSITerminal (base on Apache Mina) to provide a sshd service.

I never test SwingTerminal.

bleehome commented 4 years ago

I think terminal client ignore rendering any single width char on chars[x+1] if there is a double width char on chars[x]. Some opensource tty client use a char array as a buffer of current screen, if buf[x] is a double width,the buf[x+1] just \0.

bleehome commented 4 years ago

If chars[x] is a double-width char,and chars[x+1] is the left border of a window, the chars[x] should be set to '\0' ?

mabe02 commented 4 years ago

Ok, I can reproduce this now

mabe02 commented 4 years ago

Please try the latest snapshot and see if it fixes the issues. I'm pretty sure there are more bugs with the CJK handling but at least this should fix shadows and overlapping borders.

Also, my fix touches a little bit of code that was involved in issue #431 - can you retest this just to make sure it's still working?

bleehome commented 4 years ago

Please try the latest snapshot and see if it fixes the issues. I'm pretty sure there are more bugs with the CJK handling but at least this should fix shadows and overlapping borders.

Also, my fix touches a little bit of code that was involved in issue #431 - can you retest this just to make sure it's still working?

It's work. and #431 is still working but there is a NullPointerException image

mabe02 commented 4 years ago

Yep, I ran into that too when I tested today. It's fixed now. Will make a new release shortly.