|
Модераторы: Vitalik |
|
DavidCl0nel |
|
|||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
Hmm, it works good at me. I test it with SynEdit.pas and a little Add to "SynMemo1.CodeFolding.FoldRegions.Add(..)" for only an IF-Fold, and it looks ok, if i press return at start of line.
Maybe I missed a change here. I copy your "two cents"-Changes in mine and send it per mail. |
|||
|
||||
DavidCl0nel |
|
||||||||||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
Some hours sweat and work later....
Because of the problem, if i delete two blocks and Undo and Redo.... i had to redesign this function. And I think its very good now. In the last version I prevent the second Call fo fUndoList.AddChange with normal crDelete, because i have done this in my deleteLine-Function. This causes such errors. Now he add 2 Undo Items, one "normal" for crDelete (it consist the lines except the collapsed lines around a block) and another crDeleteCollapsedFold which carry only the collapsed lines... better it carry the data-element for the collapsed lines. The undo (and redo later) only add this data in the array, and the complete code is back! It looks very simple now!
And here i could delete very very much. I hold the case for this "version" with VK_SHIFT and such, but it isnt needed anymore. In next version its "if selavail then Result := True"
Look how easy Redo is now. The changes for Delete had to made, cause he keep SelText in Mind for Undo - but this SelText-function I rewrite to copy also the collapsed lines (you remember?). So i had to write a workaround here, that he only copy the normal lines around the collapsed lines. Undo the same like Redo:
In the ExecuteCommand i got the same problem with SelText. Same Workaround.
And the last, also very important and the main issue, cause it needed so many hours... This function is called, if you add a item in the Undo or Redo-Structure... But it calls OnChange there, and in this method i call Rescanforfoldranges. And if i add a item in function LinesDeleted to the Undo-Structure it calls it and make many trouble.
I'm very glad that it works good and very simple. Maybe i missed a change again, i send it by email.... |
||||||||||||
|
|||||||||||||
Sep. |
|
||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
Ok. =)
I've updated SynMix basing on your mail. SynMix update 11/08/06 download (400kb) There was also added //###mod uncollapse dont reset selection
Also here is small bug in CanExecuteInLine.
There was missed 'if (FoldRange1=nil)' in last 'else'. PS Here is ours test application LeakTest (4kb) You'll need to place test file named 1111.pas in folder of app. We usually use renamed SynEdit.pas as test =) Also you need SynUniHighlighter - which allows to load highlighters in runtime. Not hardcoded in exe like original SynEdit. SynUniHighlighter 2.0beta4 (77kb) Also here used FastMM4, but of course can be commented out. So in this test app are drops of foldranges: Collapse line, place cursor to it's start, and press enter. When using 'php.hgl' there no bug. Does it problem of SynUniHighlighter? =) --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||
|
|||||
DavidCl0nel |
|
|||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
I tried your Leak-program, but i haven't the problems on enter on start of line. This works... Hmm.
But i found a other bug. If you press enter on end of line of a collapsed block, he uncollapse it correctly, and add the line after it. But the fold range start he also move one line after it. I look for it now. But another thing. I consider to reject the SelText-changes to its default old function. So he only copy the lines not the collapsed parts. Reason: I had to make 2 workarounds in my last post for the Undo/Redo. Maybe i should reset SelText, then i dont need this workarounds. For CopyToClipboard and CutToClipboard i can use the current SelText-function (Maybe i should rename it to SelCompleteText or such). What do you think? |
|||
|
||||
Sep. |
|
|||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
It's very strange that you don't have bug with drop of foldranges. What version of Delphi do you use? May be some bug in {IFDEF} code.
I think you need left it as is, it's right when in SelText stored all selected text, so i can use it in programm. If you rewrite CutToClipboard what will be with undo and SynEdit.SelText? May be it need to rewrite pressing enter at end of collapsed line, so it'll be no uncollapse but insert line after collapsed. If it's possible =) --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
|||
|
||||
DavidCl0nel |
|
||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
Delphi5. Got some strange things with compiling SynUniHighlighter at first time with the Include of *.inc. Dont know, what he want, but later he compiles it only with some warnings, not with Errors... Anyway, i dont got the problems like you said it.
The remaining unclarity with D5 is also the "inherited" in the TSynEditCodeFoldingPlugin-Methods. I got a really hard crash, if Delphi5 should call inherited, because there are no inherited method, because it is abstract. You, with Delphi X (7? newer?), apparently don't have this problem, because your original source code has the inherited. Maybe you need it (but i couldn't imagine, what he should do there). Try to set a break point to it and have a look, what he does. If you need it (or if your compiler silent ignores it), the commented inherited should set in IFNDEF VER130. Because of another bug at the workaround with SelText (Undo) I really did it. Before I write a workaround around the workaround, i decide to do this. Now I have a SelCompleteText (the current, called in CopyToClipboard, maybe we should think about the name a little bit) and the old SelText. All old functions, that call SelText, used the old one and we got the expected behavior. The CodeFolding-Feature is a Plugin and care about safe the collapsed parts, if it needs. The complete "model" looks better now. Undo and Redo are in two parts (you have 2 structures in the Array), one that hold the "real" text, that was deleted (and this was made by the original code, without workarounds and such weird things) and the second new part with the folding-array-element made by TSynEditCodeFoldingPlugin.LinesDeleted. Another problem we should talk about... In "TCustomSynEdit.UndoRedoAdded(Sender: TObject);" I commented the call of DoChange. In my program I call RescanForFoldRanges in the SynMemo.OnChange()-Event, because at this time he should update the foldranges, if you change the collapse-keywords. (And this is right, if I change the word "FOR" in source code to "F OR" the current block shouldnt exist any more). The problem now wasm if I add a Undo at TSynEditCodeFoldingPlugin.LinesDeleted he called the UndoRedoAdded-Function (its looks right), this called OnChange-Event and this called RescanForFoldRanges and destroys the foldranges behind the back of LinesDeleted. If he returns to LinesDeleted he hasnt the same FoldRanges in the Array and you have the big problem. So I decided to comment this OnChange - but this is also nonsense, now he never call OnChange-Event (weird...). So I can change FOR to F OR and he dont update all foldranges... This is crap. Now I dont call Rescanforfoldranges in OnChange, only in Keyup, but this is also not enough. If I destroy a keyword with drag and drop for example he didnt updated it too. OnChange-Event is really the right place for it (And If you are dont allow to do that an other user of this SynMemo should know about this behavior...) This is no solution, but i have actually no idea, why this is the only place to call OnChange. If he add and Undo he maybe call the OnChange (because the Undo was added by changing text, so its right to call onchange...). But... I'm helpless at the moment. The third thing is CanExecuteInLine. I dont thought of removing only some chars of a collapsed line... He should prevent it like before. So I added some code again to
The fUndoList really dont belong to this place, but the function, that called CanExecute... dont call LinesDeleted, if you select only one (and collapsed) line from beginning to the end. (this is the case in if-statement). So it is a little bit "dirt" in it I think. And the last (see bug in last post)
I send a mail. Remaining things: 1. Delete a block, Undo, Redo, Undo, Redo... it crashs. 2. pressing enter at end of collapsed line, so it'll be no uncollapse but insert line after collapsed. If it's possible =) 3. Mark a collapsed line (not with Shift+END) with Shift+Down and delete, he dont delete the fold range. 4. OnChange()-issue 5. Rename the "new" SelCompleteText? 6. On some cases he draw the [...]-Symbol at wrong places. Sometimes on the next line with a linebreak-sign in gutter (but on another line that is exactly as long as the error line he draw it right at the end of the text. Sometimes I see it nearly in the middle of the line (It was a short line).. Investigate this. Это сообщение отредактировал(а) DavidCl0nel - 14.8.2006, 15:24 |
||||
|
|||||
Sep. |
|
||||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
Can you mail me compiled leak.exe?
But in SynEdit no need to do this. Look at leak.exe, when i insert space in 'begin' it removes folding range ok.
Yes, it was bad.
Never try it before =) it's an idea, but needs to test! I compile test prog with fully your synedit.pas but it dont copy contents of collapsed string to clipboard. =( I see that code is in place but something wrong. I'll look at this more completely when got some time. About bugN3 : it already was done, and now again =( I think this name ok =) Good luck in battle with bugs! --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||||
|
|||||||
DavidCl0nel |
|
||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
Copy collapsed text to Clipboard works good. (?) Hmm.
Bug 1 exists and only occur, if Rescan is called (see Bug4). Bug 2 is impossible to solve, if I dont uncollapse the block and move caret, then he moves the folding range start (but it shouldnt), because he calles LinesInserted with FromLine-1. This -1 is the problem, that he update one line to early. But on other cases (return above collapsed blocks) it is needed so. So I decided to let it be. He dont destroy something yet and thats ok. Bug 3 is solved. Bug 4 I had to call RescanForFoldRanges... but i work with an own SyntaxHighlighter for my own language and add the folding infos in my code:
Maybe I should move this into the SyntaxHighlighter-class (but I have currently no idea how to do this), that the Highlighter should care about it (the destroyed keyword isn't in the keyword-color... this he has corrected). Issue 5 is discussed and name is ok. Bug 6 exists. Do you have something like this? It occurs it you have comments after the line, like
Then he draws the [..]-Symbol in "then begin" and not after comment. I search for this.... 1+4+6 is left. I send you an email with both. In leak.exe the problem "enter on beginning" dont destroy the fold, but on some other cases with this huge file in it. Это сообщение отредактировал(а) DavidCl0nel - 15.8.2006, 14:50 |
||||
|
|||||
DavidCl0nel |
|
||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
What should the modification do? It was the Bug6. I return it to the old simple calculation and it works good. Or this also work:
Why you set in nTokenLen Comments? I dont know, what you want with Left and Right Offset of the Gutter, but it also works ok for the [...]-Signs. Maybe I take the second one. Now I look for the Bug4-OnChange-behavior. This is the last problem I think. |
||||
|
|||||
Sep. |
|
||||||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
It's all ok. I forgot to use SelCompleteText instead of SelText =) But now problem with Cut. It cuts some more lines, and Undo dont work correctly. So this was more better when you use SelText. I try to cut collapsed line in your leak.exe, and there is drop of foldranges.
It's very easy to write highlighter for any language for SynUniHighlighter. There is GUI highlighter designer too. Link to beta4 is lite version. Full version with demos can be downloaded from unihighlighter.com. So your prog will be more customizable =). Off: What program are you developing? Is there any test or beta to look?
No, i never see this bug. In compiled leak.exe that you send for me, it works ok too =) And there is very strange that there is no bug with drop of foldranges. I'll try to find it, but think that i need Delphi5 =) I use BDS2006 now.
It moves [...] sign inside open/close CF-token. You can see it only when CF-range use 'add closing keyword when collapsing' option set. So there will be no: begin end [...] but: begin [...] end
Because it is'n need here. Left position calculates from left corner, and no need to know length of closing token. Next found bugs: =( 7. pressing Enter on start of line after collapsed don't move line contents to next line, only moves cursor 8. copy collapsed line and try to paste it to start of next line after collapsed, foldrange moves one line bottom. If i paste simple text block, then all ok. --------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||||||
|
|||||||||
DavidCl0nel |
|
|||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
>>Off: What program are you developing? Is there any test or beta to look?
It is a editor for an own scripting language. No beta, it need to many settings and "environment" around it. And its only _one_ language, so i dont want to use the unihighlighter. Its only overhead, because i dont want to swap the language/highlighter. So i had to to Bug4 on another way. I have also this Cut-Problem... i will look at it. begin [...] end Ok, i dont use it like that, but if you set the sign to another position you should check, if this end-option is on. On my cases it looks like "if a <[...] then // more comment" - In the middle of the line. Thats not right and I change it to the old one and he draw it always on the end. And for this nTokenLen is needed. But there I found another bug. If I set the font size to something big (ie 16 instead of 10) the folding-gutter with the [-] is cut off a little bit (12) or completely cut (16+). I dont found the exactly position at the moment, but i will look at it. 7. ... ok... 8. Gna! |
|||
|
||||
DavidCl0nel |
|
||||||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
I changed again CanExecuteInLine. 7+8 should work now. Try it with the other problem too.
Without the -1 now:
With <= instead of only <:
Actual bug list: 1. begin [...] end. I changed it to old version. It works good at all other cases. Your case (if with endings) had to catch there and take your code. But at this place you cant get to this attribute "fAddEnding". It is in class "TFoldRegionItem" and not in the FoldRange "TSynEditFoldRange". Dont know how to get the information (if fAddEnding or not) in the paint-function. 2. If I set the font size to something big (ie 16 instead of 10) the folding-gutter with the [-] is cut off a little bit (12) or completely cut (16+). I dont found the exactly position at the moment, but i will look at it. 3. Cut-Problem: It cut the right, but deletes too much. 4. OnChange()-issue. Edit: 3:
SelCompleteText change (no idea why at the moment) the Selection. He copy the right thing, change the selection to some more lines and delete this with more. With this torkaround he reset it to origin place. But Undo didnt work at the moment... But the real solution should prevent the selectionchanging in SelCompleteText. Это сообщение отредактировал(а) DavidCl0nel - 16.8.2006, 15:20 |
||||||||
|
|||||||||
DavidCl0nel |
|
||||||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
Ok.. SelCompleteText changed the Selection, because it called GetUncollapsedStrings. This function called UncollapseAll and there you have changed some in last week. If you uncollapse you convert the selection. At a normal case this is ok, but on my SelCompleteText-case not. So I moved the workaround at beginning and end to SelCompleteText.
Another thing is the CutToClipboard-function. He doesnt mind the SelText in Undo-Buffer, so I had it to change:
For normal Undo it is necessary to Undo first the collapsed-part (add this item back into array) and then the deleted text of SelText, so I had to buffer the selection (BB/BE) and the text. The undo-function add the stored fold to the end of the array, but this wasn't ok for most cases. If I cut the first collapsed block for example and Undo it, he add this fold range at the end of the array. He shows it at the right place, but if you want to uncollapse it, it draw wrong lines in the gutter. So I had to change it, to Insert it at the right place with the line number. Then the problem is solved.
Now it works with Cut, Undo, Redo, Undo, ... But i found another bug. (gna!) If you collapse the last possible fold range and want to copy it, it crashs with RangeError in Array. It occurs with my RescanForFoldRanges-Call in OnKeyUp(). (In OnChange() I doesnt call it anymore, only there... but this cause this problem. So its ok and the current bug list is: 1. begin [...] end. I changed it to old version. It works good at all other cases. Your case (if with endings) had to catch there and take your code. But at this place you cant get to this attribute "fAddEnding". It is in class "TFoldRegionItem" and not in the FoldRange "TSynEditFoldRange". Dont know how to get the information (if fAddEnding or not) in the paint-function. 2. If I set the font size to something big (ie 16 instead of 10) the folding-gutter with the [-] is cut off a little bit (12) or completely cut (16+). I dont found the exactly position at the moment, but i will look at it. 3. Cut-Problem solved. 4. OnChange()-issue. Это сообщение отредактировал(а) DavidCl0nel - 17.8.2006, 14:41 |
||||||
|
|||||||
Sep. |
|
||||||||||||
Шустрый Профиль Группа: Участник Сообщений: 109 Регистрация: 22.7.2004 Репутация: нет Всего: 6 |
i no need to check it =) I haven't bug you describe. In this mod there are code where added 5 spaces, so [..] sign never painted over text.
This is known bug. You can't assign different fonts to gutter and textarea. Only few monospaced font are compatible, but need to find their size. It's because use of CharWidth variable when calculate gutter, but this variable holds charwidth of textarea.
I test your version from 16/08. Sorry but i stll use some fixed version of synmix from 11/08 because there are a lot of new bugs. And i don't very like idea about SelCompleteText. Because there is shortcuts like Shift+Ins that copy selection with no executing CopyToClipboard. May be you need to return some back to version 11/08 ? =) Found bugs that wasn't in 11/08: - uncommenting of
gives error 'incompatible types' for me =( - press Enter at start of line with foldrange don't move foldrange to line below - press BkSpace at start line with foldrange delete this foldrange - copy collapsed string delete its collapsed text e.t.c! so there very lot of critical bugs =( In version 11/08 i edit copy collapsed string moves selection bug like you write here, and some patch needed to my prog: MouseWhell only scroll text when cursor over textarea. I need it because in my prog need to scroll two windows by Wheel without moving focus.
And there was returned 0 when asking before paint. So rows wasn't yet calculated.
--------------------
Syn - TotalCommander lister plugin | SynTree - coders sourcebook |
||||||||||||
|
|||||||||||||
DavidCl0nel |
|
|||
Новичок Профиль Группа: Участник Сообщений: 44 Регистрация: 31.7.2006 Где: Berlin/Germany Репутация: 1 Всего: 1 |
>> no need to check it =) I haven't bug you describe. In this mod there are code where added 5 spaces, so [..] sign never painted over text
Sure it cause problems, but only in the case if you have //comment at the end of line. This token he cant see correctly and set the [...] sign in the middle of the line above the code. Thats not good and so i stay at my version, cause i didnt want this ending. >>This is known bug Bad, but ok. >>May be you need to return some back to version 11/08 ? =) Send it back to me with all your changes you made since now. But I only do it, if this was the first version with the correct Undo/Redo with copying the fold in the UndoBuffer, not set Caret and Insert the Text. This was a difficult and bad way. There are maybe many bugs, if you do it this way. But I had change some of mine things too, because some are important. SelCompleteText or not is ok, but all other (InsertLines-1..) should be ok... >>gives error 'incompatible types' for me =( What? Compile error or what you mean? On my last version I couldnt see such bugs, it works on all cases, he copy and cut the right things and so on. I cant imagine what the problem is. |
|||
|
||||
Rules and hints for the forum "SynUniHighlighter" | |
|
Hello, dear user! This is official forum for SynUniHighlighter component and unofficial forum for SynEdit, Codefolding and all related projects. Some rules for the forum: 1. Do not create new topic if exactly the same already exists. 2. Don't ask several questions in the same topic. One topic - one question. 3. If discussion changes to far from original topic context, then create a separate thread for new discussion subject. If you already registered then click here to log in. If you havent't registered yet then click here and register. You need to type username, password (twice), email (twice) and security code. Next you need go here and choose English language instead of Russian and press Enter. Some hints for enghlish-speaking users: - create new topic; - create new vote; - answer to the topic. |
0 Пользователей читают эту тему (0 Гостей и 0 Скрытых Пользователей) | |
0 Пользователей: | |
« Предыдущая тема | SynUniHighlighter and SynEdit (English Language) | Следующая тема » |
|
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности Powered by Invision Power Board(R) 1.3 © 2003 IPS, Inc. |