Author Topic: Bringing VS to front always opens a file...  (Read 640 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2389
  • Hero Points: 201
  • Text
Bringing VS to front always opens a file...
« on: June 11, 2021, 04:43:28 pm »
This is a new thing - it first happened to me a few days ago, but today it is happening again, but with a different file.

Slickedit is running.
From a separate CMD window, I type "vs"
Normally this just brings Slickedit to front.

Now, it also opens a specific file (C:\src\file.bat).

From the cmd prompt, if I do
Code: [Select]
vs OtherFile.txt
Slick behaves as expected, but then
Code: [Select]
vs
slick again opens (or makes active) C:\src\file.bat


Earlier I did have a 2nd instance of Slickedit open (via vs +new), but currently I have only the original instance open.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6068
  • Hero Points: 467
Re: Bringing VS to front always opens a file...
« Reply #1 on: June 12, 2021, 06:14:30 pm »
Did you set the "VSLICK" environment variable? This is used to add arguments to every invocation.

jporkkahtc

  • Senior Community Member
  • Posts: 2389
  • Hero Points: 201
  • Text
Re: Bringing VS to front always opens a file...
« Reply #2 on: June 13, 2021, 01:25:44 am »
No, and restarting Slickedit fixes the problem.
Seems like slick is somehow hanging on to some state it shouldn't.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6068
  • Hero Points: 467
Re: Bringing VS to front always opens a file...
« Reply #3 on: June 13, 2021, 01:51:30 am »
Tricky issue. Make sure there isn’t an extra SlickEdit process running. Long shot guess.

jporkkahtc

  • Senior Community Member
  • Posts: 2389
  • Hero Points: 201
  • Text
Re: Bringing VS to front always opens a file...
« Reply #4 on: June 19, 2021, 12:43:02 am »
Happening again right now.
Only one slick process open.
I don't think I've recently had a 2nd slick (via vs -new).
Anything I can do to help diagnose?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6068
  • Hero Points: 467
Re: Bringing VS to front always opens a file...
« Reply #5 on: June 19, 2021, 11:44:56 am »
I you got a config that reproduces every time, zip it up and upload it.

jporkkahtc

  • Senior Community Member
  • Posts: 2389
  • Hero Points: 201
  • Text
Re: Bringing VS to front always opens a file...
« Reply #6 on: June 19, 2021, 05:36:31 pm »
Nope, it just happens maybe once a week.
If I restart slickedit, the problem goes away.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6068
  • Hero Points: 467
Re: Bringing VS to front always opens a file...
« Reply #7 on: June 19, 2021, 07:23:55 pm »
Next time it happens, type “fexit” on the SlickEdit command line. This will exit SlickEdit without save files or overwriting any config files. Then you can try again to see if it reproduces and fexit again.

Graeme

  • Senior Community Member
  • Posts: 2677
  • Hero Points: 334
Re: Bringing VS to front always opens a file...
« Reply #8 on: June 20, 2021, 10:37:30 am »
You could use the _StackDump function to see the call stack.  I guess slick thinks the cmdline had a filename on it so stackdump probably won't show why slick thought that.

void _buffer_add_check_file(int newBufId, _str bufName, int bufFlags = 0)
{
   if (bufName == "c:/src/file.bat")
   {
      _StackDump(1,1);
      say("bufFlags = " :+ bufFlags);
   }
}


jporkkahtc

  • Senior Community Member
  • Posts: 2389
  • Hero Points: 201
  • Text
Re: Bringing VS to front always opens a file...
« Reply #9 on: July 20, 2021, 04:41:59 pm »
Thanks Graeme.
I got a repro today and using this trick caught it in the slickedit debugger.
I sent email to Clark via support with all the details.

In edit2(), line 622:
         } else if ( letter=='#' ) {
            execute(substr(word_nq,3),'');   /* Execute the command now. */
         } else if (letter=='I') {

word_nq is "-#", but the next stack frame is edit() and there the filename is the full path to the troublesome file.
Maybe a bug in substr() - since word_nq is only 2 characters here.
Internally, are slickedit strings null terminated or counted?
I'm guessing counted.


BTW, from cmd.exe if you enter "VS.exe C:\foobar.txt", word_nq is "-#  C:\foobar.txt"

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6068
  • Hero Points: 467
Re: Bringing VS to front always opens a file...
« Reply #10 on: July 21, 2021, 03:01:40 pm »
While I haven't reproduced this problem, I can see a possibility for this happening.

Try loading this change to files.e.  If it fixes the problem, I'll check it in.

jporkkahtc

  • Senior Community Member
  • Posts: 2389
  • Hero Points: 201
  • Text
Re: Bringing VS to front always opens a file...
« Reply #11 on: July 21, 2021, 03:53:57 pm »
I'll try, though I don't know how to repro -- just happens sometimes.