Skip to main content
1-Visitor
December 12, 2013
Question

navigate to line number within Editor?

  • December 12, 2013
  • 3 replies
  • 1182 views
Is it possible to ask Editor to move the cursor to a specific line number
of the underlying file?

--
Paul Nagai

    3 replies

    18-Opal
    December 12, 2013
    Hi Paul--

    Not easily. You can do a fairly elaborate workaround by doing something along these lines in ACL:


    1) read the file from the source as plain text, line by line

    2) identify the target line

    3) working backward from there, check the markup and get a unique way to identify a nearby element and an offset to get to the target line

    4) in the working copy of the document, find the corresponding OID + offset and go to it

    That might be more work than you're willing to invest, but you'll have to decide that for yourself.

    --Clay
    naglists1-VisitorAuthor
    1-Visitor
    December 13, 2013
    Thanks, Clay. Not worth it (or I'm not properly bored at the moment). Was
    hoping there was some simple command / function I
    didin't know about / couldn't search out.


    1-Visitor
    December 14, 2013

    Hi Paul,


    Clay's option would work "if" you didn't save the file while you were working on it. The problem is that the Editor really doesn't care about line numbers. It pulls in the file and formats it on screen based on your stylesheet which throws your source position of any content out the window. Then when you save the file, the Editor simply lays down the file in defaultline lengths of 72 or less depending on word/tag breaking. Consequently, you could open the file, do nothing and save it right back and you could very well have a whole different set of line numbers for the file.


    There is one thing you could do... Set the record length to "infinity" and no line in the file will be broken meaning tags will all be slammed to the left. Then you'd save the file. The lines would now be fairly consistent from edit to edit since the only variable would be that you add or delete content. Then with a routine that would read the lines like Clay mentioned.... Forget it! That's too much work just writing how to do it.


    Point is, in an SGML Editor, lines in the source file are irrellavent. Everything is based on tags.


    Hope this helps,


    Bob