Extra tabs opening in editor lazarus / 9-Editor ---------------------------------------------------------------------- HomePlaneR · 2012-06-23 22:12 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 · 2012-06-23 22:35 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_Repo rt Open the window, before you run your app. ---------------------------------------------------------------------- HomePlaneR · 2012-06-23 23:49 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! ---------------------------------------------------------------------- Martin_fr · 2012-06-24 00:01 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 · 2012-06-24 00:31 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 · 2012-06-24 10:16 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 · 2012-06-24 10:22 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 · 2012-06-24 10:35 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]       ...                                                               ....                     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 · 2012-06-24 17:10 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 · 2012-06-24 17:18 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 · 2012-06-24 17:23 Thank you anyway. Now I can debug my programms in another location on the disk. Earlier it was just horrible. Quote from: Martin_fr on June 24, 2012, 07:18:30 pmJust 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 · 2012-06-24 18:31 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 ---------------------------------------------------------------------- HomePlaneR · 2012-06-24 19:18 Martin_fr, Done. Log file is attached. ---------------------------------------------------------------------- Martin_fr · 2012-06-24 20:40 While I was looking for more places to put in debugln log messages, I found to more possible issues. In components\lazutils\lazfileutils.pas search for   AnsiCompareText you should find 2, replace them with   UTF8CompareText and lets see, if that helps --- If not see attached, for getting a few extra log msgs. ---------------------------------------------------------------------- HomePlaneR · 2012-06-24 22:00 Unfortunately the bug is still there. New log file is attached. I have just noticed another problem which can be relied with our one. Compiled program can not open files whose path contains Cyrillic characters neither with standard Pascal file routines (Assign, Reset, etc.) nor with TFileStream. Does this mean that a nice part of my file system is not accessible for programs written in Lazarus? ---------------------------------------------------------------------- Martin_fr · 2012-06-24 22:08 About the "can't open" IIRC that is an issue in FPC, and is being worked on maybe in 2.7.1. But I do not know. If the IDE can, then so should your app. Try TFileStreamUtf8 or similar I will look into the logs ---------------------------------------------------------------------- Martin_fr · 2012-06-24 22:32 Please apply in addition to the previous patches. Be sure the file components\lazutils\lazfileutils.pas does NOT contain any AnsiCompareText ADDED: there is also components\lazutils\fileutil.inc same replacements, please ---- When building the IDE, ensure to check "clean all" ---------------------------------------------------------------------- HomePlaneR · 2012-06-24 22:49 It works! New tab doesn't appear. I will make several more test to ensure... Just in case, log file is attached. (Added) Yes it works for sure. I did all modifications you wrote and I put "clean all" in options. Sorry, it wasn't checked before. ---------------------------------------------------------------------- Martin_fr · 2012-06-24 23:12 Quote from: HomePlaneR on June 25, 2012, 12:49:18 amIt works! New tab doesn't appear. I will make several more test to ensure... Good QuoteI did all modifications you wrote and I put "clean all" in options. Sorry, it wasn't checked before. It should not be needed, but sometimes... Please test tomorrow with the 0.9.31 fixes snapshot (It will be available between 2:00 and 3:00 GMT+0) I should have all the relevant fixes applied to it. Sorry for the small updates. I should have found all the AnsiCompare in one go... But my mind was pre-occupied otherwise. ---------------------------------------------------------------------- HomePlaneR · 2012-06-24 23:16 Cool. I'll test the snapshot between 12:00 and 13:00 GMT (I can't do it earlier) and report here if all is ok. ---------------------------------------------------------------------- Ask · 2012-06-25 00:28 Wow. If this is finally fixed, my students will hopefully stop referring to Lazarus as "that ancient IDE which can not even read russian file names properly" :-) Many thanks. ---------------------------------------------------------------------- Martin_fr · 2012-06-25 00:43 Well this was the first time I heard of this issue. ---------------------------------------------------------------------- HomePlaneR · 2012-06-25 10:43 Quote from: Ask on June 25, 2012, 02:28:30 amWow. If this is finally fixed, my students will hopefully stop referring to Lazarus as "that ancient IDE which can not even read russian file names properly" :-) Many thanks. I didn't notice any other problems concerning Russian file names in IDE. I have just tested new snapshot. To be sure I completely uninstalled previous version. So, the bug is fixed. Martin_fr, thanks for your attention to the problem.