Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Bug in StrReplace()

10 views
Skip to first unread message

Carlo Hogeveen

unread,
Apr 13, 2025, 5:06:44 AMApr 13
to Semware @ GoogleGroups

Just like any other string command, if StrReplace() creates a string longer than the maximum string length, then it should just cut
the excess off, and not abort the editor with "I'm sorry, Dave. I'm afraid I can't do that.".

not-Dave



proc Main()
integer i = 0
string r [MAXSTRINGLEN] = ''
string s [MAXSTRINGLEN] = ''
for i = 1 to MAXSTRINGLEN
s = Format('':i:'x')
Message('i=', i; 's=', s)
KeyPressed()
Delay(1)
r = StrReplace('x', s, 'yy')
r = r // Pacify compiler.
endfor
PurgeMacro(CurrMacroFilename())
end Main




Fred H Olson

unread,
Apr 13, 2025, 8:07:34 AMApr 13
to Semware @ GoogleGroups
Hi Carlo,

I tried the macro below on my Linux TSE 4.50 and it counted up to 255
and stopped without aborting. Is that what you would expect?
Fred
> --
>
> ---
> 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/000401dbac53%2434eb23d0%249ec16b70%24%40ecarlo.nl.
>

--
You can fool all the people some of the time and some of the people
all the time, but you cannot fool all the people all the time.

Abraham Lincoln

Trump has proved he can fool enough of the people (aided by circumstances)
to get elected US president. But what happens when his plans and boasts
go awry. For example, mass deportations and huge tariffs will do a number
on the economy.

Fred H. Olson Minneapolis,MN 55411 USA (near north Mpls)
Email: fholson at cohousing.org 612-588-9532
My Link Pg: http://fholson.cohousing.org ybb_

Carlo Hogeveen

unread,
Apr 13, 2025, 12:06:29 PMApr 13
to sem...@googlegroups.com

Hi Fred,

Fair point.
My tests say:
In the Windows GUI and Console versions of TSE the example macro aborts at "i=131" while apologizing to Dave.
In WSL's Debian with the Linux version of TSE the macro aborts on a "Segmentation fault" at "i=131".
In a Debian desktop and in a Ubuntu desktop with the Linux version of TSE the macro does not abort.

not-Dave



Carlo Hogeveen

unread,
Apr 13, 2025, 1:01:08 PMApr 13
to sem...@googlegroups.com

The StrReplace() demo macro not aborting in Linux desktops turns out to be a red herring.
I had an "old" Linux TSE installation in my Linux desktops.
I suspect Fred does too.

Further tests say that from TSE v4.50.1 (12 Dec 2024) onwards the demo macro starts aborting in all environments.

TSE's read.me file states that in v4.50.1 bugs in StrFind() were fixed.
I suspect the new StrReplace() bug is a side-effect of that.

not-Dave



Reply all
Reply to author
Forward
0 new messages