Recent

Author Topic: Extra tabs opening in editor  (Read 16007 times)

HomePlaneR

  • New Member
  • *
  • Posts: 34
Extra tabs opening in editor
« on: June 24, 2012, 12:12:26 am »
Hi.
I have a difficulty with the editor that causes me lots of problems.

When I put a breakpoint and launch the debugging, a new tab with the same code always appears in the editor (with the line indicating the execution point but without the breakpoint). It happens in 99% of cases (I can not determine when it doesn't happen) and even several times, so after several steps there are 3, 4 or even more extra tabs for each file. You modify one, save another, lose breakpoints in a third one, and so on.

I can not completely understand why it opens new and new tabs. I tried to change a lot of settings concerning tabs but it is still there. Of course, I tried to ask Google, but I found only this:
http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=18031
But because I'm stupid Windows user, I don't know what is symlink and how it is relied to my problem.

It makes the debugging process horrible and inefficient. Please, help.

OS: WinXP 32 bit, Lazarus 0.9.30.4

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #1 on: June 24, 2012, 12:35:49 am »
A "symlink" is similar to a shortcut, as in what you may have on the desktop or in the startup menu (icon with a small arrow in lover left corner)

Kind of a logical reference. E.g if you have the Lazarus icon on the desktop, they there is NOT a copy of Lazarus.exe on your desktop. Just a "shortcut"

Similar you can mount partitions on network drives, having the same location under more than one name (yes, on windows).

But I guess none of that is the cause in your case.

----

On the bottom of the editor, in the statusbar, is the complete filename.

Please compare it for the 2 copies of the file, that are opened. Look out for / versus \

You can copy it with "copy filename" from the context menu

----

Also if I remember, there were improvements since 0.9.30.4 was released.

I do highly recommend to try with a current 0.9.31 (fixes) snapshot. See link on the left side of this forum.

0.9.31 + fpc 2.6.0 is the upcoming Lazarus 1.0 release. Despite the warning on the Snapshot side, this version is currently rather stable.

Look for a file like
   Lazarus-0.9.31-37721-fpc-2.6.0-20120622-win32.exe
the 37721 and the date 20210622 change daily

Lazarus 1.1 snapshots, or fpc 2.7.1 are experimental

---
If that does not help, or if you can not upgrade, then please report:
1) the observation, about the filenames, as described above
2) The output of the "Debug output window" as described here:
http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#Create_a_new_Report
Open the window, before you run your app.

HomePlaneR

  • New Member
  • *
  • Posts: 34
Re: Extra tabs opening in editor
« Reply #2 on: June 24, 2012, 01:49:16 am »
Martin_fr,

Thank you for the explication as well as for the quick reply. It seems that I detect the problem. Unfortunately it is still not fixed in the most recent snapshot which I have just installed.

I never looked previously on the filenames. I discovered that in a new tab opened due to debugging it is different to the previous tab. Slashes are the same, but the path changes. Firstly, path to my project folder contains some letters in Cyrillic (the language of my OS is Russian). And the problem is that for the new tabs all capital Cyrillic letters in path are always changed to small letters.

I tested it with different paths: if there is no capital Cyrillic letters, all is OK and there is no new tabs. If there is at least one capital Cyrillic letter, new tab will appear with filename where all Cyrillic letters are in lower case. It doesn't affect tabs opened by Ctrl+Left mouse button click on variable, it affects only that opened due to debugging.

Again, thank you very much!
« Last Edit: June 24, 2012, 01:50:57 am by HomePlaneR »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #3 on: June 24, 2012, 02:01:47 am »
Ok, I can reproduce that with other utf8 chars here.

So for the moment, if you can avoid those chars... Not sure how easy this can be fixed

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #4 on: June 24, 2012, 02:31:37 am »
You can try the following patch. It works here, but may not be complete...
It is for the 0.9.31 version

Index: components/lazutils/fileutil.inc
===================================================================
--- components/lazutils/fileutil.inc   (revision 37738)
+++ components/lazutils/fileutil.inc   (working copy)
@@ -168,7 +168,7 @@
   CFRelease(F2);
   {$ELSE}
     {$IFDEF CaseInsensitiveFilenames}
-    Result:=AnsiCompareText(Filename1, Filename2);
+    Result:=UTF8CompareText(Filename1, Filename2);
     {$ELSE}
     Result:=CompareStr(Filename1, Filename2);
     {$ENDIF}

HomePlaneR

  • New Member
  • *
  • Posts: 34
Re: Extra tabs opening in editor
« Reply #5 on: June 24, 2012, 12:16:46 pm »
Martin_fr,

If I understand correctly, I should rebuild IDE after applying modifications you wrote? If this is it, it still doesn't work in the same conditions...

I'm not sure if my remark is pertinent, but I guess that in my case Windows use CP1251 (aka "Cyrillic ANSI") but not UTF8 for filenames. Maybe in the case when "system" language is English, UTF8 is used to represent filenames with "extra" characters. And so, you couldn't reproduce exactly the same situation with your OS.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #6 on: June 24, 2012, 12:22:37 pm »
As I said, I did not know, if it was 100%.

It is not only about how windows encodes then. IN the IDE as long as the IDE deals with them, they are handled as utf8. They are then converted, if needed. So the IDE does utf8 compare.


Can you sent, some of the affected filenames? (only the name, no content needed)

Are the files that are part of the project, some package, or used via some include path?

And please include the "Debug Output"
Menu "View" > "Debug Windows" > "Debug Output"

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #7 on: June 24, 2012, 12:35:17 pm »
One more thing.
You may have to clean up your project.lps file by hand.

It contains a list of files, including files that were open, but are closed. This list is not expected to have the upper/lower duplicates. But due to the error, it may now have them.
That is something the IDE can not (and will not) fix for you.

The file is either in your project directory, or in the primary config path (On XP somewhere in Documents and Settings. appdata/local/lazarus/projetsessions or similar)

Or if your settings (project settings session) do not specify an lps, then  the info is in the project.lpi file.
Code: [Select]
<?xml version="1.0"?>
<CONFIG>
  <ProjectSession>
    <PathDelim Value="\"/>
...
    <Units Count="15">
      <Unit0>
        <Filename Value="project1.lpr"/>
        <IsPartOfProject Value="True"/>
        <UnitName Value="project1"/>
        <UsageCount Value="22"/>
      </Unit0>
      <Unit1>
        <Filename Value="unit1.pas"/>
....
      </Unit1>
      <Unit2>
        <Filename Value="B:\lazarus_latest\components\lazcontrols
....

If you remove an entry, then you must adjust the count and all following numbers...

Or just set the entry to be a none existing file....

HomePlaneR

  • New Member
  • *
  • Posts: 34
Re: Extra tabs opening in editor
« Reply #8 on: June 24, 2012, 01:39:17 pm »
I did what you wrote, but it still doesn't work.

Here is a debug report (I made it as it is described in #Create_a_new_Report). I put several examples of filenames in "basic info.txt".

And just in laz.log there is something that is clearly pertinent:
"info line \"C:\\\320\237\321\200\320\276\320\262\320\265\321\200\320\272\320\260\\project\\wPlayer.pas\":228\n"
[Debugger] Log output: &"No source file named C:\\\320\237\321\200\320\276\320\262\320\265\321\200\320\272\320\260\\project\\wPlayer.pas.\n"

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #9 on: June 24, 2012, 05:02:09 pm »
There have been some other changes

Please try tomorrows snapshot (or if you have svn use that).

Must be 1.1 snapshot.

It does include the patch too. So no need to maintain

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #10 on: June 24, 2012, 05:09:24 pm »
The additional changes as patch, so you do not need to wait for the snapshot.

Would be good, if you can test soon, please


Index: A:/ide/ideprocs.pp
===================================================================
--- A:/ide/ideprocs.pp   (revision 37752)
+++ A:/ide/ideprocs.pp   (revision 37753)
@@ -371,7 +371,7 @@
       // check if special file
       if (FileInfo.Name='.') or (FileInfo.Name='..') or (FileInfo.Name='') then
         continue;
-      if (AnsiCompareText(CaseInsensitiveFilename,FileInfo.Name)=0)
+      if (CompareFilenamesIgnoreCase(CaseInsensitiveFilename,FileInfo.Name)=0)
       and ((not IgnoreExact)
            or (CompareFilenames(CaseInsensitiveFilename,FileInfo.Name)<>0))
       then begin
Index: A:/ide/project.pp
===================================================================
--- A:/ide/project.pp   (revision 37752)
+++ A:/ide/project.pp   (revision 37753)
@@ -5544,7 +5544,7 @@
     if siffCaseSensitive in SearchFlags then
       Result:=SearchedFilename=AFilename
     else
-      Result:=AnsiCompareText(SearchedFilename,AFilename)=0;
+      Result:=CompareFilenamesIgnoreCase(SearchedFilename,AFilename)=0;
   end;
   
 begin

HomePlaneR

  • New Member
  • *
  • Posts: 34
Re: Extra tabs opening in editor
« Reply #11 on: June 24, 2012, 07:10:07 pm »
Martin_fr,

I applied the changes and tested several times with existing and new projects in several different locations, but there is no effect. Capital Cyrillic letters are always being changed to small.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #12 on: June 24, 2012, 07:18:30 pm »
Thanks for the quick testing, I will investigate further...

 Sorry about the trial and error, but I am just stuck between a few different issues

Just to double check: You did check your project.lps file? Or better, just test on a new project?

HomePlaneR

  • New Member
  • *
  • Posts: 34
Re: Extra tabs opening in editor
« Reply #13 on: June 24, 2012, 07:23:21 pm »
Thank you anyway. Now I can debug my programms in another location on the disk. Earlier it was just horrible.

Just to double check: You did check your project.lps file? Or better, just test on a new project?

Yes, as I wrote before I tested it on a new project.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11911
  • Debugger - SynEdit - and more
    • wiki
Re: Extra tabs opening in editor
« Reply #14 on: June 24, 2012, 08:31:26 pm »
Bad news.

Due to the way FPC interacts with the win API, I can not use Russian chars in my filenames. Lazarus will fail, if I try to save into such a folder.

With English/German chars, I can not reproduce it.  That is:
- If I set a breakpoint and close the unit, it will open it and the statusbar shows lower case
- But if it was open (showing upper/mixed case in the status bar, then it uses the already open copy.

Probably will have to report on the bug-tracker.

However, if you are willing to spent some more time, we can try and f7ind some more. That is I will ask you to recompile the IDE with special settings, and/or send more patches, and then you sent the results.

There is however no guarantee that this will lead to success, and I can not predict, how many turns it will take...
 
The first step would be to compile the IDE with the following define
  VerboseFindSourceFile
On command line -dVerboseFindSourceFile
Or from tools menu "Configure build ide", and then add the define.

Run the IDE with --debug-log=... and sent the file

Also add --debug-enable=DBG_LOCATION_INFO,DBG_CMD_ECHO

 

TinyPortal © 2005-2018