Strange problem with <crlf> in a script
Posted: 31 Jan 2021 12:44
I've made some nice progress on a little scripting-project, but now I've hit a brick wall. Hopefully the following description will be good enough to understand the problem.
The idea is to build a menu for popupnested. To a large extent that works nicely, the remaining problem I need to deal with is this: These menu-items are taken from the User-menu and they icons do work there (the menu shown contains the 2nd half of "Open With": The problem with missing icon is caused by a blank line in the menu that is passed to popupnested. The relevant section of the menu (copied from the variable) looks like this:
Ok, I hear you: "Dummy, just get rid of that line!"
Well, that's my problem. Right before the call to pupupnested, I thought I did that:
That is followed by text $Menu and the call to popupnested. The piece above was taken right from that text-display which surprisingly does not show that empty line:
Yet, if I click the Copy-Btn, I get the empty line. I saved the menu to a file and verified that it contains 0D 0A 0D 0A (CRLF CRLF) at that position!
Questions:
The idea is to build a menu for popupnested. To a large extent that works nicely, the remaining problem I need to deal with is this: These menu-items are taken from the User-menu and they icons do work there (the menu shown contains the 2nd half of "Open With": The problem with missing icon is caused by a blank line in the menu that is passed to popupnested. The relevant section of the menu (copied from the variable) looks like this:
Code: Select all
&Open with...
Beyond Compare|load "<xyscripts>\bcompare.xys";
---
#176
RepoLauncher.cmd|#1403|%iconlib%\git.ico
VS Code|#1402|%iconlib%\vscode.ico
UEStudio|#1400|%iconlib%\uestudio.ico
RenameOk, I hear you: "Dummy, just get rid of that line!"
Well, that's my problem. Right before the call to pupupnested, I thought I did that:
Code: Select all
$Menu = formatlist($Menu,"e",<crlf>); // remove empty linesQuestions:
- why doesn't formatlist clean out that empty line?
- is this behaviour know to be a problem and is there a workaround?
- the menu is then displayed using - isn't it somewhat fishy that the empty next line would affect the display of the icon of a menuitem?
Code: Select all
$sel = popupnested($Menu, 6:=<crlf>, 7:="|");