Git Product home page Git Product logo

synedit's People

Contributors

borisu7 avatar dm-e avatar jafi-cz avatar jimmckeeth avatar mshark67 avatar pashagolub avatar pyscripter avatar romankassebaum avatar vhanla avatar vincentparrett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

synedit's Issues

Could not find SynMemo.pas in the "Source" directory ?!

Hi,

Package build (for RIO) needs "SynMemo.pas" as found in the project file and it does not exists, I check the master branch could not find in this "TurboPack/SynEdit" project, is there any mixed/confused project files with any other SynEdit projects like "SynEdit/SynEdit" because that file exists in that project ??

SynHighlighterCpp.pas Only Supports C99?

The SynHighlighterCpp.pas is only C99(?) or at least an older version. Additionally it seems like it has a number of BCC32 keywords.

I have one that is in theory C++20 (unconfirmed) but missing the Borland/Embarcadero keywords.
https://github.com/Embarcadero/Dev-Cpp/blob/master/Source/VCL/SynEdit/Source/SynHighlighterCpp.pas

Is the solution to just have a separate C++20 class without the Borland keywords or should there be 2 classes or just a new super class that is Borland/Embarcadero keywords + C++20?

MDI Application

When using SynEdit in MDI application with TSynCompletentionProposal, when it unfocuses, it sends focus to the previous MDI form, but not to the parent control, which is quite annoying with floating controls/forms

Nevertheless, thanks for so useful project

Problem in TSynCssSyn with some CSS code

Hello to all,

First of all, thanks very much for this SynEdit package for Delphi. I am using Delphi 10.4 and the latest version of this SynEdit package (version 1.5 / 21 Sep 2020) and found a problem while using the TSynCssSyn as the highlighter for SynEdit.

The problem causes that the app freezes without any kind of information nor error.

In order to reproduce the error, just place a SynEdit component in a TForm and set a TSynCssSyn highlighter for the SynEdit component. Then just try to copy this CSS code inside the SynEdit component:

[class^="icon-"], [class*=" icon-"] { }

Since the above code freezes the app, I recommend you to compile an app and try it in that app, instead of in the Delphi IDE, because in this last case the Delphi IDE freezes too.

Thanks very much in advance for any kind of help.

Per Monitor DPI awareness

Currently SynEdit can be used in System DPI aware applications. Using features introduced in Delphi Rio, it should be relatively straightforward to make the component per Monitor DPI aware.

Highlighters with list of keywords, e.g. UnixShellScript

Hello
you replace keyword definition in SynHighlighterXXX from array of UnicodeString to array of string, but you let WideCompareText()/WideCompareStr() in IsKeyword() function

In my country and other slavic countries is "ch" taken as one char and alphabetically is placed behind the "h" char in ANSI rules for sorting and comparing.
It means when you have string sorted, order isn't
c, ca, ... cg, ch, ci, ... d
but "ch" is behind the "h" char

The problem is caused by array of string vs WideCompareStr() in IsKeyword() function
Solution for correct string handling is:
array of UnicodeString + WideCompareStr()
or
array of string + CompareStr()

See the attached acreenshot, it's copy of keywords from SynHighlighterUnixShellScript.pas and highlighted in Unix shell script highlighter:
Screenshot

Can't install in C++Builder 10.4 using TwineCompile

The SynEdit component fails when trying to install on C++ Builder 10.4 (with all updates), using TwineCompile

image

Trying to build and install using the code from Github fails too:

image

UPDATE: By disabling TwineCompile, it seems to install correctly.

Range check error in ShrinkAtWideGlyphs

I hit this while testing a file with the line:
영어 명
and just moving the caret from the beginning of the line and then moving forward causes it. It looks like:

while (S[i] = FillerChar) do
  inc(i);

needs a check for Length on i.

-Mark

Move/Copy Line(s) Up/Down commands

Move/Copy Line(s) Up/Down commands as in VS Code
Move Line(s) Up: Alt+Up
Move Line(s) Down: Alt+Down
Copy Line(s) Up: Shft+Alt+Up
Copy Line(s) Down: Shft+Alt+Down

Replace SynRegExpr with built-in RegularExpressions

The Delphi PCRE-based built-in regular expression engine is much faster than the SynRexExpr unit and offers a more complete implementation of regular expressions. Removing SynRegExpr also reduces the number of units that need to be maintained.

sqlOracle Dialect bug

Try setting the dialect to sqlOracle and set some colors for below properies
OracleCommentKW: string = 'REM,REMA,REMAR,REMARK';
OracleConsoleOutputKW: string = 'PRO,PROM,PROMP,PROMPT';

for example:
select pro.description, users.id
from some_table pro, users_table users

The bold text is regarded as an OracleConsoleOutput....and thats just wrong
The same can be produced for OracleCommentKW
sqlOracleHighlighterBug

Blinking

Can you make so that the component does not blink when I selecting text or moving the cursor
Thank you

Incorrect height of TSynCompletionProposal

Hello,
Thank you so much for trying to fix the problem. I’ve updated my SynEdit sources with your new version of the TSynCompletionProposal. But I’ve noticed that the main bug is still there. If the proposal appears and the user changes the size of it manually, the size of the proposal will be restored correctly, even after appearing multiple times. But if the user doesn’t change the size of it, the proposal popup will increase in height each time it is opened. It does so until the height of that proposal is as big as the size of the monitor. Even if the user changes the size manually, after restarting the app, the behavior is back to default, and the height increases as described each time the proposal is opened.

I would be very grateful, when you try to fix this problem finally.
Best greetings from Germany :)

Code not working

The code for SynGen as provided yields an error message when opening the dproj or dpr file with Embarcadero's Delphi XE7. The error message is "Illegal character in line 44 column 91". Can someone repair that?

brgs,
gerhard

Better Unicode Handling

There are four major issues with Unicode handling shown below:

A) Wide glyphs (e.g. Chinese characters) taking more space than other characters
爾雅爾雅爾雅爾雅爾雅爾雅

B) Surrogates pairs (two widechars correspond to one glyph)
𝄞 UTF-16 Encoding: 0xD834 0xDD1E

C) Combining characters (more than one Widechars shown as one glyph)
Åström ḱṷṓn
Precomposed vrs Decomposed
ḱṷṓn (U+1E31 U+1E77 U+1E53 U+006E)
ḱṷṓn (U+006B U+0301 U+0075 U+032D U+006F U+0304 U+0301 U+006E)
emojis 🤷🏽‍♀️

D) Bidirectional text
e.g. HelloيُساوِيWorld

SynEdit only deals with the first one but in a peculiar way (ExpandAtWideGlyphs)

SQL Highlighter for Mysql

Hello,
Thanks a lot for your work with SynEdit. It's awesome !

  1. I was looking for an example of highlighter for writing a sql parser, but I didn't find any lexer in your source dir.
  2. I noticed that in the sql highlighter the char "#" is not considered as comment but as "unknown". Could you send me the sql lexer as an example for me ?
    See: https://dev.mysql.com/doc/refman/5.7/en/comments.html
    Thanks in advance.

Getit package manager don't add Synedits Source folder to library path

After installing Synedit using the Getit package manager, and creating a simple project (a 32bit VCL forma application), and dropping a synedit control on the main form, I get a linker error > "can't open synedit.res"

Adding the source folder, which is on my machine (C:\Users\totte\Documents\Embarcadero\Studio\21.0\CatalogRepository\SynEdit-1.5cb-Sydney\Source) fixes that error.

SyneditTypes.pas - change of the white space chars declaration

Hello
Please consider change of special chars declaration from contants to assignable constants:

  SynTabGlyph: WideChar = #$2192;       //'->' 
  SynSoftBreakGlyph: WideChar = #$00AC; //'¬'
  SynLineBreakGlyph: WideChar = #$00B6; //'¶' 
  SynSpaceGlyph: WideChar = #$2219;     //'·' 

It has no influence of the existing code, but allows you to change glyph chars from "outside"

Char #0 in file causes infinite loop when loading

When file contains char #0 it casues infinite loop, generate milions of empty lines and ends with end of memory exception

Unit SyneditTextBuffer
procedure TSynEditStringList.SetTextAndFileFormat
problematic code is on the line 877:

        while not (Ord(P^) in [0, $A, $D]) and (P^ <> WideLineSeparator) do
        begin
          Inc(P);
        end;

It never increase "P" and caused infinite loop

Suggestion:
exclude #0 char from the file content
another solution: replace #0 for space

Bug in height calculation

Good morning,
In our software projects we are using your TSynCompletionProposal component for auto syntax completion. After using that for a while, we determined a little bug in this component. Whenever the popup window of the TSynCompletionProposal component appears (through a keyboard shortcut), the height of this component is increased. After appearing five to six times, this component is as high as the screen.

We’ve tried to solve the problem by developing our own solution, but didn’t have any real success. After hours of debugging, we guess that the CanResize, Paint and AdjustMetrics methods are responsible for that behavior.

So I kindly ask you to fix this problem or provide us with a suitable solution.
Best regards from Germany 😊

Known printing issue quick fix

There is a known problem in SynEditPrint where wrapped lines aren't properly handled across page boundaries (mentioned in the "Known issues" section of the source code.) I just wanted to mention my own quick and dirty fix for the issue as this seems at least better than the current state. I cache a copy of the original lines and use it as a source to hard wrap the SynEditPrint.lines stringlist each time the page width could change. This actually works fairly well but it's obviously not elegant and increases memory usage.

Memory leak in TSynSQLSyn

In TSynSQLSyn.InitializeKeywordLists (SynHighlighterSQL.pas) there is a call to fKeywords.Clear.

This should be changed to fKeywords.DeleteEntries to make sure the existing hashes are destroyed.

Minor Issue with TSynEditStringList.LoadFromStream

Currently TSynEditStringList overrides the "no encoding" version of LoadFromStream. This causes an issue because if you call .LoadFromStream(Stream, Encoding); the overridden version will never be called and so FStreaming will not be set to true during the load. The fix is just to override this one instead:

procedure LoadFromStream(Stream: TStream; Encoding: TEncoding); override;

I was attempting to do a pull request for this, I know it's obviously very minor, but I'm hoping to learn so I can do more in the future.

Synedit - TCustomSynedit.Destroy

Hello
Is there any reason why inherited Destroy call is somewhere in the begining of Destroy method? In my opinion, I would move it to the end of TCustomSynedit.Destroy

The second thing in the Destroy
Quite often I get access violation from destroying Synedit component caused by releasing CodeFolding.
Maybe it's caused by MultiHighlighter, where some highlighters are codefolding ready (PHP) and some not.

Suggestion:
on the end of TCustomSynedit.Destroy change releasing of code folding part to:

//++ CodeFolding
  if fCodeFolding <> nil then fCodeFolding.Free;   
  if fAllFoldRanges <> nil then fAllFoldRanges.Free;
//-- CodeFolding

it looks like it helps and it doesn't cause any problems.

CaseSensivity

Please please add case sensivity, i can't port my project without it, i'd have to change language features. I have a 630 lines long msg file with lots of tokens.

Synedit for 64bit C++ builder (10.4) don't link

After installing Synedit using the Getit package manager, and creating a simple project (a 64bit VCL forms application), and dropping a synedit control on the main form, I get a linker error > "can't open SynEditCR.a"

Searching my machine, there is no SynEditCR.a anywhere..

SynUnicode.GetEncoding bug

Bug at least for Delphi 10.4.2

Unit: SynUnicode
function GetEncoding(Stream: TStream; out WithBOM: Boolean): TEncoding;
line 405:
there is necessary to set length for PreableBuffer else it ends with Access violation:
Setlength(Buffer, Length(Preamble)); //Fiala
before the:
Stream.Read(Buffer, 0, Length(Preamble));

the same few lines bellow

TopLine and paintlock

Anytime TopLine is changed it causes a full repaint regardless of paintlock. This may be as designed since paintlock is always > 0 during any caret movement/ecCommand handling. However it does mean that TSynEdit.BeginUpdate and TSynEdit.EndUpdate don't fully work. I was a bit surprised that PaintLock doesn't actually stop any paint handling (maybe it's just missing or more likely it's a complexity beyond my knowledge.) My workaround to these problems is to just use
SendMessage(Handle, WM_SETREDRAW, 0, 0);
and
SendMessage(Handle, WM_SETREDRAW, 1, 0); (followed by an invalidate)

In my own TSynEdit helper class..

Note that there's also a minor issue with SetTopLine. When eoScrollPastEof is not set, it uses fLinesInWindow to calculate the max top line allowed, but that value appears to not be accurate and so some commands (like ecUpperCase) when scrolled to the bottom will shift the TopLine even though it's not needed.

Thanks as always!

Synedit - Word at cursor - proposal

Word at cursor should return word even cursor is just behind the word. Current behavior:
|word - true
wo|rd - true
word| - false

I suggest to make modification of this behavior
Unit Synedit.PAS

function TCustomSynEdit.GetWordAtRowCol(XY: TBufferCoord): string;
var
  Line: string;
  Len, Start, Stop: Integer;
begin
  Result := '';
  if (XY.Line >= 1) and (XY.Line <= Lines.Count) then
  begin
    Line := Lines[XY.Line - 1];
    Len := Length(Line);
    { Len + 1 is for case when word is the last word and cursor is behind it }
    if (Len > 0) and
       ((XY.Char >= 1) and (XY.Char <= Len + 1)) and
       (IsIdentChar(Line[XY.Char]) or IsIdentChar(Line[XY.Char-1])) then        //Fiala
    begin
       if IsIdentChar(Line[XY.Char]) then                                       //Fiala
         Start := XY.Char
       else
         Start := XY.Char - 1;
       while (Start > 1) and IsIdentChar(Line[Start - 1]) do
          Dec(Start);

       Stop := XY.Char;                                                         //Fiala
       while (Stop <= Len + 1) and IsIdentChar(Line[Stop]) do
          Inc(Stop);

       Result := Copy(Line, Start, Stop - Start);
    end;
  end;
end;

Current code will not build in Delphi 10.2.3

Cannot build in Delphi 10.2.3. Found that the issues is resolved with this change:
In SynEdit\Source\SynCompletionProposal.pas:
function GetCurrentPPI: Integer; {override;}
My searching shows that there is no ancestor to override.

SyneditRegExpSearch.pas - empty patterns usage

As default is there set option roNotEmpty. It disallows you use regular expression to put char on the begin or end of each line. When you remove this option, it has no influence of functionality, but allows you to use "empty" patterns

Example text:

aa

aa

Search: ^
Replace: {

Support OLE Drag & Drop

Allow transfer of text between the component and other Windows applications by drag & drop.

Memory Leak on TSynSqlSyn

At procedure TSynSQLSyn.InitializeKeywordLists changes fKeywords.Clear to fKeywords.DeleteEntries.

SyneditHighlighter - TSynCustomHighlighter.IsIdentChar()

Acording to last change I want to suggest change:
SyneditHighlighter.pas, line 1073

Current code:

function TSynCustomHighlighter.IsIdentChar(AChar: WideChar): Boolean;
begin
  case AChar of
    '_', '0'..'9', 'A'..'Z', 'a'..'z':
      Result := True;
    else
      Result := False;
  end;
  Result := Result or CharInSet(AChar, FAdditionalIdentChars);
  Result := Result and not IsWordBreakChar(AChar);
end;

Suggested change:

function TSynCustomHighlighter.IsIdentChar(AChar: WideChar): Boolean;
begin
  Result := IsCharAlphaNumeric(AChar) or CharInSet(AChar, ['_', '-']);          
  Result := Result or CharInSet(AChar, FAdditionalIdentChars);
  Result := Result and not IsWordBreakChar(AChar);
end;

Maybe you find it strange, but some programming languages allows you to use accented chars in function names e.t.c.

SyneditTextBuffer - UNDO bug

After undoing all changes Editor should return state non modified (situation when file is open, not in situation when you edit, save, continue edit and call undo).
It doestn't matter if group undo is enabled or disabled

Simulation:
Open any file
Click somewhere behind the last char (this is important)
Write any letter
call UNDO

Synedit should return Editor.Modified = False, but it doesn't.

Unit SynEditTextBuffer
Function TSynEditUndoList.GetInitialState returns wrong information.

But after you call REDO and UNDO, all is OK.

DragDrop editing - COPYMODE

Hello
Drag/Drop of selected text with CTRL doesn't work
for Drag editing COPY mode everything is prepared, only the CTRL is necessary to add into Shift check

procedure TCustomSynEdit.MouseDown(Button: TMouseButton; Shift: TShiftState;
change:
if (Button = mbLeft) and ((Shift + [ssDouble]) = [ssLeft, ssDouble]) then
to
if (Button = mbLeft) and ((Shift + [ssDouble]) = [ssLeft, ssCtrl, ssDouble]) then

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.