ShellExecute inserts newline in Far interface

Here you can discuss any topic concerning Far macro commands.
Post Reply
User avatar
rattle
Posts: 23
Joined: Sat 02 Sep, 2017 18:58
Been thanked: 8 times

ShellExecute inserts newline in Far interface

Post by rattle »

Hey all, I created the following command shortcut:

Code: Select all

CommandLine {
  prefixes = "vsc";
  action = function(prefix, filename) 
    win.ShellExecute(nil, "VSCode", filename, nil, panel.GetPanelDirectory(nil, 1).Name)
  end;
}
which will open the argument in Visual Studio Code. The problem I have is that this command always inserts a newline character in Far, messing up the interface. It only happens with this particular shell exectue handler, if you replace it by

Code: Select all

    win.ShellExecute(nil, "open", "notepad", filename, panel.GetPanelDirectory(nil, 1).Name)
it works without problem. Does anyone know what is causing this and how to avoid it?
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

ShellExecute inserts newline in Far interface

Post by DrKnS »

Perhaps the underlying implementation writes something to stdout.
Adding getuserscreen before your call and setuserscreen after it might help.
User avatar
rattle
Posts: 23
Joined: Sat 02 Sep, 2017 18:58
Been thanked: 8 times

ShellExecute inserts newline in Far interface

Post by rattle »

Hey man, thanks again, that helped.
Post Reply

Return to “Macro Commands Discussions”