[comp.os.vms] Line number in EVE

RAJAH@UREGINA1.BITNET.UUCP (06/09/87)

   EVE (or TPU) has a built in key word CURRENT_ROW that holds the
   the current line number - there is also a CURRENT_COLUMN for
   the column the cursor is currently on. This is the procedure I
   have implemented for our users:

   procedure show_current_position
   !  show current cursor position in buffer.
     update(current_window);   !  so that cursor info will be correct
     message( fao("Cursor is at Row: !UL Column: !UL",
              current_row, current_column));
   endprocedure

   A key on the keypad has been defined to execute this procedure.
   So all one has to do is press the key and (someone's VANILLA) VMS
   will display the current cursor position.

   Flame *ON*

       I resent people calling names when they really do not understand
       what a piece of software can/cannot do. There is NO software/OS
       in the whole world that can do and mean everything to everyone.
       Those of us who are familiar with VMS love it and those of you
       who do not understand it better keep your mouth shut. My concern
       is how can one be in VMS Systems Support Group when they claim
       thay do not know enough of VMS?? My heart cries for the poor
       employer who hires and pays such individuals.

   Flame off.

   A. Mahendra Rajah, System Manager, Computing Services,
   University of Regina, Regina, Sask. Canada.

carl@CITHEX.CALTECH.EDU (Carl J Lydick) (06/11/87)

 >  EVE (or TPU) has a built in key word CURRENT_ROW that holds the
 >  the current line number - there is also a CURRENT_COLUMN for
 >  the column the cursor is currently on. This is the procedure I
 >  have implemented for our users:

Wrong!  The CURRENT_ROW primitive returns the the current row of the WINDOW
from which it is called, not from the buffer.

 >  procedure show_current_position
 >  !  show current cursor position in buffer.
 >    update(current_window);   !  so that cursor info will be correct
 >    message( fao("Cursor is at Row: !UL Column: !UL",
 >             current_row, current_column));
 >  endprocedure

This shows where you are in your window; if you scroll the window after
using it, the values it gives are rendered worthless.

 >  A key on the keypad has been defined to execute this procedure.
 >  So all one has to do is press the key and (someone's VANILLA) VMS
 >  will display the current cursor position.

 >  Flame *ON*

 >      I resent people calling names when they really do not understand
 >      what a piece of software can/cannot do. There is NO software/OS
 >      in the whole world that can do and mean everything to everyone.
 >      Those of us who are familiar with VMS love it and those of you
 >      who do not understand it better keep your mouth shut. My concern
 >      is how can one be in VMS Systems Support Group when they claim
 >      thay do not know enough of VMS?? My heart cries for the poor
 >      employer who hires and pays such individuals.

And I resent people distributing untested "solutions" to problems, simply
because they haven't bothered to check to see that THEY understand what
the software can do.  If you REALLY want to find out what line of a buffer
you're on, try using:

PROCEDURE CURRENT_LINE_NUMBER
     LOCAL OLD_POSITION , LINE_NUMBER , TRIAL_VALUE , PLACE_MARKER ;
     ON_ERROR
	  LINE_NUMBER := LINE_NUMBER - TRIAL_VALUE ;
	  POSITION ( PLACE_MARKER ) 
     ENDON_ERROR ;
     OLD_POSITION := MARK ( NONE ) ;
     MOVE_HORIZONTAL ( - CURRENT_OFFSET ) ;
     LINE_NUMBER := 1;
     TRIAL_VALUE := ( 1 + GET_INFO ( CURRENT_BUFFER , "RECORD_COUNT" ) ) / 2 ;
     LOOP EXITIF MARK ( NONE ) = BEGINNING_OF ( CURRENT_BUFFER ) ;
	  PLACE_MARKER := MARK ( NONE ) ;
	  LINE_NUMBER := LINE_NUMBER + TRIAL_VALUE ;
	  MOVE_VERTICAL ( - TRIAL_VALUE ) ;
	  TRIAL_VALUE := ( 1 + TRIAL_VALUE ) / 2 ;
     ENDLOOP ;
     POSITION ( OLD_POSITION ) ;
     CURRENT_LINE_NUMBER := LINE_NUMBER ;
ENDPROCEDURE;

And in the future, make sure that YOU have the right answer before flaming
at someone who admits that he doesn't.

sommar@enea.UUCP (Erland Sommarskog) (06/24/87)

In a recent article carl@CITHEX.CALTECH.EDU (Carl J Lydick) writes:
>Wrong!  The CURRENT_ROW primitive returns the the current row of the WINDOW
>from which it is called, not from the buffer.

I don't have a TPU manual at hand, but I think that Current_row actually
returns the position on the screen. Anyway, it seems me to like Current_row
- and Current_column - send escape sequences to the terminal to ask where
the cursor is. I wrote an own "down-arrow" like:
   IF Current_row < Bottom THEN
      Cursor_vertical(1);
   ELSE
      Srcoll(Current_window, 1);
Keeping the down-arrow key pressed, could result with the cursor in the
message window. Changing Current_row to Get_info(Current_window, 
"current_row") cured the disease.

-- 
Erland Sommarskog       
ENEA Data, Stockholm    
sommar@enea.UUCP