GotoLine() info

10 views
Skip to first unread message

Carlo Hogeveen

unread,
Jun 3, 2025, 5:59:29 AM6/3/25
to Semware @ GoogleGroups

I just discovered that TSE's GotoLine() statement does not work as documented.
"Repairing" it seems inadvisable; there is too much software out there that has been tested with its current implementation.
I added the following to my documentation of GotoLine():

"
GotoLine() is incorrectly documented in Semware's built-in documentation.
What actually happens in non-interactive use:
- A value below 1 makes GotoLine() go to the first line.
- A value above NumLines() makes GotoLine() go to the last line.
- Any other value makes GotoLine() go to the indicated line.
- GotoLine() returns TRUE if it changes the cursor's line, FALSE otherwise.
A big bummer is, that GotoLine()'s return value does not tell us whether the
cursor went to the specified line.

Instead I came up with this useful implementation,
that does not move the cursor if the specificied line does not exist,
and that returns whether the cursor ends up on the specified line:
integer proc goto_line(integer line)
integer result = FALSE
PushLocation()
GotoLine(line)
if CurrLine() == line
result = TRUE
KillLocation()
else
PopLocation()
endif
return(result)
end goto_line
"

Carlo



S.E. Mitchell

unread,
Jun 3, 2025, 6:33:17 AM6/3/25
to sem...@googlegroups.com
Yes, that is a shame.
Note that I checked shipping as well as my personal macros - about 1200 macros.
Only five instances of taking the gotoline() return value.
potpourri, dialog, history and vimode.
I could not see it would break any of these, to change the usage to
only return true if the requested line number ends up being the new
current line.

But for now at least, I won't change it.
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/semware/000001dbd46e%242fc71970%248f554c50%24%40ecarlo.nl.

Carlo Hogeveen

unread,
Jun 3, 2025, 6:59:11 AM6/3/25
to sem...@googlegroups.com

FYI,
It might not just be the return value that is "wrong".
When searching for "gotoline(.*currline().*)" with "agivx", I see some iffy cases.
For example, the template macro expects GotoLine() to be able to go to a line past NumLines(), but that is impossible.

Carlo



Knud van Eeden

unread,
Jun 3, 2025, 7:24:15 AM6/3/25
to sem...@googlegroups.com
Conclusion: 

1. There are far too many occurrences of e.g. 

grep -i0sx "gotoline(.*currline().*)" *.*

2. So starting to change the native behavior of native TSE commands like GotoLine() is far to riskful
in my opinion as it will break things backwards with a very high probability.

3. A possible better alternative, e.g. if one really has to, is then to create a new TSE GotoLine() command with a different name, e.g.
GotoLineAndCheck() or something.

4. Or otherwise to use that TSE programmatical workaround as shown in the first message in this thread.

5. FYIO: Here a list of running that grep command here:

f:\wordproc\tse32_v45024 Tue 03-06-25 13:13:38> grep -i0sx "gotoline(.*currline().*)" *.*

SemWare Grep v2.07 for Win32 [Sep 13 2023]
Copyright 1996-2023 SemWare Corp. All rights reserved worldwide.

File: F:\WORDPROC\tse32_v45024\mac\cmpfiles.s
File: F:\WORDPROC\tse32_v45024\mac\synchscr.s
File: F:\WORDPROC\tse32_v45024\mac\template.s
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\MACDOWNLO_STEIN\DDD\DDD\MESSAGES.DAT
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEEXISTING\HTML_E.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEEXISTING\idiff.s
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLMICHAELGRAHAM\S\TEMPLATE.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\121FORTM\BLINES.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\121FORTM\LJLABELS.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\150HTML100E\HTML_E.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\200MOVE_1\MOVEMENT.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\235Q2TSE\Q2TSE.DAT
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\236QF060302\qfdbf.s
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\236QF060302\qfpoplst.inc
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\27BROWSE22\BROWSE.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\328TSGREP65\TSGREP.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\346VIMODE\VIMODE.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\49CJCONFIG\CJCONFIG.NTS
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\56CMDLINE3\CMDEXAM.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\57CMPFILE2\CmpFiles2\CMPFILE2.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\BLINES.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\BROWSE.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\CMDEXAM.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\CMPFILE2.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\HTML_E.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\LJLABELS.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\MOVEMENT.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\qfdbf.s
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\TSGREP.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLSEMWAREONLINE\S\VIMODE.S
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLZHONGZHAO\S\cmpfiles (1).s
File: F:\WORDPROC\tse32_v45024\MACDOWNLO\TSEMACROALLZHONGZHAO\S\frame.s
File: \BROWSE22\BROWSE.S
File: \checliha.s
File: \CJCONFIG\CJCONFIG.NTS
File: \CMDLINE3\CMDEXAM.S
File: \CMPFILE2\CmpFiles2\CMPFILE2.S
File: \cmpfileszhongzhao.s
File: \cmpfileszhongzhaoORIGINAL.s
File: \copyteot.s
File: \FORTM\BLINES.S
File: \FORTM\LJLABELS.S
File: \getblboo.s
File: \HTML100E\HTML_E.S
File: \html_f.s
File: \idiff.s
File: \MAGUI138\magmac\TEMPLATE.S
File: \MOVE_1\MOVEMENT.S
File: \Q2TSE\Q2TSE.DAT
File: \QF060302\qfdbf.s
File: \QF060302\qfpoplst.inc
File: \sortbltb.s
File: \template.s
File: \template2008may04.s
File: \template2008may10deletedoesnotwork.s
File: \templateOLD.s
File: \templateold1.s
File: \templatequerycmdlinetable.s
File: \templateUPDATEKNUD.s
File: \template_backquote.s
File: \template_bak01.s
File: \template_new.s
File: \template_original.s
fopen failed on \tse
File: \TSGREP65\TSGREP.S
fopen failed on \Unibrowse - The a and ? of Tools - Copy.txt
File: \VIMODE\VIMODE.S
File: \vimode.s

--

---
You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.

J. David Boyd

unread,
Jun 3, 2025, 7:26:15 AM6/3/25
to sem...@googlegroups.com
"vimode"?   Why?   🙂



--
What's so funny about peace, love, and understanding? 

Knud van Eeden

unread,
Jun 3, 2025, 7:30:57 AM6/3/25
to sem...@googlegroups.com
> "vimode"?   Why?  

I noticed it also, but I just saw in my list I just sent it should be part of the usual Semware TSE Pro macros available online.

with friendly greetings
Knud van Eeden

Knud van Eeden

unread,
Jun 3, 2025, 7:36:42 AM6/3/25
to sem...@googlegroups.com
See 'vimode.zip' at https://semware.com/html/tseprofiles.php

vimode.zip83721995-02-22A TSE emulation of the unix vi command mode. Based on an earlier version posted by Charlie Harris. vi has some interesting movement and text replacement commands that might be of interest to someone who has no interest in using the vi interface itself. Version by Arnold Hennig.
Uploaded by: Arnold Hennig

J. David Boyd

unread,
Jun 3, 2025, 8:29:57 AM6/3/25
to sem...@googlegroups.com
Very interesting.   And funny.   I keep a few muscle memory overlays in my brain  - TSE original, Vi, Emacs, VS Code.  Can't imagine the confusion it would cause to my fingers to turn VI mode on in TSE.



Knud van Eeden

unread,
Jun 3, 2025, 10:38:49 AM6/3/25
to sem...@googlegroups.com
The easiest would thus be to just adapting the current TSE documentation of GotoLine()
and then optionally also providing that TSE workaround macro supplied here
in the help text.

Reply all
Reply to author
Forward
0 new messages