Bug in TSE 4.41.46 upwards for shortcuts with 2+ parameters

22 views
Skip to first unread message

Carlo Hogeveen

unread,
Jan 11, 2022, 9:51:54 AM1/11/22
to Semware @ GoogleGroups

 

As documented in the release notes, in TSE 4.41.46 (actually released 24 Dec 2021) the user interface files were updated, so that TSE only opens one file if it was not started from the command line.

 

The reason given in the release notes is:

“In Explorer, if you try to open a file, that has spaces in the name, TSE might not load it.”

I assume this refers to Windows’ File Explorer.

 

Firstly, I cannot reproduce this.

Both my EdWihTse tool and Semware’s installation program set up File Explorer’s context menu to use quotes around the name, so spaces in a name are not a problem.

 

Secondly, one of my Windows shortcuts no longer works because of the update.

Because I regularly search all TSE sources, I have a desktop shortcut that for example is defined as:

  Start in: C:\Users\Carlo\Tse

  Target: C:\Users\Carlo\Tse\g32.exe -a mac\*.s mac\*.si mac\*.inc mac\*.h  ui\*.ui

  Shortcut key: CTRL + ALT + A

This shortcut no longer works because of TSE’s new feature/bug.

 

From my viewpoint, based on the info so far, it would be better to teach someone to use quotes around names than to break TSE’s start-up capabilities for everybody.

 

I suggest reverting this “feature”.

 

Carlo

 

 

knud van eeden

unread,
Jan 11, 2022, 11:16:18 AM1/11/22
to Semware @ GoogleGroups
This can not be reproduced using a clean 4.41.46 (and similarly 4.41.43, 4.42) where each time the same result as below was shown:

Steps:

1. Using cmd.exe (or also JPSoft tcmd/tcc.exe) as command line console

2. change directory the TSE main directory (there where the file g32.exe is located)

3. On the command line type or paste:

g32.exe -a mac\*.s mac\*.si mac\*.inc mac\*.h  ui\*.ui

4. When you choose menu TSE > 'File' > 'List open' it will show 'Buffer list - 117 file(s) - 1 loaded - 116 not loaded (sorted)' 

5. Result: That will  show in list open (as expected) successfully 116 files in the g32.exe (=as asked for on the command line all files with the extensions .s (101), .si (8), .inc (2), .h (1), .ui (5), and 101+8+2+1+5=117 totally)

===

1. Please clarify further (e.g. an example of what is thus obviously missing or not working (filename, ...)).

2. So how is this shortcut key thus used (for reproduction purposes here):

  Shortcut key: CTRL + ALT + A

wit friendly greetings
Knud van Eeden


knud van eeden

unread,
Jan 11, 2022, 11:17:31 AM1/11/22
to Semware @ GoogleGroups
This can not be reproduced using a clean 4.41.46 (and similarly 4.41.43, 4.42) where each time the same result as below was shown:

Steps:

1. Using cmd.exe (or also JPSoft tcmd/tcc.exe) as command line console

2. change directory the TSE main directory (there where the file g32.exe is located)

3. On the command line type or paste:

g32.exe -a mac\*.s mac\*.si mac\*.inc mac\*.h  ui\*.ui

4. When you choose menu TSE > 'File' > 'List open' it will show 'Buffer list - 117 file(s) - 1 loaded - 116 not loaded (sorted)' 

5. Result: That will  show in list open (as expected) successfully 117 files in the g32.exe (=as asked for on the command line all files with the extensions .s (101), .si (8), .inc (2), .h (1), .ui (5), and 101+8+2+1+5=117 totally)

===

1. Please clarify further (e.g. an example of what is thus obviously missing or not working (filename, ...)).

2. So how is this shortcut key thus used (for reproduction purposes here):

  Shortcut key: CTRL + ALT + A

wit friendly greetings
Knud van Eeden


S.E. Mitchell

unread,
Jan 13, 2022, 5:50:36 AM1/13/22
to TSEPro Support
To reproduce:

Make sure you have a file with spaces in the name.

Start the Windows File Explorer.

Right click on the file with spaces in the name.

The context menu on my version of Windows has:

Open
Edit
CRC SHA >
Convert to Adobe PDF
Create and Share Adobe PDF
Share
Open with >
...

Expand Open with:

On my system, it has:

Notepad
The SemWare Editor Professional
WordPad
Search in the Microsoft Store
Choose another app

Select TSE.

And, the file is _not_ loaded properly, because EditFile()
assumes spaces are delimiters. So that is why I changed to
using EditThisFile().

How to make us both happy? :)

What do you think about this?

Revert the .ui files to using EditFile() instead of
EditThisfile(), even when called from the desktop or an
icon.

Change EditFile(), so that before it does anything else, if
there are no quotes on the command line, do a
FileExists(cmdline_string) - if it returns true, just go
ahead and load the file.

If it returns false, parse and process the command line as
it does now.

I think this would fix the problem. In my use case, it
would work, because the command line string names an
existing file.

In your use case it would work, because the command line
string does not match an existing file, so normal command
line processing would happen.

Downside: EditFile() would be a tad slower, because of the
extra file I/O. But, it would only happen on startup, since
on startup, EditFile() is called as:

EditFile(s, _FROM_CMDLINE_)

So I would only implement the new logic when the
_FROM_CMDLINE_ flag is passed.

?

--
Sammy Mitchell

C.H. Fred

unread,
Jan 13, 2022, 6:38:35 AM1/13/22
to sem...@googlegroups.com
There's a concept in C parsers that may assist here.  It's the concept of "Maximum Munch," which means in this case:  You try to consume as much as possible when building a filename.

Since we know spaces exist in filenames, when you encounter files to load and multiple parameters delineated by spaces, try the lot of them to see if that file exists.  If not, back off one and try that one.  Repeat until you find a file.

That way you can consume multiple separate parameters for a single file if need be.

For file creation, require double quotes around the name.

Might work out as a compromise.

-- 
Rick C. Hodgin



--

---
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 on the web visit https://groups.google.com/d/msgid/semware/CA%2BgEvkaNBsJKmJp3yEdo2XFGpU0SSZ7xg3-vr%2BZFBxZhgAc2Fw%40mail.gmail.com.

Carlo Hogeveen

unread,
Jan 13, 2022, 6:51:04 AM1/13/22
to sem...@googlegroups.com

Sammy,

Excellent explanation.
Surprisingly, I cannot reproduce this.
Using TSE 4.42 in the latest Windows 10 I changed the relevant part in my win.ui file to:
SignOn()
Warn('===', s, '===')
if StartedFromDosPrompt()
EditFile(s, _FROM_CMDLINE_)
else
EditFile(s, _FROM_CMDLINE_)
// EditThisFile(s)
endif
Seeing the warning ensured that the context menu uses the expected TSE installation, and the warning shows ==="D:\My File.txt"===, so Windows still passed the file with quotes, and TSE loaded it correctly.
I tried this with both the GUI and Console version of TSE.

Jumping ahead, in case we do not find the root cause for our different result, I think making EditFile() "smart" is a bad idea, because it makes its and TSE's behaviour ambiguous and more complex to define and predict at too low a level, affecting the whole editor. I would prefer your idea implemented in the .ui files instead. But ideally I would prefer to find the root cause of our different result.

Carlo


-----Oorspronkelijk bericht-----
Van: sem...@googlegroups.com <sem...@googlegroups.com> Namens S.E. Mitchell
Verzonden: donderdag 13 januari 2022 11:50
Aan: TSEPro Support <sem...@googlegroups.com>
Onderwerp: Re: [TSE] Bug in TSE 4.41.46 upwards for shortcuts with 2+ parameters

knud van eeden

unread,
Jan 13, 2022, 7:04:13 AM1/13/22
to TSEPro Support
Hello,

This can not be reproduced here.

Microsoft Windows 10 Professional with latest updates installed.

Latest TSE version 4.42, clean installation, classic interface.

Steps:

1. Create a file with a space in the filename in the c:\temp\ directory
  "foo bar.txt"
2. Put some text in it, e.g.
this is a test 1
this is a test 2
this is a test 3
3. Save the file
4. Start Explorer
5. Right click on the file "foo bar.txt", choose 'Open with', then 'Other program'
6. Navigate to g32.exe
7. That opens the file with spaces in its name successfully and shows the content.
8. Optionally: Double checking that this is TSE 4.42 confirms that version.

with friendly greetings
Knud van Eeden


--

---
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+unsub...@googlegroups.com.

S.E. Mitchell

unread,
Jan 13, 2022, 9:09:33 PM1/13/22
to TSEPro Support
Here is what I'm currently using - it works for both of our use cases.

SignOn()
if StartedFromDOSPrompt() or Pos(" ", s) == 0 or not FileExists(s)
EditFile(s, _FROM_CMDLINE_)
else
// otherwise from desktop, spaces in the name, file exists
EditThisFile(s)
endif
--
Sammy Mitchell
> To view this discussion on the web visit https://groups.google.com/d/msgid/semware/001c01d80873%24d507d070%247f177150%24%40ecarlo.nl.

Carlo Hogeveen

unread,
Jan 14, 2022, 7:07:34 AM1/14/22
to sem...@googlegroups.com

I did a lot more testing with TSE, mainly with TSE settings,
and still wasn't able to reproduce Windows 10
not quoting a filename that contains spaces.
Google did not work for me either.
The results do point to a cause outside TSE.

For what it's worth, I haven't been able to come up
with a better solution than the one below.
Given the problem it's a good one.

Carlo



-----Oorspronkelijk bericht-----
Van: sem...@googlegroups.com <sem...@googlegroups.com> Namens S.E. Mitchell
Verzonden: vrijdag 14 januari 2022 03:09
Aan: TSEPro Support <sem...@googlegroups.com>
Onderwerp: Re: [TSE] Bug in TSE 4.41.46 upwards for shortcuts with 2+ parameters

Here is what I'm currently using - it works for both of our use cases.

SignOn()
if StartedFromDOSPrompt() or Pos(" ", s) == 0 or not FileExists(s)
EditFile(s, _FROM_CMDLINE_)
else
// otherwise from desktop, spaces in the name, file exists
EditThisFile(s)
endif
--
Sammy Mitchell

[ ... deleted history ... ]



Carlo Hogeveen

unread,
Jan 14, 2022, 10:18:04 AM1/14/22
to sem...@googlegroups.com

Sammy,

Having excluded other probabilities that I could come up with, I have to ask, do you get the "Open With" context menu not quoting a filename problem on Windows 10 or an older Windows version?

Carlo



S.E. Mitchell

unread,
Mar 12, 2022, 9:06:36 AM3/12/22
to TSEPro Support
It was on Windows 10.
Since then, I've had several updates applied to Windows 10, and I can
no longer produce the problem.

At this point I no longer consider it a problem, and will remove the
special checking code.
--
Sammy Mitchell
> --
>
> ---
> 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 on the web visit https://groups.google.com/d/msgid/semware/000101d80959%24eb59cd60%24c20d6820%24%40ecarlo.nl.
Reply all
Reply to author
Forward
0 new messages