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

Fix major bug (black screen after VT switch) that became prominent in newer Linux kernels #62

Open
wants to merge 18 commits into
base: master
Choose a base branch
from

Conversation

hackerb9
Copy link

@hackerb9 hackerb9 commented Feb 5, 2024

The fix was to use the ioctl for FB_ACTIVATE within the refresh() function. Closes #40. Closes #45. I have not tested this on BSD but I do not believe it will cause any issue.

This pull request also includes the small patch I had submitted years ago to fix the problem with yaft getting hung up on DCS strings. Now clear and Ctrl+L work as described in #45.

I also made some cleanup to glyph_builder.sh so that it works correctly. The 10x20 neep font is included by default. Bsdtar is no longer required.

The terminfo file is now compiled into /etc/terminfo/ instead of /usr/share/terminfo/. GNU/Linux does not seem to check /usr/share/terminfo. (It is possible the terminfo installation directory will depend on the OS and perhaps it would be best to just put a copy in ~/.terminfo/).

Previously, if someone entered sixel mode and accidentally didn't exit
it, the screen would just appear to be frozen. Nothing could be done
other than switch to another terminal to kill yaft.

Xterm doesn't have this problem because it turns off sixel mode when
the screen clears (user hits ^L) and during a reset. This is easily
accomplished by changing the terminfo for yaft to send '\E\\' (end
sixel mode).
Short: Set smcup and rmcup to something harmless so that curses
doesn't think they're accidentally missing and try to fake an
alternate screen.

Long: Alternate screen switching is for terminals that need to be in a
special mode before they can use cursor motions, like the Tektronix
4025. On modern terminals, it just appears to reset the screen when a
program is entered or exited. This can be annoying: ever looked
something up with 'w3m' or 'man' and then wanted to type it into the
terminal? If your terminal has "alternate screen switching" enabled
the text will be cleared when exiting the program and you cannot read
it.

When using X or Wayland, a person can work around this annoyance by
having multiple terminals open at once, one to read, one to type in.
But with yaft, we can't do that.

Yaft is correct in not defining smcup or rmcup. Theoretically it
shouldn't suffer from alternate screen switching problems.
Unfortunately, the ncurses library appearsto fake smcup and rmcup
calls if they are not defined for the terminal!

So, as a workaround, this patch defines smcup and rmcup to be '\r'
(ASCII carriage return). This is a harmless character to send as it
simply puts the cursor at the beginning of the line.

By the way, I refer to this as "titeInhibit", because that is what Xterm
calls the feature to disable "alternate screen switching". The termcap
codes for initializing and exiting it are "ti" and "te".
Added support for the included neep font which has rather good Unicode
coverage (although not of CJK). I only added the 10x20 font as that's
the best version.

Also, fixed the included terminus font (ter-u16n) which didn't have a
proper glyph_builder function before.
Previously, the makefile was using those standard variables in an
idiosyncratic way. Normally, one should be able to do something like
this:

    make prefix=/opt/uobikiemukot install

Such things didn't work with this makefile.

According the GNU Make documentation, a makefile should never set
DESTDIR. Only the person doing the install should set it.

The prefix variable should be lowercase and default to $(DESTDIR)/usr/local.

The mandir variable is also lowercase and should not be rooted from
DESTDIR. The Make documentation says it should be based on
datarootdir, but that's just $(prefix)/share, so I cut out the
middleman. (I've never seen anyone set datarootdir by hand, but people
set prefix often.)
Previously it had suggested that people edit the makefile to run
mkfont_bdf, but that may be less convenient.
Without this, yaft's screen isn't shown at all. See issue uobikiemukot#40.
since /usr/local/share/terminfo is not actually searched by default.
Use either BSD or GNU tar for .tar.gz files.
Use unzip or bsdtar for the profont.zip file.
Also, clean up the /tmp/glyph_builder directory.
(Currently done at start instead of end for debugging).
Previously switching away and then back to the virtual terminal that
yaft was running on would just show a black screen. Commands could be
run and the screen would show up once `exit` was typed.

Now the framebuffer is re-activated in the refresh() call.
We are handling it in refresh() now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant