TIP: Click on subject to list as thread! ANSI
echo: qedit
to: ALL
from: JORJ STRUMOLO
date: 1997-11-05 10:17:00
subject: Address Offset

From: Jorj Strumolo 
    fred.holmes@mix.cpcug.org (Fred Holmes) writes:
FH> When editing a file in hex/binary mode:    E -b -h 
  >
  > can one display the address/offset, either in the "wasted"
  > columns in the main editing area, or as a single value (for the
  > cursor location) on the status line?  Has anyone worked this out?
/*****************************************************************/
/** mShowOffset() ********** 1994-95 by David Daniel Anderson   **/
/*****************************************************************/
proc mShowOffset()
 string FilePos[8]=''
 integer LineLen=BinaryMode()
 if LineLen
 and (DisplayMode()==_display_hex_)
 and Query(ShowStatusLine) and Query(StatusLineUpdating)
 LineLen=LineLen*(CurrLine()-1)+(CurrPos()-1)
 FilePos=Format(Str(LineLen,16):8:'0')
 VGotoXY(1,Query(StatusLineRow))
 Set(Attr,Query(StatusLineAttr))
 PutStr('Offset '+FilePos[1:4]+':'+FilePos[5:8]+' ') endif
end
 The above in TSE.UI near the start somewhere, and this line
    Hook(_after_update_statusline_,mShowOffSet)
 at WhenLoaded() with the other hooks.  Produces a status line like:
Offset 0000:0170   AW    150k     d:\sr$reply\chowda\refer.sr
 If you comment out the line that says "and (DisplayMode()==_display_hex_)"
 it works both in bin+hex mode and in plain binary mode.  I use that alot,
 and use ShowChar() on the status line to show what the hex part of the
 screen would, so I can use longer lines.  64-character ones work well
 logically with the Offset display.
FH> It would be nice to have a display that is similar to
  > that which LIST.COM provides in the "hex" viewing mode.
 That's much more complex, and I've never seen such a macro.
 BTW, this
     if not Hook(_after_update_statusline_,mShowOffSet)
            UnHook(mShowOffSet) UpdateDisplay(_statusline_refresh_) endif
 toggles the status line bewteen the two appearances:
 Offset 0000:0170   AW ...
 L 49      C 2      AW ...
-- 
 Jorj.Strumolo@chowda.com * Fido 1:323/140 * jorj@wsii.com
                          
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.