Модераторы: Vitalik

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> [ENG] SynEdit2.0.3stable + CodeFolding(MyStix0.31), For english users 
:(
    Опции темы
llutti
Дата 6.10.2006, 15:25 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 3
Регистрация: 21.9.2006
Где: Blumenau, Brazil

Репутация: 1
Всего: 1



Hi,

  When I copy or cut a text at the end of line, every time the #13#10 is copied too. In original synEdit this don't happend.

  In my tests, the problem it's in GetSelText,  I couldn't the exact point.

  In yours test this exists? smile 


PM MAIL   Вверх
DavidCl0nel
Дата 23.10.2006, 17:20 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 44
Регистрация: 31.7.2006
Где: Berlin/Germany

Репутация: 1
Всего: 1



Sorry for the late answer, but i went to holiday and have now not as much time like before for Syn.

Yes you are right, and also right with TCustomSynEdit.GetSelText.

Fix is
Код

      smNormal:
        //###mod copy collapsed line
        if (First = Last) then begin                                      
          ts := GetUncollapsedStrings;
          // step1: calculate total length of result string
          Inc(TotalLen, ColTo - ColFrom);
          if (Length(ts[GetRealLineNumber(First+1)-1]) < ColTo) and (FoldRangeForLine(First) <> nil) and FoldRangeForLine(First).Collapsed then begin // Selection until line end -> Also get text from foldrange
            iLineCount := 1;
            for i := GetRealLineNumber(First+1) to GetRealLineNumber(Last+2)-2 do begin
              Inc(TotalLen, Length(TrimRight(ts[i])));
              Inc(iLineCount);
            end;
            Inc(TotalLen, Length(sLineBreak) * iLineCount);
          end;

          // step2: build up result string
          SetLength(Result, TotalLen);
          P := PChar(Result);
          CopyAndForward(TrimRight(ts[GetRealLineNumber(First+1)-1]), ColFrom, ColTo - ColFrom, P);
          if (Length(ts[GetRealLineNumber(First+1)-1]) < ColTo) and (FoldRangeForLine(First) <> nil) and FoldRangeForLine(First).Collapsed then begin // Selection until line end -> Also get text from foldrange
            CopyAndForward(sLineBreak, 1, MaxInt, P);
            for i := GetRealLineNumber(First+1) to GetRealLineNumber(Last+2)-2 do begin
              CopyAndForward(TrimRight(ts[i]), 1, MaxInt, P);
              CopyAndForward(sLineBreak, 1, MaxInt, P);
            end;
          end;
          ts.Free;


The big IF-check-line had to replaced, the rest is identical. He shouldnt copy the lines (and only CRLF here) in the collapsed block, if it isnt folded in.
PM MAIL   Вверх
DavidCl0nel
Дата 7.11.2006, 13:33 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 44
Регистрация: 31.7.2006
Где: Berlin/Germany

Репутация: 1
Всего: 1



Add the Commands for Collapsing. Then you can call anywhere (i.e. MenuItem) SynMemo.CommandProcessor(ecCollapseCurrent, #0, nil);

Код
procedure TCustomSynEdit.DoOnCommandProcessed(Command: TSynEditorCommand;
  AChar: char; Data: pointer);
var
  FoldRange: TSynEditFoldRange;
  i: Integer;
begin
  //### Code Folding ###
  if CodeFolding.Enabled then
    if (fNeedToReScan)
    or (Command = ecCut)
    or (Command = ecPaste)
    or (Command = ecUndo)
    or (Command = ecRedo)
    or (((Command = ecChar) or (Command = ecDeleteLastChar)) and (IsKeywordAtCursorPos))
    or (Command = ecDeleteLine) then ReScanForFoldRanges;

    //<-->
    if FoldRange <> nil then begin
      case Command of
        ecCollapse:
          begin
            if (FoldRange <> nil) and not FoldRange.Collapsed then Collapse(FoldRange);
            CaretY := FoldRange.FromLine; //Move Cursor to begin of block
          end;

        ecUncollapse:
          begin
            if (FoldRange <> nil) and FoldRange.Collapsed then Uncollapse(FoldRange);
            CaretY := FoldRange.FromLine; //Move Cursor to begin of block
          end;

        ecCollapseAll: 
          CollapseAll;
        
        ecUncollapseAll:
          UncollapseAll;
        
        ecCollapseLevel: ;//ToDo
        ecUncollapseLevel: ;//ToDo
      
        ecCollapseCurrent: 
          begin
            if FoldRange <> nil then
              if FoldRange.Collapsed then Uncollapse(FoldRange) else Collapse(FoldRange);
            CaretY := FoldRange.FromLine; //Move Cursor to begin of block
          end;
      end;
    end;
          
  if CodeFolding.IndentGuides then begin
    case Command of
      ecCut, ecPaste, ecUndo, ecRedo, ecDeleteLastChar, ecDeleteChar:
        CheckIfAtMatchingKeywords;
      ecUp, ecDown, ecPageUp, ecPageDown, ecPageTop, ecPageBottom,
      ecEditorTop, ecEditorBottom, ecGotoXY:
        RepaintGuides;  //###mod highlight current IndentGuide
    end;
  end;
  //### End Code Folding ###
 
  if Assigned(fOnCommandProcessed) then
    fOnCommandProcessed(Self, Command, AChar, Data);
end;


Это сообщение отредактировал(а) DavidCl0nel - 7.11.2006, 14:08
PM MAIL   Вверх
Alienizer
Дата 3.12.2006, 10:40 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 4
Регистрация: 3.12.2006

Репутация: нет
Всего: нет



Hello,

I just downloaded SynEdit v2.03 but I don't know where I can download the Code Folding for it? Can someone please tell me where I can download Code Folding for SynEdit v2.03? Thank you.
PM MAIL   Вверх
llutti
Дата 3.12.2006, 15:49 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 3
Регистрация: 21.9.2006
Где: Blumenau, Brazil

Репутация: 1
Всего: 1



Hi,

  You will find the link in http://sepa.spb.ru/?syn_eng.

regards,

Luciano
PM MAIL   Вверх
Alienizer
Дата 4.12.2006, 02:44 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 4
Регистрация: 3.12.2006

Репутация: нет
Всего: нет



Thank you Luciano. I appreciate your help.
PM MAIL   Вверх
Alienizer
Дата 4.12.2006, 06:10 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 4
Регистрация: 3.12.2006

Репутация: нет
Всего: нет



Maybe I'm very stupid but, I can't get the CodeFolding to work! I set it enabled, a black vert line shows next to the gutter, but that's it. I've set the key assignment for acCollapse etc. still no go. No documentations and no examples on how it works!

Can anyone please help me? Just need a hint, I know how to code so I don't need a whole big example or anything. Thank you.
PM MAIL   Вверх
lookfar
Дата 13.12.2006, 08:01 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 6
Регистрация: 1.12.2006

Репутация: нет
Всего: нет



Цитата(Alienizer @ 4.12.2006,  06:10)
Maybe I'm very stupid but, I can't get the CodeFolding to work! I set it enabled, a black vert line shows next to the gutter, but that's it. I've set the key assignment for acCollapse etc. still no go. No documentations and no examples on how it works!

Can anyone please help me? Just need a hint, I know how to code so I don't need a whole big example or anything. Thank you.




in order to make the "Light" demo from Unihighlighter, in the uses:
Код

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, ComCtrls, SynEditPrint, SynExportRTF, SynEditExport,
  SynExportHTML, SynEdit, SynEditHighlighter, SynUniHighlighter,
  SynEditTypes, ToolWin, XPMan, ImgList, ActnList, SynEditTextBuffer,
  SynEditKeyCmds,{$IFDEF CODEFOLDING}SynEditCodeFolding, SynEditMiscClasses, {$ENDIF} IniFiles;


In the "LoadFile" procedure
Код

{$IFDEF CODEFOLDING}
  Edit.Gutter.Width := 16;
  Edit.CodeFolding.Enabled := True;
  Edit.CodeFolding.CollapsedCodeHint := True;
  Edit.CodeFolding.CollapsingMarkStyle := msSquare;
  Edit.CodeFolding.FolderBarColor := clScrollBar;
  Edit.CodeFolding.FolderBarLinesColor := clBlack;
  Edit.InitCodeFolding();
  {$ENDIF}


check my post here:
http://forum.vingrad.ru/topic-124651/kw-bueler.html






PM MAIL   Вверх
DavidCl0nel
Дата 13.12.2006, 11:20 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 44
Регистрация: 31.7.2006
Где: Berlin/Germany

Репутация: 1
Всего: 1



Without the unihighlighter you should use it in such way:
Код

  With SynMemo.CodeFolding do begin
    Enabled := True;
    IndentGuides := True;
    CollapsedCodeHint := True;
    FolderBarColor := clBtnFace;
    HighlighterFoldRegions := False; //<-- this is important, because usually there is no folding info in the common highlighters, if you dont youe unihighlighter, so you had to set this option and give the codefolding keywords some lines later
    CaseSensitive := True;

    //Keywords
    FoldRegions.Add(rtKeyWord, False, False, True, 'If', 'EndIf');
    FoldRegions.Add(rtKeyWord, False, False, True, 'Case', 'EndCase');
    //...more keywords

  end;
  SynMemo.InitCodeFolding;

PM MAIL   Вверх
Alienizer
Дата 29.1.2007, 10:41 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 4
Регистрация: 3.12.2006

Репутация: нет
Всего: нет



Thank you this worked, but, there is another problem. When lines are folded and editing is performed, un-folding the lines makes the folding lines in the gutter all at the wrong places, and it will no longer fold correctly! Also, if the fold region is not smart because if a string literal contain the same word as the keyword, for example "endif" the folding is no longer correct. Is it better to use HighlighterFoldRegions := True; and modify the Highlighter to make the proper folding regions?
PM MAIL   Вверх
pyscripter
Дата 14.2.2007, 02:31 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 2
Регистрация: 14.2.2007

Репутация: нет
Всего: нет



FYI, there is another highly enhanced version of Synedit+Mystix around which unfortunately still contains many of the bugs of the original Mystix code.  It is called SynEditStudio and is available from http://www.cnzjw.net/qiutian/blog/index.asp
Unfortunately the demo is in chinese.
PM MAIL   Вверх
pyscripter
Дата 16.2.2007, 14:44 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 2
Регистрация: 14.2.2007

Репутация: нет
Всего: нет



You can download SynEditStudio v1.5.4 from http://pyscripter.googlepages.com/SynEditStudio.rar
 
Also I had suggested to the author the following: 
* merge the bugfixes from SynMix into his code 
* release a version of his code with English resources 
* apply his enhancements to the unicode version of Synedit 
 
and he said that he will try and do that. 
PM MAIL   Вверх
benne08
Дата 31.3.2009, 21:11 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 1
Регистрация: 31.3.2009

Репутация: нет
Всего: нет



Цитата(DavidCl0nel @  1.8.2006,  10:39 Найти цитируемый пост)
After further investigation I found the problem for the crash.

In "ReScanForFoldRanges"

??????
// And finally we have to free memory and repaint the control
//fAllFoldRanges.Free;
fAllFoldRanges := TemporaryAllFoldRanges;


Hello,

I hope its okay to post here, because this thread seems not to be alive, but I don't understand the other, non-english, boards :-/

So I've a question: I'm using the Codefolding from the (I think) latest SynMix and I recognized a large memory-leak - my program allocates more and more memory (100rds of MB after a few time) if I activate the CodeFolding. 
If I undo this change you see above, everything's fine, but I get some errors... What can I do to fix this leak and to prevent the errors?

Thanks for your help and Best Regards!
PM MAIL   Вверх
Ответ в темуСоздание новой темы Создание опроса
Rules and hints for the forum "SynUniHighlighter"
Vit
Vitalik

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.


With regards, Vit, Vitalik.

 
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | SynUniHighlighter and SynEdit (English Language) | Следующая тема »


 




[ Время генерации скрипта: 0.1355 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.