Reader's Clinic - LCEdit and SCRIBE

Published ByDateVersionKnowledge LevelKeywords
Sprezzatura Ltd01 NOV 19923.0+EXPERTLCEDIT, SCRIBE

Charles Sherbow recently asked "When you edit a DOS table normally it is all on one line. Then you press Shift+F7 and the table is vertical in nature. When you leave the table and come back it is still in the state that you left it. How do you check to see if a table is in the "vertical" or "horizontal" mode? Where are the variables?"

Scattered throughout memory are a number of labelled common areas maintained by the system for things such as indexing and editing. One of these is called LCEDIT and takes five parameters as follows

     /LCEdit/ LastPopupRow, Unknown, EditCount, RowsEdited, ScribeState
LastPopupRowThe row of the editor softkeys popup last selected.
UnknownAs yet unknown.
EditCountHow many copies of the editor have been called currently (equal to the number of times EDIT occurs on the return stack. Note that this is not how many times EDIT appears on the program stack, it is loaded only once).
RowsEditedA field mark delimited array identifying the rows which have been edited, in the format Table*Row, E.G. VOC*LISTTABLES.
ScribeStateA Char(247) delimited array of information about each of the editing sessions identified in RowsEdited. Within each element, individual characteristics are delimited by @RMs. The array values are as shown in the following table (Using <> to indicate @RMs not @Fms)
<1>Apparently unused.
<2>A flag indicating whether the delimiter being used for editing is a field mark or record mark (0 or null), or Carriage Return/Line Feed (1).
<3>Row position of the line at the top of the current screen.
<4>Row position of the cursor.
<5>Column position of the character at the start of the current line.
<6>Column position of the cursor.
<7>A flag indicating whether the cursor is in destructive (0) or non-destructive mode (1).
<8>A flag indicating whether Insert (1) or Overwrite (0) is enabled.
<9>String last searched for with a Ctrl-F/Ctrl-R.
<10>Replacement string for Ctrl-R.
<11>Apparently unused.
<12>Row position at start of block.
<13>Row position at end of block.

Thus to answer Charles' query one could use a code segment such as :

  Common  /LCEdit/ LastPopupRow, Unknown, EditCount, RowsEdited, ScribeState
  Locate Table:"*":Row In RowsEdited Using @Fm Setting Pos Then
    RowInfo = Field(ScribeState, Char(247), Pos)
    RowIsDosFmt = Field(RowInfo, @Rm, 2)
    If RowIsDosFmt Then Call Msg("Yup") Else Call Msg("Nope")
  End Else
    Print Char(7) :
  End

(Volume 4, Issue 6, Pages 4,5)