Page 1 of 1

ShellExecute inserts newline in Far interface

Posted: Wed 11 Oct, 2017 11:21
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?

ShellExecute inserts newline in Far interface

Posted: Wed 11 Oct, 2017 12:12
by DrKnS
Perhaps the underlying implementation writes something to stdout.
Adding getuserscreen before your call and setuserscreen after it might help.

ShellExecute inserts newline in Far interface

Posted: Wed 11 Oct, 2017 17:27
by rattle
Hey man, thanks again, that helped.