Editra opens new tab for already opened files

Request Features and Feature Changes

Editra opens new tab for already opened files

Postby immortalnights » Thu Jan 27, 2011 4:28 pm

I raised an issue for this, which was subsequently closed (issue 585) , but I feel that it deserves a little more attention.

While I understand your reasoning and agree only if the buffer is within a different pane. Having the same file open and "Automatically reload file when changes are detected on disk" seem to me to be a waste of space.

Furthermore, this is a major issue when related to Launch, as Launch in almost all cases opens the file in a new buffer unless it was opened by Launch in the first place.

I'd very much like some kind of solution. Either an option or prevention of the same file being opened multiple times in a given buffer. As it stands I'm constantly closing tabs I don't want and have resorted to using Ctrl+G (goto) to locate errors within code rather then the links provided so nicely by Launch.

If you're too busy with other things, would you accept a patch for one of the above solutions?
immortalnights
User
 
Posts: 39
Joined: Tue Dec 21, 2010 2:02 pm

Re: Editra opens new tab for already opened files

Postby cody » Thu Jan 27, 2011 5:04 pm

Hi,

If the file is already open then Launch should definitely just activate the existing tab instead of opening a new one. Something may have gotten broken in this regard and should be corrected.



Cody
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States

Re: Editra opens new tab for already opened files

Postby immortalnights » Tue Mar 01, 2011 3:07 pm

This is stall causing me major issues. Debugging code now requires me to "GOTO" each line since I'm unable to use the Launch link provided without it opening a new file and causing no end of issue, including, but not limited to loss of data.

I am guessing your still set on allowing the same file to be open in multiple buffers, but you do suggest the Launch problem is an issue therefore I've created an issue for it: http://code.google.com/p/editra-plugins ... ail?id=162.
immortalnights
User
 
Posts: 39
Joined: Tue Dec 21, 2010 2:02 pm

Re: Editra opens new tab for already opened files

Postby cody » Wed Mar 02, 2011 1:08 am

I can't reproduce this issue. Launch will only open a new page if the path resolved in the link does not match any of the files that are already open.

Do the path(s) that are being shown in the error output differ from the files that are open in any way?

What kind of files are you running in Launch?
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States

Re: Editra opens new tab for already opened files

Postby immortalnights » Wed Mar 02, 2011 10:33 am

The paths shown in Launch are relative. I use a Python script to compile C++ code, and the script writes out the files. However, the files it writes out are (intended to be) exactly what is output by the make process so I do not change them and really really don't want to have to.

I've simplified my script to simply print out the processes stdout lines and created a test project in a number of sub directories. The sample code contains a syntax error to ensure errors are displayed in Launch. In my case, using the python script in Launch on the given project reproduces this every time.

Using the sample as reference (extracted to the root of C:), executing Launch on either the header or source file at path:
Code: Select all
C:\root_directory\subdirectory1\subdirectory2\source.cpp

produces error links such as the following:
Code: Select all
.\source.cpp(32) : error C2065: 'foo_invalid' : undeclared identifier


Using that link will open a buffer to the file using the following path:
Code: Select all
C:\root_directory\subdirectory1\subdirectory2\.\source.cpp

The key difference here is the \.\ between the final directory and the file.

I get similar issues in different situations sometimes containing \..\ depending on how the error file relates to the path of compilation.

Hopefully that helps to identify the issue.
Attachments
sample_foo.zip
Minimal C++ project and python compiling script
(1.58 KiB) Downloaded 362 times
immortalnights
User
 
Posts: 39
Joined: Tue Dec 21, 2010 2:02 pm

Re: Editra opens new tab for already opened files

Postby cody » Wed Mar 02, 2011 2:08 pm

Ok, so the issue appears to be that the plugin is resolving the relative path incorrectly so it thinks that the file is not already open since the simple comparison of "C:\foo\.\file" != "C:\foo\file". Should be fairly simple to correct but will require a new version of Launch.

Also when relative paths are found in the error message the relative path is resolved using the known absolute path of the script that is being run so I am kind of surprised that the links work at all. I guess unless the python script and makefile are in the same directory and that all errors returned by the compiler are relative to the makefile. Also since I would think that Launch is running in the context of Python since you said your running a python script to run make, that the links would be found at all. Because the compiler output isn't going to match the pattern used to find Python exception lines.
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States

Re: Editra opens new tab for already opened files

Postby immortalnights » Wed Mar 02, 2011 4:06 pm

cody wrote:Ok, so the issue appears to be that the plugin is resolving the relative path incorrectly so it thinks that the file is not already open since the simple comparison of "C:\foo\.\file" != "C:\foo\file". Should be fairly simple to correct but will require a new version of Launch.


Great; looking forward to it ;)

cody wrote:Also when relative paths are found in the error message the relative path is resolved using the known absolute path of the script that is being run so I am kind of surprised that the links work at all. I guess unless the python script and makefile are in the same directory and that all errors returned by the compiler are relative to the makefile. Also since I would think that Launch is running in the context of Python since you said your running a python script to run make, that the links would be found at all. Because the compiler output isn't going to match the pattern used to find Python exception lines.


You-what-now?! It didn't take all that much effort to set up - it "kind of just worked. I have the python script that is used for launch in the Editra's user directory for convenience. Since it's unique to the way Launch uses it.

Additionally, the code obviously is marked as C++, and therefore the Launch command for C++ is set to
Code: Select all
python "<path-to-script>\make.py
. Since Launch calls the Launch program with a working directory of where ever the file which is being launched under. Then I use this directory within the script to know what to make and where. Therefore the paths are relevant to the file what was used for Launch.

I believe the "linking" is defined within the Launch.xml since it was done before Launch (whichever it was) recognized C++ natively.

Does that clear up anything regarding why it's working?
immortalnights
User
 
Posts: 39
Joined: Tue Dec 21, 2010 2:02 pm

Re: Editra opens new tab for already opened files

Postby cody » Wed Mar 02, 2011 4:09 pm

Ah, had my coffee now

Was thinking you where running the Python script from the Python handler, but now see that you were running it from the C/C++ handler so it does make sense why its working.
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States

Re: Editra opens new tab for already opened files

Postby immortalnights » Wed Mar 02, 2011 4:25 pm

Also, I've noticed that the check is case sensitive; while that might be right for Lunux/other OS. For Windows there isn't any good reason to check case sensitively, right?
immortalnights
User
 
Posts: 39
Joined: Tue Dec 21, 2010 2:02 pm

Re: Editra opens new tab for already opened files

Postby mcarans » Thu Mar 03, 2011 3:13 pm

Just to add my vote that files are "opened" by default by reusing any existing tab, as a user may not realise that they've already opened a tab before when they've opened and closed many files. Also I can't think of a use case where I'd want exactly the same file open in 2 tabs.
mcarans
User
 
Posts: 38
Joined: Wed Oct 13, 2010 8:03 am

Re: Editra opens new tab for already opened files

Postby qazzi76 » Thu May 16, 2013 11:41 pm

I'm not sure I understand this?

I think it's good that Editra does this as it facilitates having multiple views of the came file which is absolutely crucial when dealing with multi thousand line code as I do.

Possibly this functionality could be available via a "tickable" preferences option instead so that it remains available for the people that need it like myself.

I have already mentioned in one of my feature requests that a "Clone to other View" right click Tab option might also better facilitate this.

Am sure Cody will enlighten us about the best way forward when he has some time.

Again Cody thank you so much for this Editor as it's really really useful to me.
qazzi76
Limited User
 
Posts: 3
Joined: Thu May 16, 2013 11:21 pm

Re: Editra opens new tab for already opened files

Postby cody » Fri May 17, 2013 1:58 pm

I like the idea of having the clone to other view. Actually thought this already existed but doesn't appear to.

That would probably give the behavior of least surprise on this issue.
User avatar
cody
Site Admin
 
Posts: 1315
Joined: Mon Oct 09, 2006 2:49 am
Location: United States

Re: Editra opens new tab for already opened files

Postby qazzi76 » Sun May 19, 2013 1:02 pm

Perfect!! :)

cody wrote:I like the idea of having the clone to other view. Actually thought this already existed but doesn't appear to.

That would probably give the behavior of least surprise on this issue.
qazzi76
Limited User
 
Posts: 3
Joined: Thu May 16, 2013 11:21 pm


Return to Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest

cron