LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 02-25-2010, 04:36 PM   #1
alumni
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Rep: Reputation: 0
terminal window view after quitting an editor


Hi all,

I am using CentOS release 4.7 and tcsh shell.

Here is a description for the issue:
1-I telnet to my linux machine
2-list some directories
3-then I open an editor from the command line (e.g. vim or emacs)
4-And then quit the editor after I am done
5-Once I quit, I am back to the shell prompt (command line)


My question is regarding what the terminal window shows after quitting the editor. It can either:
1-show you the same contents it was showing before launching the editor (the directory listings I've done before launching the editor)
2-Or it shows you the prompt (command line) at the bottom and above it is a view of the file that was being edited.

I am seeing the second behavior but I want to have the first behavior. I've been searching for several hours for a hint with no luck.

Thank you
 
Old 02-26-2010, 09:26 AM   #2
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
I think that depends on what terminal application you are using. Most GUI terminal emulators seem to detect an ncurses app (like most editors) and switch to a special mode. But the second behavior happens for me when in command-line mode (no GUI).

I am not sure if that can be "fixed", but you were saying that you wanted to see a dir listing above. Can you just use the up arrow key to find the command that created the listing an run it again?
 
Old 02-26-2010, 11:42 AM   #3
alumni
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by MTK358 View Post
I think that depends on what terminal application you are using. Most GUI terminal emulators seem to detect an ncurses app (like most editors) and switch to a special mode. But the second behavior happens for me when in command-line mode (no GUI).

I am not sure if that can be "fixed", but you were saying that you wanted to see a dir listing above. Can you just use the up arrow key to find the command that created the listing an run it again?
Thank you for the response.

I tried both terminals:
1-Putty.
2-Linux terminal launched from Linux GUI.

I sure can use the up arrow to repeat the last command in history.

The reason why I am asking how to have the first behavior is that I've had it in the past on a different machine but do not know what is the difference that is causing such different behaviors.
 
Old 02-26-2010, 12:27 PM   #4
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
Is it always behavior #1 on Linux terminal and always #2 on Putty? Or is it the other way round?
 
Old 02-26-2010, 06:43 PM   #5
alumni
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by MTK358 View Post
Is it always behavior #1 on Linux terminal and always #2 on Putty? Or is it the other way round?
In fact it is always behavior #2 with both: Linux terminal from within Linux GUI or putty (telnet to the Linux machine).

Also, it the behavior is identical with emacs and vim (command line based editors).

Can you please help me rule out one of the potential reasons for behavior 2:
A-Is it a shell issue?
B-Is it an editor issue?

Thank you,
 
Old 02-26-2010, 07:09 PM   #6
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
It's neither of those two.

It's a terminal emulator issue. Actually it isn't an issue, because that's the way it's supposed to work.

As I understand, many terminal emulators detect if an app uses ncurses (Google if you don't know what it is), and if so, enters a special mode, and then returns to the original mode when the program exits. I'm not sure how it works if if that's really the way it works, though.
 
Old 03-04-2010, 08:47 PM   #7
alumni
LQ Newbie
 
Registered: Feb 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by MTK358 View Post
It's neither of those two.

It's a terminal emulator issue. Actually it isn't an issue, because that's the way it's supposed to work.

As I understand, many terminal emulators detect if an app uses ncurses (Google if you don't know what it is), and if so, enters a special mode, and then returns to the original mode when the program exits. I'm not sure how it works if if that's really the way it works, though.

Hi,

I figured out why the two behaviors are different and how to switch in between them.

The behavior depends on the terminal emulation used on the Linux box (xterm, screen, ansi, etc).

The first behavior shows when using xterm terminal emulation on Linux. This means that TERM environment variable is set to "xterm".

The second behavior shows when using ansi terminal emulation on Linux. This means that TERM environment variable is set to "ansi".

To switch from the second behavior to the first:
1- Edit your .cshrc (assuming the use of csh)
2- Add the following line at the bottom:
setenv TERM "xterm"
3- source .cshrc
4- Give it a try

Thank you for your responses.
Cheers
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loosing jobs list after quitting terminal alpha_lt Linux - Newbie 4 01-30-2010 11:53 AM
Starting new terminal window or tab from existing window remaining as root? homerun Linux - Newbie 1 08-14-2009 11:34 AM
Ubuntu 8.04 Terminal - Can you make the terminal window transparent with a wallpaper? bparkerson04 Linux - Newbie 6 02-17-2009 05:12 PM
is it possible to docking the OpenOffice navigator window with the editor window? ashrafulkarim Linux - Software 1 02-04-2009 03:18 AM
Difference between a Shell terminal window and the KDE Linux Console terminal window? bostonantifan Fedora 2 03-25-2007 07:23 PM


All times are GMT -5. The time now is 04:12 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration