GNU screen color and pine

alpine-mailcolorsgnu-screenncursesterminal

I use GNU screen to run pine mail reader. I use external aspell to do spellchecking for the e-mails I sent. The problem is that when aspell finishes, pine restores the old content of the terminal, but the color is all wrong. The font becomes white instead of black, which looks very bad on the the gray background. After typing something for a while, pine redraws parts of the screen, and that looks ok, but initially it looks very hard to read.

The problem does not exist when pine is run directly, not from within screen. I do not know how to begin the troubleshooting. Any ideas?

Pine version: Alpine 2.00 (LRH 1167 2008-08-23) 
GNU screen version: Screen version 4.00.03 (FAU) 23-Oct-06

Update 11 Dec 2011:
The problem also occurs in some cases when resuming composition with Ctrl+O (no aspell involed).

The following do not help:

  • Ctrl+L in pine to refesh screen,
  • adding "altscreen on" in ~/.screenrc
  • adding "bce on" or "bce off" in ~/.screenrc (I tried both, as I am not sure what the default is)
  • Starting screen with TERM=xterm-256color screen

Best Answer

I think I have resolved it. phunehehe was right about trying to change the terminal type. However, "TERM=xterm-256color screen" does not work because the TERM variable only tells screen what kind of terminal screen is run in. It does not tell screen to emulate that particular terminal. So, the solution was to include

term "screen-256color"

in ~/.screenrc configuration file. This seemed to solve the problem, but....

Update 12 December 2011: Actually doing the above fixed the color problem, but created another problem: Delete key no longer works in pine. It turned out that the computer on which screen is running lacks "screen-256color" terminfo file, and since it cannot find it, it reverts to the basic vt100 terminal. After trying several term settings, I found that "xterm-color" has neither Delete-key nor color problem. I do not understand why or how it works.

Related Question