mordak / Term48

50 stars 20 forks source link

TERM setting not good with mutt #4

Closed singpolyma closed 8 years ago

singpolyma commented 8 years ago

I ssh to my mailserver and run mutt. With default TERM=qansi there are serious visual errors when moving about the index screen. Changing to TERM=vt100 makes it work but of course removes colour support.

mordak commented 8 years ago

Yes, this is a (unfortunate) known thing. In the cases I have investigated, this is due to differences in the qansi definition on the BlackBerry device and on the server that you ssh into. In some cases the definitions are very different, and things break pretty badly. Had I known at the beginning that qansi was not well standardized across distributions I would have perhaps selected another terminal definition to implement. The fix is to either switch Term48 from qansi to something more standardized like xterm, or launch Term48 into a terminal multiplexer like tmux or screen, which will present a TERM=screen interface to the rest of the world, while using the local TERM=qansi definition to draw to the screen on the device. Launching into a terminal multiplexer would also have other benefits, such as multiple windows, scrollback, and copy, but also comes with it's own challenges. Either way, it is on my list of things to fix.

Thanks for reporting! Please feel free to report any other issues, either here or via email - it's helps me prioritize things to work on.

singpolyma commented 8 years ago

Could you provide a terminfo file I can install on my servers?

mordak commented 8 years ago

If you want to have qansi definitions that match what is on the BlackBerry, they are stored at /usr/lib/terminfo/q and the termcap is at /etc/termcap. The terminfo is compiled, so I am not sure if there would be problematic binary differences if you just copied it over to another system. The termcap is just text though, so you should be able to copy that over without too much issue, provided you can coerce your server side curses library to use it.

mordak commented 8 years ago

I just uploaded a new version to BB World. It is in draft while it goes through some testing, but if you're interested in having a look and verifying it fixes your mutt issue, then I have added you as a tester (using the same email you used to email me the other day). It may take a day or so to propagate, but you should be able to retrieve it from BB World like so:

  1. Open the BlackBerry World App
  2. Swipe down from the top and choose Settings
  3. Choose Development Mode
  4. In the Content ID box, enter ‘term48’ (case sensitive, no quotes)
  5. You should be brought to the app page, showing the new version 0.4.

This version also bundles the ssh, scp, sftp and ssh-keygen commands.

I am still working a couple of minor visual issues in some curses apps, but Term48 now declares/implements TERM=xterm-color (and ships a private terminfo database to get the definition), which should fix the compat issue you reported with mutt. The xterm emulation is incomplete, but it's passing the first and second suites in vttest (and some others), which is the base functionality that's really needed.

If you can't get it from BB World, then I can email you the .bar to sideload.

singpolyma commented 8 years ago

I getting a download error from bbworld. Will try again later

mordak commented 8 years ago

Ack, me too. Will check it again later in BB World. I had a lot of problems getting this version uploaded, so there may be some funkiness on their backend.

singpolyma commented 8 years ago

Got it installed finally. the bundle ssh works, thanks! But if I try to run mutt the whole term48 app crashes

mordak commented 8 years ago

Hmm. That's not good, and I haven't had any crashes with mutt during my testing. Can you tell me which version of mutt and on what platform? I will try to reproduce over the weekend. Thanks!

singpolyma commented 8 years ago

Mutt 1.5.20 (2009-06-14)

Linux iweb 2.6.32-5-amd64 #1 SMP Mon Feb 25 00:26:11 UTC 2013 x86_64 GNU/Linux

Debian GNU/Linux 8 \n \l

singpolyma commented 8 years ago

works if I run mutt under screen

singpolyma commented 8 years ago

Though running screen makes my font reaaaaaly tiny...

mordak commented 8 years ago

Okay, this helps a lot. There is some difference between the terminfo definitions that I am not handling correctly. Is your screen setting 80 or 132 column mode? I put this in as part of xterm, but perhaps it should be disabled... If you hit metamode-s then it will reset the font size, though it can still be changed if a program wants it.

singpolyma commented 8 years ago

echo $COLUMNS says 45 when I open the app. When I run screen and it shrinks things down, mutt will run under screen, but if I exit screen (and the font stays small) and I run mutt it crashes still.

mordak commented 8 years ago
                                                                                  ‎Yeah, there is clearly something unexpected going on when mutt thinks it is talking to xterm-color. I will try to reproduce. Are you running any mutt plugins or anything?  
singpolyma commented 8 years ago

I don't think so. my server's muttrc isn't even very crazy

mordak commented 8 years ago
                                                                                  Neither is mine, but I understand I am missing out. :-) Thanks again for the detailed info - I will try to get it sorted over the weekend.
singpolyma commented 8 years ago

I tried setting TERM=vt100 and that still works

mordak commented 8 years ago

Okay, I have a Debian 8.0.0 install going here. I can confirm that screen is explicitly setting columns=80, which is why the font gets so small (to fit 80 columns across). You can reset the font size with Metamode-s. I can set a preference to let the user enable / disable this behaviour.

I cannot reproduce getting Term48 to exit with mutt, but I also cannot replicate your exact setup. My fresh debian 8.0.0 install comes with a newer kernel and mutt 1.5.23. Will keep working it.

singpolyma commented 8 years ago

If you send me an ssh public key I could give you an account on my actual box

mordak commented 8 years ago

Oh, this made things a million times faster to fix. I think this should do it:

https://github.com/mordak/Term48/commit/d0f8a90de2e66387ac3c9083327287064bc066d4

Thanks again! I'll push a new build shortly. :-)

mordak commented 8 years ago

Build 0.4.0.3 is showing in BlackBerry World for me now. Can you confirm the fix?

singpolyma commented 8 years ago

Working! Thanks!