synedit / synedit Goto Github PK
View Code? Open in Web Editor NEWSynEdit main project
SynEdit main project
However, it appears the most current version is up on sourceforge because there is an XE5 project there, and not one here in GitHub. What is the roadmap of this project? Has it been fully migrated over to github? I tried the sourceforge version and could not get some of the demos to compile. Thanks.
The border flickers while scolling or resizing.
Steps:
Expected: no flicker
Actual: the border around the edit flickers
This issue can be fixed by adding WS_EX_COMPOSITE to ExStyle in TCustomSynEdit.CreateParams if the OS is XP or higher. I will prepare a pull request unless anyone else is faster.
When modified lines are marked as saved, they'll never switch to modified again when modifying prevously saved lines. In my case, they stay green.
The issue seems to be the Flags-Field. It can contain both Modified and Saved. When a line is set to modified, sfModified is included. but sfSaved might still be present
Just downloaded the current version and installed it into my XE and opened an existing project where i use SynEdit. Compiles and runs fine. However at designtime after the first click on the SynEdit, it becomes invisible and is only visible when i drag the SynEdit across the form.
I don't know but maybe this has something to do with the Paintlock?
Hi,
As it seems that this is an official fork of Synedit, i'd like to ask if you are interested in adding support for my Delphinus Packagemanager. It runs from within the IDE like GetIt but works from Delphi XE and up. Delphinus already includes some well known packages like Mormot, Spring4D and OmniThreadLibrary.
To add Synedit, it is required to add 2 files (One holds general info about the package, the other is the installation script) to the Repository and a Keyword to your readme. The package is automatically detected by Delphinus-Clients without any other required steps.
You can find more information here:
https://github.com/Memnarch/Delphinus/wiki
if you have any questions, ask me
PS: CWBudde already added some of his projects to Delphinus. I have seen him authoring merge requests here.
Today i changed the Backgroundcolor of the SynCompletionProposal. However a one line rect around was left with clBtnFace. Looking into SynCompletionProposal.pas
[1657]Canvas.Pen.Color := clBtnFace;
This is hardcoded. I used a dark color like in VS2015 DarkTheme for the Background and the rectangle is way to visible. However i can not change it by using a property.
EDIT: Ofcourse i can use OnPaintItem and do a FillRect first. But this seems to be avoidable overdraw.
DCC errors when compile revision aff86da with Delphi XE.
[DCC Error] SynHighlighterJava.pas(876): E2011 Low bound exceeds high bound
[DCC Error] SynHighlighterJava.pas(876): E2011 Low bound exceeds high bound
[DCC Error] SynHighlighterJava.pas(981): E2011 Low bound exceeds high bound
[DCC Error] SynHighlighterJava.pas(981): E2011 Low bound exceeds high bound
Error disappears when replace line 981 text:
'_', '$', '0'..'9', 'a'..'z', 'A'..'Z', 'Ą'..'Ö', 'Ų'..'ö', 'ų'..'˙':
with
'_', '$', '0'..'9', 'a'..'z', 'A'..'Z':
Stripping out the 'Ą'..'Ö', 'Ų'..'ö', 'ų'..'˙' block
Hello,
We are using SynEdit in x64 projects and all is fine in most configurations.
However, if the project already has consumed more than 4G of memory before the first SQL highlighter is used, we get an Out of bounds exception on this line:
https://github.com/SynEdit/SynEdit/blob/master/Source/SynHighlighterSQL.pas#L1220
Debugging it reveals that fToIdent
is nil
and so we are trying to to put a pointer value into Result
which is an integer
.
And because the pointer is above 4G, this overflows and triggers the exception.
To fix this, I have stored the value Str
had at the beginning of the function into a local variable called StrStart
and have changed the problematic line to this code:
if fToIdent <> nil then
fStringLen := Str - fToIdent
else
fStringLen := Str - StrStart;
It no longer overflows and I believe the value in fStringLen
is now correct.
I have not checked if other highlighters have the same problem.
base must be exactly overlapping with folder string to remove it
I don't know why but the hindi languages are not displayed correctly e.g paste the following into the edit field.
सिग्नल डिजिटल / एनालॉग
the result will have very big gabs and if you highlight chars they swap around.
arabic/chinese chars work.
Does anyone have a solution for this?
The latest commit 593bfb2 does change TCustomSynEdit.GetWordAtRowCol. That does use Low/High for the string type and that is not compatible with XE2 and lower. I will prepare a pull request unless anyone else is faster.
if we use a TSynCompletionProposal inside a modal dialog, which isn't the mainform the dialog is hidden, if the synedit show's the proposal list.
inside procedure TSynBaseCompletionProposal.ExecuteEx( ... ) we changed:
{$IFDEF SYN_DELPHI_XE_UP}
if Assigned(Application.MainForm) then
begin
Form.PopupMode := pmExplicit;
Form.PopupParent := Application.MainForm;
end
else
begin
Form.PopupMode := pmNone;
Form.FormStyle := fsStayOnTop;
end;
{$ELSE}
Form.FormStyle := fsStayOnTop;
{$ENDIF}
into this .. that fixed the issue for us:
var f: TCustomForm;
{$IFDEF SYN_DELPHI_XE_UP}
f := GetParentForm(Form.CurrentEditor);
if Assigned(f) then
begin
Form.PopupMode := pmExplicit;
Form.PopupParent := f;
end
else
begin
Form.PopupMode := pmNone;
Form.FormStyle := fsStayOnTop;
end;
{$ELSE}
Form.FormStyle := fsStayOnTop;
{$ENDIF}
Users of HeidiSQL are experiencing slowness when HeidiSQL adds more than ~1000 strings to a TSynSQLSyn.TableNames. On my Core I7 4500U CPU, 1000 strings need roughly 1 second. A normal TStringList would work much faster, but SynEdit does something in the back with this list, which makes it so slow.
It also does not seem to have an effect if I wrap that in a BeginUpdate/EndUpdate block.
See the latest report from a user: http://www.heidisql.com/forum.php?t=18945#p21272
Using SetWindowLong i removed the default border from CompletionProposal and use
BorderWidth := 1
Instead to create a VS2015 like popup. However deep down theere is a Hardcoded Heightcalculation which will no longer work.
SynCompletionProposal.pas
[...]
tmpX := x;
tmpY := y;
tmpWidth := 0;
tmpHeight := 0;
case Kind of
ctCode:
begin
BorderWidth :=
{$IFDEF SYN_CLX}
6; // TODO: I don't know how to retrieve the border width in CLX
{$ELSE}
2 \* GetSystemMetrics(SM_CYSIZEFRAME);
{$ENDIF}
tmpWidth := FWidth;
tmpHeight := Form.FHeightBuffer + Form.FEffectiveItemHeight * FNbLinesInWindow + BorderWidth;
end;
This needs some kind of customization. Maybe a more basic BaseClass of CompletionProposal to allow more custom stuff?
In TDBSynEdit
it is assumed that any BLOB field is always encoded in TEncoding.Default
https://github.com/SynEdit/SynEdit/blob/master/Source/SynDBEdit.pas#L365
https://github.com/SynEdit/SynEdit/blob/master/Source/SynDBEdit.pas#L433
For TWideMemo
fields however this doesn't work, because the encoding of the stream is UTF-16.
I have changed the methods to always use AsString
which is kind of a sledgehammer solution, but it seems to work well so far.
procedure TCustomDBSynEdit.LoadMemo;
begin
try
Lines.BeginUpdate;
Lines.Text := FDataLink.Field.AsString;
Lines.EndUpdate;
Modified := False;
ClearUndo;
except
// Memo too large
on E: EInvalidOperation do
Lines.Text := Format('(%s)', [E.Message]);
end;
EditingChange(Self);
end;
procedure TCustomDBSynEdit.UpdateData(Sender: TObject);
begin
FDataLink.Field.AsString := Lines.Text;
end;
What we can expect in future versions of SynEdit?
CodeFolding ?
SpellinCheck ?
I'm having issues using the TSynEdit
control, specifically when the following conditions apply:
WordWrap
is enabledeoTrimTrailingSpaces
is enabledeoScrollPastEol
is disabledWhat happens is while I'm typing, when the cursor reaches the end of the line (thus needs to wrap), and I'm typing a space at the same time (followed by more text), it completely drops the space I typed at that spot, and merges words I had on either side.
For example, when I type This is a test
, it might end up like This is atest.
, if a test
was being typed at the end of a line.
Here's an exact copy of problematic control:
object Editor: TSynEdit
Left = 0
Top = 37
Width = 763
Height = 321
Align = alTop
Anchors = [akLeft, akTop, akRight, akBottom]
ActiveLineColor = clInfoBk
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'Courier New'
Font.Style = []
TabOrder = 1
BorderStyle = bsNone
Gutter.AutoSize = True
Gutter.Font.Charset = DEFAULT_CHARSET
Gutter.Font.Color = clWindowText
Gutter.Font.Height = -11
Gutter.Font.Name = 'Courier New'
Gutter.Font.Style = []
Gutter.ShowLineNumbers = True
Gutter.Gradient = True
Gutter.GradientSteps = 42
Options = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, eoGroupUndo, eoKeepCaretX, eoShowScrollHint, eoSmartTabDelete, eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces]
RightEdge = 0
TabWidth = 2
WantTabs = True
WordWrap = True
WordWrapGlyph.Visible = False
OnChange = EditorChange
FontSmoothing = fsmClearType
ExplicitTop = 43
end
This occurs both before and after updating to the latest source just last night.
When i just hit enter to add new lines, the state of a new line is not set to modified. That might be intentional. But from editors like Delphi-IDE, at least i am, used to see modifications on every changed/added line. WHen i write modifications for the SynEdit, i usually implement a second LineBuffer(Hook the original events) to track extra information. In this very old project(the modification is similar to a current one here at work) i set the modificationstate to newly added lines, too:
https://github.com/Memnarch/D16IDE/blob/master/IDEEdit.pas#L213
Steps
Expected: highlighted results show "begin"
Actual: highlighted results show "BEGIN"
Is it possible for FMX?
What time?
Hi,
Can someone direct me to where in the code, the Highlighter is queried to obtain the font styles (colors) for the current piece of text to paint?
I would like to intercept this step to add some handling for VCL Styles...
Thanks
Using demo program TestPP, the preview window display incorrectly spaced characters depending on the window size.
To reproduce, run the sample, load a Delphi source file (for example DPageSetup.pas which is part of the demo) and display the print preview. Then unmaximize the preview window, right click to select "Page width" and resize the window slowly, watching how the preview adjust itself. For some widths, you see the preview with incorrect character spacing (Top view in attached screen capture) and for some other widths, you see correct character spacing (Bottom view in the capture). You can see on the captures that they only differ by a few pixel in their width. It is expected that the preview is correctly shown for all preview window size.
By the way, the popup menu is disconnected from the preview component. It had to reconnect it in the object inspector in order to be able to use it.
I have downloaded latest version of SynEdit from GitHub and compiled everything using 10.1 Berlin Version 24.0.25048.9432. The computer was running Win7 fully updated. Same result on another Win7 computer.
I've tried to update my old SynEdit sources from this repositary and found that some of the sources are UTF-8 encoded. Delphi 7 can't read them properly and on the sources like this:
it gives
[Error] SynEditHighlighter.pas(1163): Incompatible types: 'WideChar' and 'String'
Is Delphi 7 is not supported?
The bad thing is that I don't even know what chars are intended to be there. :(
This's a vary cool project, hope to increase support for kotlin language :)
// Code Folding {$IFDEF SYN_DELPHI_2009_UP} {$DEFINE SYN_CodeFolding} {$ENDIF}
Since D2009?
Unknown namespaces in Delphi XE.
Changed to and so it is OK:
uses
Graphics,
Types,
Classes,
SysUtils,
Math,
Generics.Defaults,
Generics.Collections,
SynEditHighlighter;
but then:
SynEditCodeFolding.pas(355) Fehler: E2003 Undeklarierter Bezeichner: 'List'
SynEditCodeFolding.pas(357) Fehler: E2003 Undeklarierter Bezeichner: 'FromLine'
SynEditCodeFolding.pas(358) Fehler: E2003 Undeklarierter Bezeichner: 'ToLine'
SynEditCodeFolding.pas(359) Fehler: E2003 Undeklarierter Bezeichner: 'Collapsed'
SynEditCodeFolding.pas(359) Fehler: E2015 Operator ist auf diesen Operandentyp nicht anwendbar
SynEditCodeFolding.pas(377) Fehler: E2003 Undeklarierter Bezeichner: 'List'
SynEditCodeFolding.pas(378) Fehler: E2003 Undeklarierter Bezeichner: 'ToLine'
SynEditCodeFolding.pas(384) Fehler: E2003 Undeklarierter Bezeichner: 'FromLine'
SynEditCodeFolding.pas(408) Fehler: E2003 Undeklarierter Bezeichner: 'List'
...
Greek characters are not exported correct in RTF export
solution:
function ReplaceReservedChar in SynExportRTF.pas could be changed as follows:
function TSynExporterRTF.ReplaceReservedChar(AChar: WideChar): string;
begin
Result := '';
case AChar of
'\': Result := '\';
'{': Result := '{';
'}': Result := '}';
end;
if Ord(AChar) > 127 then
begin
if Ord(AChar) <= 255 then
Result := '\''' + LowerCase(IntToHex(Ord(AChar), 2))
else
// SmallInt type-cast is necessary because RTF
// uses signed 16-Bit Integer for Unicode characters
Result := '\u' + IntToStr(SmallInt(AChar)) + '?';
end;
end;
Right now this project seems to be in a fluid development state. However i'd appreciate releases to see which states are considered stable to avoid "In Development" states in Production code.
Is it possible to implement vertical selection with Shift + Alt + Up Arrow or Down Arrow? I would like something similar to the vertical selection of Notepad ++.
Thank you.
Is possible to create highlighter for MarkDown?
SynEdit_D.dpk
-{$R '..\Source\SynEditReg.dcr'}
+{$R '....\Source\SynEditReg.dcr'}
The XE8 package does not compile for me. I spent about an hour trying to make it work then gave up and unfortunately downloaded the SynEdit from the GetIt built into XE8.
Lazarus 1.6.4 + FP 3.0
I'm surprised to see that Go (Golang) isn't among the list of supported SynEdit languages. Are there any plans to support it in the future. Alternatively are there any steps one could take with the existing components, possibly using the TSynAnySyn component?
Need to add the following
destructor TSynPasSyn.Destroy;
begin
{$IFDEF SYN_CodeFolding}
FreeAndNil(RE_BlockBegin);
FreeAndNil(RE_BlockEnd);
FreeAndNil(RE_Code);
{$ENDIF}
inherited;
end;
SynHighlighterSQL.pas
Property FunctionNames not work.
Please fix the method SetFunctionNames.
from:
procedure TSynSQLSyn.SetFunctionNames(const Value: TUnicodeStrings);
begin
fFunctionNames := Value;
end;
to:
procedure TSynSQLSyn.SetFunctionNames(const Value: TUnicodeStrings);
begin
fFunctionNames.Assign(Value);
end;
Thanks
I'm trying to figure out if this is the official version of synedit, or is the sourceforge version the definative source? I'm ignoring Roman's emb sponsored efforts (do not agree with their approach). I'm happy to see synedit on github (my preferred platform for open source), just trying to gauge whether this is the one that will be maintained or not.
Thx.
I use a fantastic software called HeidiSql. I asked a feature from the developer (HeidiSQL/HeidiSQL#81) and he said that he builds upon SynEdit so I should ask the feature here. :)
In the query editor of HeidiSQL, clicking once means placing the cursor to the appropriate position and double-click means selecting the complete word under the mouse cursor. No more mouse actions are recognized.
I would need addition multi-clicks, like triple click (3x), quadruple (4x), and so on.
For 3x click I would like the whole line under the cursor to be selected.
For 4x click I would like to select the SQL query under the cursor. It has some difficulties because an SQL query can span over more than one line, it may start not in the beginning of the first line and may finish not an the end of the last line. But the more important thing is that analyzing the SQL syntax is far beyond the scope of the SynEdit. Thus, I think it should be done by callbacks. HeidiSQL and other software that use SynEdit, should register callback functions and SynEdit would call those functions back if the given mouse action gets taken.
I can imagine that SynEdit would support selecting the whole text for 4x clicks because it doesn't care SQL commands. Thus, HeidiSQL should register two callbacks:
In the procedure "TSynSQLSyn.InitializeKeywordLists"
"fKeywords.Clear" is not releasing memory objects on the list, change the "fKeywords.Clear" to "fKeywords.DeleteEntries" solves.
Sorry for the English, I'm using google translator.
When compiling the following 4 files on my win7 PC with XE4, error will be emitted due to file encoding. I attache the screenshot for illustration of the error.
Files:
Source\SynEdit.pas
Source\SynEditSearch.pas
Source\SynHighlighterJava.pas
Source\SynEditHighlighter.pas
The solution will be converting from the current CP-1252 encoding to utf-8. I done this with an external text editor, but it'll be error-prone and tedious if I need to do this each time I updated my repository :)
In MS SQL, this is a valid comment:
--select * from table
However, SynEdit doesn't highlight it as a comment. Only if a insert a space after the --
does it recognise it as a comment. In MySQL, the space is required, but not in MS SQL.
PS: I'm using HeidiSQL, while digging through the source, found that it uses SynEdit. I gather that SynEdit is responsible for the tokenising and syntax highlighting, but excuse me if I misunderstood this.
I'm setting my unit output directory to ..\..\Library\Delphi10Berlin\$(Platform)\$(Config)
, because I want to use SynEdit with multiple Delphi versions.
It would make sense to add this change to all packages for all Delphi versions (some older version didn't support the variables though, but the path should still be changed to contain the Delphi version).
When combining TSynEdit with TSynCssSyn and load the following CSS data, the application freezes without warnings, errors or crashes. I'm using C++ Builder XE3 with the latest TSynEdit. There are no other issues.
@media(max-width:767px)
{
div[class^="col-xs"], div[class^="col-sm"], div[class^="col-md"],div[class^="col-lg"], div[class^="nsdiv"] { /display:inline;/ display:inline-block; }
/div[class="nsdiv"] { border:0; }*/
div[class^="col-xs"], div[class^="col-sm"], div[class^="col-md"],div[class^="col-lg"] { width:100%; }
}
There is a compilation error int this file, at line 876, in Rad Studio XE6:
'A'..'Z', 'a'..'z', '_', '$', 'À'..'Ö', 'Ø'..'ö', 'ø'..'ÿ': IdentProc;
[DCC Error] SynHighlighterJava.pas(876): E2010 Incompatible types: 'Char' and 'string'
I had to change this line to the following, to compile it:
'A'..'Z', 'a'..'z', '_', '$': IdentProc; // , 'À'..'Ö', 'Ø'..'ö', 'ø'..'ÿ': IdentProc;
How create new highlighter ?
File: SynDBEdit.pas
Line 257:
procedure TCustomDBSynEdit.CMGetDataLink(var Msg: TMessage);
begin
Msg.Result := Integer(FDataLink);
end;
FDataLink is object (Pointer Win32 - 4 byte, Win64 - 8 byte). Good code:
procedure TCustomDBSynEdit.CMGetDataLink(var Msg: TMessage);
begin
Msg.Result := Winapi.Windows.LRESULT(FDataLink);
end;
Nested statements (such as the '@media' rule) aren't colored properly.
The commit ae47e3b causes crashes on Wine, probably due to incomplete Direct2D support in Wine (just guessing):
Access violation at address 00007FDAA8B23E0A in module 'd2d1.dll'. Read of address 0000000000000000
Callstack ends up in line 4 of TCustomSynEdit.WMSize
Perhaps this needs to be reported to the Wine tracker, but I'm unsure?
I'd like to create my own syntax highlighter for Markdown language. Since Markdown by nature supports in-line HTML, it only makes sense to base mine off of the HTML highlighter.
So, I made a complete copy of SynHighlighterHTML.pas
and am creating an instance of this one instead, renamed to my own TSynMDSyn
component.
Then, since my application will support custom (non-standard) HTML tags, I looked into this unit and found the array constant KeyWords
listing all the different types of tags. I added my own tag (lets say md
) at the end, and increased the array size by 1 to accommodate. However, when using it, it does not recognize this tag still. It still highlights it red as if it's invalid.
I reverted this change, thinking somewhere else it's hard-coded to expect a maximum of 256 values. Instead, I renamed one of the existing ones (xmp
) to my own (md
), but it still does not recognize this tag, it still treats it as invalid.
I know something happened, because now it no longer recognizes xmp
tags. But it also doesn't recognize my md
tag either. I'm guessing it has something to do with the KeyIndices
array constant, but I have no idea how this works, and doesn't appear to correspond in any way with the KeyWords
(different count even).
How do I make this thing recognize my own custom HTML
tags?
I'm using a program that incorporates SynEdit. I am writing an SQL statement which requires that I escape a backslash. Functionally it works fine, but all of the text following the escaped backslash changes color. I've attached a screen shot to show an example of what is occurring. The first portion displays correctly, while the second portion is displaying as though the quote was never closed. Both portions execute without any problems, it is simply a display issue. Is there a way to keep the colors consistent after escaping the backslash?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.