4

When running Cygwin in the default cmd.exe window or similar terminal emulators such as Console I've noticed that after quitting programs that replace the entire screen (such as Vim and man), only the bash history on the current window height is shown. That is, once you scroll up past the current screen nothing is displayed. This also happens irrespective of whatever the screen buffer size is set to.

Is it possible to preserve more history, without switching to an emulator other than Console?

1
  • 1
    For the record, none of Cygwin's mintty, rxvt or xterm terminal emulators have this issue, and they also have many other advantages over the console, e.g. ^Z for suspending processes works, 256 rather than 16 colours are supported, and they're generally more standard-compliant thus causing fewer display issues. Also, Console is not a terminal emulator, but a frontend for the Windows console. It grabs the screen content from a background console window and paints it into its own window.
    – ak2
    May 3, 2011 at 5:12

3 Answers 3

3

You could try to work within a screen session. It gives you possibilities to scroll back and spawn several terminals in one console. Looks like it should work in Cygwin.

2
  • Yes there is a Cygwin implementation of screen, but unfortunately it doesn't solve my problem. When I try it out, exiting from VIm gives zero history! I think setting TERM=screen (as screen does) makes it even worse than when TERM=cygwin
    – Suan
    May 3, 2011 at 2:23
  • @Suan : I never used screen in cygwin, but usually to access the history in screen, you have to use ctrl+a escape, and then you can scroll with up and down . Does this work in cygwin?
    – Yab
    May 3, 2011 at 16:53
1

Judging from the responses here and the lack of response on the Cygwin Mailing List, I'm gonna assume that there's just no way to do this, at least in the "it should work like it does in other terminals" way (Unless someone proves me wrong). I took up ak2's suggestion and moved to using mintty. It's nice and I realized I don't need many Cygwin tabs at a time anyways, hence I don't need the tabbing functionality of Console.

1

What works for me, and I live at shell, is:

I use mrxvt with Xming server in Cygwin because it has (among many great features) a mouse scrollable buffer for which you can set to a specific amount of lines. You get a full-sized window screen with tabs and can configure: the amount of tabs on startup, the font size/type, fg/bg colors, and more in ~/.mrxvtrc config file. I have rxvt for an alternate because it does not need an X server (Xming).

I obtained mrxvt from sourceforge and compiled it using the commands {configure, make, make install}. I believe rxvt is available using the Cygwin installer/software updater.

Type configure (always check the results of configure to be sure everything is good), then type make, check to see if there are any compiler errors (warnings may be ok), if good then type make install to install mrxvt to /usr/local/bin.

It takes a little time to compile, but its so worth it.

Take a look at this mrxvt config file for an example: http://dotfiles.org/~sleepyEDB/.mrxvtrc

Get Xming (compiled) from here: http://www.straightrunning.com/XmingNotes/

I created a dos batch file which starts Xming and rxvt at the click of mouse, then I start mrxvt from rxvt. There are probably alternative startup methods, but this works for me because mrxvt and rxvt are not a child processes of the windows command shell.

The dos batch file contents: start C:\cygwin\bin\rxvt.exe -sb -sl 3000 -fg gray -bg black -fn "Courier New-14" -km noenc -e /bin/bash --login -i

You can use screen, but scrolling is only by key combinations, not mouse like mrxvt. The screen scroll mode: C-a [ Page up/down: C-f C-b Half page up/down: C-u C-d If you C-a d outside of scroll mode then (to reattach screen) type: screen -R

You will want to create entries in /etc/screenrc to set scrollback lines. And set an bash alias screen='screen -c /etc/screenrc'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .