Re-marking block after ReplaceFile()

25 views
Skip to first unread message

Tom Collins

unread,
Mar 2, 2026, 4:11:50 PM (10 days ago) Mar 2
to SemWare TSE Pro Text Editor
The chkchg,s macro is very useful to me, allowing TSE to reload changed files from disk.  I use this often to reload log files after a compile.  But I've found that if a file has a block marked, and chkchg reloads a file, TSE will unmark any blocks in _any_ files.  Looking further, this seems to be the "fault" of the ReplaceFile() call. 

Is this the expected result, and if so is there a macro way to save the block and restore it after ReplaceFile()?  A quick wrapping of ReplaceFile() with PushBlock() and PopBlock() didn't seem to get the job done.

Thanks.

knud van eeden

unread,
Mar 2, 2026, 4:40:05 PM (10 days ago) Mar 2
to SemWare TSE Pro Text Editor
You have very probably not set the PushBlock() and PopBlock() at all exits (it has 2 separate exits)

integer proc replace_file(string fn)
    integer line, row, column, xoffset

    line    = CurrLine()
    row     = CurrRow()
    column  = CurrCol()
    xoffset = CurrXOffset()
    PushBlock()
    if ReplaceFile(fn)
        GotoLine(line)
        GotoRow(row)
        GotoColumn(column)
        GotoXOffset(xoffset)
        PopBlock()
        return (True)
    endif
    PopBlock()
    return (False)
end

Note: 

This has been tested in latest TSE 4.50.20.

If you use another TSE version, you will have to backup,
do the same there in chkchg.s in the 'mac' directory, 
compile and run.

with friendly greetings
Knud van Eeden
Artificial Intelligence
IT specialist
TSE specialist





--

---
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/CAODxuObbeGMqoNG_JFmUo-2caRb4qfGqYH2CucLn2gPqfv6KLQ%40mail.gmail.com.

Carlo Hogeveen

unread,
Mar 2, 2026, 5:34:17 PM (10 days ago) Mar 2
to sem...@googlegroups.com

Hi Tom,

This might work:
https://ecarlo.nl/tse/DemosAndTests.html#chkchg2

Carlo



Tom Collins

unread,
Mar 3, 2026, 10:35:51 AM (9 days ago) Mar 3
to sem...@googlegroups.com
I was incorrect: adding PushBlock() and PopBlock() around the ReplaceFile() command did fix my problem, but it appears there are multiple code paths where the problem occurs.  If you load three files, 'a', 'markedfile' and 'changedfile', mark some lines in 'markedfile' and change 'changedfile' outside of TSE, the macro behaves differently WRT prompting for a reload and unmarking the block, depending on which file is the current file.  I need to investigate this further.

--

---
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.

knud van eeden

unread,
Mar 5, 2026, 10:23:06 AM (7 days ago) Mar 5
to sem...@googlegroups.com
> On Tuesday, March 3, 2026 at 04:36:00 PM GMT+1, Tom Collins wrote:
> I was incorrect: adding PushBlock() and PopBlock() around the ReplaceFile() command did fix my problem, but it appears there are multiple code paths where the problem occurs.  If you load three files, 'a', 'markedfile' and 'changedfile', mark some lines in 'markedfile' and change 'changedfile' outside of TSE, the macro behaves differently WRT prompting for a reload and unmarking the block, depending on which file is the current file.  I need to investigate this further.

This is already improved with regard to the original Semware chkchg.s, also added the above features:

I have asked the AI to give a solution and that version appears to works after some brief testing.

See also:

with friendly greetings
Knud van Eeden
Artificial Intelligence
IT specialist
TSE specialist

Inline image

Inline image

Inline image


Tom Collins

unread,
Mar 9, 2026, 9:18:39 AM (3 days ago) Mar 9
to sem...@googlegroups.com
Knud,

Thank you.  Your version appears to work perfectly now.

Sammy - would suggest making Knud's new version of this macro part of the TSE distribution as it is much improved.

Tom


--

---
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.
Reply all
Reply to author
Forward
0 new messages