[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

3393.0. "HELP - vi very confused!" by CIM::KAIRYS (Michael Kairys) Tue Sep 25 1990 16:01

    I recently switched my 14 meg. VS2000 from VMS to Ultrix/UWS 4.0
    and am running Mwm from the Motif 1.1 kit. I have a problem with
    vi getting confused; it appears to be losing track of what column it is
    in. Requests like "$" and "A" don't apepar to move to the end of the
    line (although ^L reveals that they really did), and moving through a
    line causes apparent garbage to appear as the wrong parts of the line
    are redrawn.

    I would appreciate any asistance, in terms of pointers to other
    information or suggestions of how I can get more information from
    my system.

    Thanks...

    (Also posted in DECWINDOWS)
    
T.RTitleUserPersonal
Name
DateLines
3393.1try rebooting?OXNARD::KLEEKen LeeTue Sep 25 1990 16:536
    I had a similar problem when I upgraded to the 4.1EFT.  We were having
    alot of network trouble at the time.  Later, when the network was
    quiter, I rebooted, the problem went away, and hasn't returned since.
    
    Ken
    
3393.2stty -tabsHOCKEY::HAYESI ain't no flatlander!!Tue Sep 25 1990 23:116
    I don't run motif, but I had this same problem with regular DECwindows.
    Try doing an 'stty -tabs' in your .login or .cshrc.  This seemed to keep
    vi from getting confused.

    Donald
3393.3HTS bug in csh command line editingDECWIN::MESSENGERBob MessengerWed Sep 26 1990 13:527
Are you using the command line editing feature of the V40 csh?  When you
type an uparrow or downarrow, it writes two HTS characters (backspaces with
the 8th bit set) to stdout.  These are eight bit control characters that
set horizontal tab stops.  To restore your default tab stops, cat a file
(or execute a shell script) that writes the escape sequence ESC c.

				-- Bob
3393.4Bingo, Bob!CIM::KAIRYSMichael KairysWed Sep 26 1990 16:0510
    Ah, the sweet voice of reason! Bob, that must be it.
    "stty -tabs" seems to make the problem disappear, too, as noted in a
    previous reply. Given your understanding of this stuff, would you say
    (1) this is indeed an alternative fix, and (2) this is an okay way to
    run in general (i.e. this won't confuse somebody else?
    
    Otherwise I guess I have to wrap vi in a shell script, as you suggest
    (unclean! (:-))
    
    Anyway, thank you so much for casting some light on this!
3393.5DECWIN::MESSENGERBob MessengerThu Sep 27 1990 11:5022
Assuming that I'm right that csh's command line editing is corrupting your
tab stops, you have several choices:

	1. Stop using csh's command line editing.

	2. After using csh command line editing, cat a file containing ESC c
	   to reset the tab stops.

	3. stty -tabs so the terminal driver will expand tabs into spaces

	4. Run in VT100 mode, so the HTS control characters will be
	   interpreted as backspaces (which might have been csh's intention).

	5. Enclose vi, and any other application that might be affected by
	   corrupted tab stops, in a shell script that writes ESC c before
	   starting the application.

Personally I'd choose option 1.  There is a shell I've seen called tcsh that
lets you do real DCL-style command line editing and doesn't corrupt your
tab stops.

				-- Bob
3393.6And the exact bug is...CIM::KAIRYSMichael KairysThu Sep 27 1990 15:5688
             <<< NAC::DISK$WORK295:[NOTES$LIBRARY]ULTRIX.NOTE;1 >>>
                   -< Volume 3, Take a RISC with ULTRIX... >-
================================================================================
Note 2562.6                 HELP - vi very confused!                      6 of 6
BACHUS::DEVOS "Manu Devos - TSSC/CS Brussels"        80 lines  27-SEP-1990 12:47
                       -< Use stty -tabs in your .login >-
--------------------------------------------------------------------------------
	Hi everybody,

	In ULTRIX(tm) V3.1D and V4.0, the "csh" accepts the use of the
	cursor keys to see and recall the previously used commands.
	There is a bug in the routine handling the detection of the first
	"cursor key" strike that causes the setting of  two extra tab
	positions which disturb certain utilities using the tabulations
	like vi, ls, paste etc.

	I will try to explain that:

	If your tty is setup with 'ctlecho' which means that any Control
	character is echoed by "^x", the cursor down key will be displayed
	^[[B (The screen must be normally setup for "Normal Cursor Key").

	These codes are received by the CSH which thinks : "As the CTLECHO
	mode is on, the screen goes to display these four characters (^[[B)
	and it will be nice if I can remove them from the screen because
	these codes now are used to re-display the last command."

	The CSH must send four BS code (0x08) follow by four spaces and
	one CR-LF to erase the echoed cursor down key and to position the
	cursor on the next line. After that, CSH will set the cursor and
	keypad in application mode, re-display the last command and send
	as many backspaces as needed to position the cursor on the first
	character of the command. Now, if you type RETURN (Not Enter), the
	displayed command will be executed and the cursor and keypad will 
        be restored in Normal and Numeric mode respectively.

	If I set a VT300 in "display controls" mode, that sequence should
	be displayed on the screen as:

	csh> ^[[BBBBB    CLE[?1hE=cd /etc E[KBBBBBBBB
                 SSSS    RFS    S         S  SSSSSSSS
                           C    C         C  
             ----    ----  -----  --------   --------
               | ----  | --  |  --   |    ---    |
               |   |   |  |  |   |   |     |     +--> 8 x BS 
               |   |   |  |  |   |   |     +--------> CSI K erase till end line
               |   |   |  |  |   |   +--------------> Display previous command.
               |   |   |  |  |   +------------------> Set Keypad in Application
               |   |   |  |  +----------------------> Set Cursor in Application
               |   |   |  +-------------------------> Carr. return + Line feed.
               |   |   +----------------------------> 4 spaces to erase ^[[B
               |   +--------------------------------> 4 BS to go backwards
               +------------------------------------> Codes of Cursor down.


	The bug now is that the coding of the four bakspace codes has been
	written "0x88 0x88" instead of "0x08 0x08 0x08 0x08" and the result
	is that 0x88 is the code HS (Set Horizontal tab in the Dec supple-
	mentary code) and curiously the 4 spaces have been reduced to two.
	This gives now :

	csh> ^[[BHH  CLE[?1hE=cd /etc E[KBBBBBBBB
                 SS  RFS    S         S  SSSSSSSS
                       C    C         C
                 ----
                   |
		   +---> Two Horizontal tab set codes + two spaces.

	You can easily prove this malfunction by connecting a VT220 to
	your system and set it to display the control codes, but you have
	to work not in vt100 mode as this mode strip the 8th bits and thus
	restore two backspace codes.

	Finally, to avoid all these problem, I decided to put the command
	"stty -tabs" in my .login file. This command causes that each tab
	is replaced by the corresponding number of spaces. It is also a
	good trick if you connect also your terminal frequently to a VMS
	account	which can also change the tab positions.

	Warning! if your .login contains a command 'tset', you must put
	the "stty -tabs" AFTER the 'tset -I' as the initialization of
	your terminal can restore 'tabs'.

	Sorry for the length of this note.

	Regards, Manu
	
    
3393.7Who decided that keypad mode application was "better?"IO::MCCARTNEYJames T. McCartney III - DTN 381-2244 ZK02-2/N24Thu Oct 04 1990 13:5420
	csh> ^[[BHH  CLE[?1hE=cd /etc E[KBBBBBBBB
                 SS  RFS    S         S  SSSSSSSS
                       C    C         C
                     ^^
                     || 
		     One might also ask why you're sending this to the 
		     screen since it screws up the command echo.

     Also, I notice that you unconditionally reset keypad and cursors 
     to be in application mode. Who asked? I certainly didn't -- I like 
     my keys to work the way I set them -- software should keep it's hands 
     off unless explicitly asked to change it!

     This total disregard of user settings (since there is no way to know
     the state and restore it) has the potential to cause some serious
     interoperability problems for layered products!

     James McCartney
     DECforms Development