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

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

507.0. "Cursor position" by AYOV18::STRACHAN (Quasi MODEM) Thu Jun 25 1987 06:00

    
    Hello,
          can anybody tell me if there is a command (lexical?) that
          can tell me the position of the cursor at any time.
    
                                          Thanks    /IGS
T.RTitleUserPersonal
Name
DateLines
507.1perhaps you can do it differently (cursor position)VIDEO::OSMANtype video::user$7:[osman]eric.sixThu Jun 25 1987 18:4210
There isn't a lexical.  However, this sounds like one of those "what are
you really trying to do" situations.

That is, perhaps there's a way to do just what you really want to do *without*
reading the cursor position.

By the way, if you merely want to know the position so you can restore it
later, you can use escape sequences to save and then restore the position.

/Eric
507.2DCL sample to interrogate cursor position.CASEE::VANDENHEUVELFormerly known as BISTRO::HEINMon Jun 29 1987 07:179
$ESC[0,8]=27				!Handy
$SET TERM/NOESC/NOLINE/NOECHO		!Set up terminal
$WRITE SYS$OUTPUT ESC+"[6n"+ESC+"[6n"	!Ask for corsur report twice
$READ/PROMPT="" SYS$OUTPUT X		!Empty_line_terminated_by_escape
$SET TERM/ESC				!Entire escape sequence = terminator
$READ/PROMPT="" SYS$OUTPUT X		!The_cursor_position_report
$SET TERM/NOESC/LINE/ECHO		!Reset terminal
$WRITE SYS$OUTPUT X			!The_cursor_position_report
507.3RE -1KLOV01::FLANAGANfrom darkest clonmel... Wed Jul 15 1987 09:3514
    
    Your routine always returns the location as [XX+1;1 
     ie always with a line offset of one (no problem ) and
     the column index as one (a problem !)
    
    I'am hacking up a little routine which involves a hib process
    and I want to save the cursor pos ,write to the screen without a
    return, and restore the cursor position. ( not really a hack I know
    but...)
    
    
         So any help etc.
    
          Neil f 
507.4UFP::MURPHYEuropean or African Swallow?Wed Jul 15 1987 11:5814
    The problem is that the WRITE SYS$OUTPUT that sends the request
    sequence is followed by a RETURN. If you merge the WRITE and first
    READ into a single READ/PROMPT, this won't happen.
    Following is a modified copy of .2:
$ESC[0,8]=27				!Handy
$SET TERM/NOESC/NOLINE/NOECHO		!Set up terminal
$! Request the report twice. The leading ESCape of the first report
$! will terminate this read.
$READ/PROMPT="''ESC'[6n''ESC'[6n" SYS$COMMAND X
$SET TERM/ESC				!Entire escape sequence = terminator
$READ/PROMPT="" SYS$OUTPUT X		!The_cursor_position_report
$SET TERM/NOESC/LINE/ECHO		!Reset terminal
$WRITE SYS$OUTPUT X			!The_cursor_position_report

507.5<<>>KLOV01::FLANAGANfrom darkest clonmel... Mon Jul 20 1987 07:539
    
    Good idea about read/prompt, but how about writing to the screen
    to reposition the cursor without doing a return after storing 
    cursor position and writing to the screen from a hiber process ?
    
    Someone here said to look at QIO and specify a longword mask to
    kill CR/LF. Any ideas anyone ?
    
             NPf
507.6READ/PROMPT will do itTONTO::SCHRADERMon Jul 20 1987 11:429
    RE: .-1

    The following seems to work ...

        $ READ/PROMPT="Escape sequence"/TIME_OUT=0/ERROR=ERRL SYS$COMMAND DUMMY
        $ERRL:

    TIME_OUT=0 forces immediate termination of the read.
    ERROR=ERRL gets rid of a timeout status message.
507.7Yes,but...KLOV01::FLANAGANfrom darkest clonmel... Mon Jul 20 1987 16:4516
    
    
    OK, used -1 so now can save cursor pos,write to the screen
    and relocate cursor where it was ,but it still doesn't fix 
    the prob of the unwanted return at the end of the program.
    I can't seem to write a program in DCL,Basic or Pascal which
    doesn't force a return at the end of the code...
    
    Now there must(?) be a simple way to do this in DCL ,but how ?
    
        Any Ideas ?   
        
       NPf         
    
     
     
507.8BEING::POSTPISCHILAlways mount a scratch monkey.Mon Jul 20 1987 20:2517
    Re .7:
    
    The following is a QIOW call that does not emit characters other than
    those in the string you give it.  It is written in C; see the VMS
    system services manual, the I/O drivers manual, and the manual for the
    language you wish to use for other invocations.  The IO$M_NOFORMAT is
    the key to preventing anything other than your string from being
    written.  The vertical bar, |, is a logical OR.  If this does not work
    for you, then I would suspect VMS is printing a carriage-return/
    line-feed after the program completes.  I do not know if there is
    anything you can do about that. 

         SYS$QIOW(0, channel, IO$_WRITEVBLK|IO$M_NOFORMAT, iosb, 0, 0,
         string, length, 0, 0, 0, 0)); 
         
    
    				-- edp
507.9Possibly worth a try?SNOMAS::LASTOVICAStuck in a Lather-Rinse-Repeat loopMon Jul 20 1987 23:357
    Some terminals (like VT52's and VT100's) can be tricked into swallowing
    characters by seeing a bogus escape sequence.  Send the beginning
    part of an escape sequence and then let the program exit.  Sometimes
    the CR/LF will get sent but the terminal will think they are part
    of an (illegal) escape sequence.  I think that the ANSI sequences
    can all handle cr/lf in the sequences though.  Look in the VT200
    owners manual and see if this 'll work.