Lazarus
Programming => Packages and Libraries => SynEdit => Topic started by: Edson on October 12, 2013, 07:26:50 pm
-
I have written a document about highlighter before:
http://forum.lazarus.freepascal.org/index.php/topic,21952.0.html
Now I have a new document that includes the before, and covers the SynEdit component.
Well this is not so complete document but it's my humble contribution:
It's in spansih again, but I hope someone can translate.
EDITED: Link deleted. New links in the next posts.
-
Well I don't speak Spanish, but I had a look at it (just the top few pages), and it looks great (I can recognise some of the content.
as for logical versus physical, I can only judge the picture (top of page 12)
The picture (a table) has 2 rows: bytes and characters.
However the 2nd row should be "position/cell in display grid".
If you look at the tab: It is ONE SINGLE CHAR. But it takes several positions in the grid.
Btw so does the Chinese "あ". The "あ" takes 2 places in the grid. It is a so-called "full width" glyph. While latin a-z are half width glyphs. So yes, even in a strictly monospaced font, there are 2 sizes.
It is important to distinguish between:
- byte (logical)
- utf8 codepoint
- char
- glyph (not really important in this context)
- display-grid-cells (physical)
-
SynEdit1.ExecuteCommand(ecChar,'x',nil);
There is a better way:
procedure ClearAll;
procedure InsertTextAtCaret(aText: String; aCaretMode : TSynCaretAdjustMode = scamEnd);
property TextBetweenPoints[aStartPoint, aEndPoint: TPoint]: String // Logical Points
read GetTextBetweenPoints write SetTextBetweenPointsSimple;
property TextBetweenPointsEx[aStartPoint, aEndPoint: TPoint; CaretMode: TSynCaretAdjustMode]: String
write SetTextBetweenPointsEx;
procedure SetTextBetweenPoints(aStartPoint, aEndPoint: TPoint;
const AValue: String;
aFlags: TSynEditTextFlags = [];
aCaretMode: TSynCaretAdjustMode = scamIgnore;
aMarksMode: TSynMarksAdjustMode = smaMoveUp;
aSelectionMode: TSynSelectionMode = smNormal
);
SynEdit.InsertTextAtCaret('A');
or to delete/replace text
var p1,p2: TPoint;
begin
p1 := SynEdit.LogicalCaretXY;
p2 := SynEdit.LogicalCaretXY;
p2.x := p2.x + UTF8CharacterLength(@SynEdit.LineText[p2.x]); // byte len of char AFTER current caret
SynEdit.TextBetweenPoints[p1,p2] := '';
** EDIT: I see you did cover that later
-
Thanks Martin for the observations.
I will correct and complete the document in the next revision. But InsertTextAtCaret() and TextBetweenPoints() are explained in the document. Maybe not so explained.
I don't have information about "full width" glyph. That's why I haven't included.
Do you know where can I find that information?
-
As I mentioned in my "Edit", I saw to late that you included InsertTextAtCaret
"full width" is a term you can google in te context of monospaced fonts. But you do not need to explain it.
I only gave it as example that tab #9 is not the only char that takes more than one cell.
You should make a difference between "character" and "display-grid-cell"
In your table the 2nd row is called character, but tab occupies 4 places. That is wrong: tab is one char. But 4 cells in the display grid.
-
Is this image better?
-
Yes.
The layout of the image is fine in the new and the old. What matters is that now (in the new) it is "cells".
I guess your text mentions somewhere that #$C3#$BA is one char?
UNRELATED:
I do not know, if you point people towards the Utf8 routines (like Utf8Length, Utf8Pos, ....). If you do, you should mention, that they do NOT really work on chars, but on codepoints.
-
Thanks for share this doc.
Also it's wrote in spanish!! (in my language!!!). Some times I'm playing with some control, and I missed a complete documentation, but now with TSynedit you did a very good documentation
Gracias, hace algo de tiempo empecé a investigar sobre Synedit, pero con tu documento me has ahorrado mucho tiempo, y enseñas cosas que habría pasado por alto. Poir cierto, el título le viene como anillo al dedo, pero podrías añadir algo así: "Todo lo que quisiste saber sobre TSynedit y nunca te atreviste a preguntar."
@Martin_Fr, I take a fast look to the documentation, and I think it's very complete, I saw the answers to the comun question that you usually post in the forum.
/BlueIcaro
-
Included the observations of Martin, here the Revision 2:
BlueIcaro:
En realidad le iba a poner de título algo como "El kamasutra del SynEdit", pero podrían tomarlo como poco serio.
EDITED: Link deleted. New links in the next posts.
-
Great job edson thanks a lot.
-
Thanks for this hard work, Edson! Here's hoping some enterprising soul will translate it for the Lazarus wiki.
En realidad le iba a poner de título algo como "El kamasutra del SynEdit", pero podrían tomarlo como poco serio.
:)
-
Here, the last revision of "The Bible of SynEdit". I have added more information about MarkUps and about Highlighter's algorithms.
"Aquí está la nueva revisión de "La Biblia del SynEdit". He agregado más información sobre marcadores de texto y sobre los algoritmos usados en los resaltadores."
http://blog.pucp.edu.pe/media/4946/20131019-la_biblia_del_synedit_-_rev3.pdf
I'm updating the wiki on spanish, but cannot update the english version. Sorry, my English is not so good.
-
I'm updating the wiki on spanish, but cannot update the english version. Sorry, my English is not so good.
No problem, thanks a lot for your work! It's easier to translate something than to figure things out, do all the work to write the documentation etc.
-
http://blog.pucp.edu.pe/media/4946/20131019-la_biblia_del_synedit_-_rev3.pdf
"De acuerdo a la comparación hecha, NO SE RECOMIENDA, de ninguna forma, implementar resaltadores de sintaxis con el algoritmo de funciones Hash"
Statement is much to broad to be generaly true.
Even your first character preselection is a hash.
A hash is simply a kind of sieve, a preselection to avoid many comparisons.
Which sieve is the cheapest in computing time depends on the string keys to process
and may vary a lot not only by implementation, but also from compiler to compiler.
Of course if I had designed the highlighters for FPC I would have used something else,
but I would never have used your first character preselection.
BTW on an ideal machine with unlimited resources.
An algorithm using character selection for every character of the string keys would be the fastest possible as it reduces the needed comparisons to zero.
Initializing boolean tables for every sieve level needed to process a given keylist
and store them in a level table to access them by a given level is feasible on todays PCs.
Zero comparisons needed.
-
Even your first character preselection is a hash.
OK. But it is more a tree prefix than a hash.
The suggestion I do about the hash algortithm, is not based only on the speed. (I indicate that the first-char prefix is almost, not always, faster).
I consider several criterias:
* Speed
* Size of code, memory used
* Optimizable
* Readable
* Maintaining
* Posibility of using external file for sintax.
In all of these, the hash lose.
-
OK. But it is more a tree prefix than a hash.
Is just a hash.
Maybe you should just look up the meaning of this word.
In all of these, the hash lose.
Laughable statement.
-
I consider several criterias:
* Speed
* Size of code, memory used
* Optimizable
* Readable
* Maintaining
* Posibility of using external file for sintax.
In all of these, the hash lose.
No it does not. Only the current implementation of the hash does.
-
No it does not. Only the current implementation of the hash does.
It will not lose on every level of optimization and it will not lose on every compiler.
-
No it does not. Only the current implementation of the hash does.
Yes. I have expressed my opinion (and showed the tests), just for the current implementation of the hash algorithm on the highlighters on Lazarus 1.0.12, using FPC 2.6.2.
I don't know about other compilers or other versions. I haven't tested. I don't pretend generalize.
-
I don't pretend generalize.
Your statement does exactly that.
Before you make such a bold statement you should do some pretty serious tests,
which you obviously not did.
Both of your examples have failed my tests.
You wanted to show how smart you are but failed miserably.
BTW the generator can be easily adjusted for a hasch that may be cheaper for a given keylist.
-
Here again, Bigger, fatter, and more complete, the new Revision, in spanish, of "The Bible of SynEdit":
http://blog.pucp.edu.pe/media/4946/20131031-la_biblia_del_synedit_-_rev4.pdf
Aquí de nuevo, más grande, más gorda y más completa, "La Biblia del SynEdit" - Revisión 4.
-
Updated, the new Revision 5, in spanish:
http://blog.pucp.edu.pe/action.php?action=plugin&name=LinkCounter&type=c&k=20140223-la_biblia_del_synedit_-_rev5.pdf&url=http://blog.pucp.edu.pe/media/4946/20140223-la_biblia_del_synedit_-_rev5.pdf
Wiki in spanish of SynEdit, was updated too.
Aquí, les comparto la revisión 5 actualizada de la documentación.
-
Updated, the new Revision 6, in spanish:
http://blog.pucp.edu.pe/action.php?action=plugin&name=LinkCounter&type=c&k=20140710-la_biblia_del_synedit_-_rev6.pdf
-
Updated, the new Revision 6, in spanish:
http://blog.pucp.edu.pe/action.php?action=plugin&name=LinkCounter&type=c&k=20140710-la_biblia_del_synedit_-_rev6.pdf
Thanks, I write a vhdl highlighter with folding support following your guidelines.
-
Thanks, I write a vhdl highlighter with folding support following your guidelines.
Maybe, it would have been easy to use this scriptable highlighter:
http://forum.lazarus.freepascal.org/index.php/topic,23516.msg165618.html#msg165618
(http://forum.lazarus.freepascal.org/index.php/topic,23516.msg165618.html#msg165618)
Or this, that includes completion code feature:
http://forum.lazarus.freepascal.org/index.php/topic,25883.msg158004.html#msg158004
(http://forum.lazarus.freepascal.org/index.php/topic,25883.msg158004.html#msg158004)
-
Edson, quisiera leer tu trabajo.
Parece muy interesante, pero todos los links estan muertos. ¿ Tienes algún link actualizado?
It seems intresting, but all links are broken. ¿Do you have any working link?
Guillermo.
-
Los enlaces de esta página funcionan:
http://blog.pucp.edu.pe/blog/tito/2013/10/12/lazarus-la-biblia-del-synedit/
Enlace directo:
http://blog.pucp.edu.pe/blog/tito/wp-content/uploads/sites/610/2013/10/la_biblia_del_synedit_-_rev6.pdf
Hazme saber si tienes problemas.
These links work. Tell me if you have problems.
-
Muchas gracias, Edson, este enlace:
http://blog.pucp.edu.pe/blog/tito/2013/10/12/lazarus-la-biblia-del-synedit/
funcionó perfecto!
This link worked fine! Thanks!
Guillermo.
-
Any link doesn't work.
Any one can send me a copy of this document'. or update the links?
/blueIcaro
-
Any link doesn't work.
Any one can send me a copy of this document'. or update the links?
/blueIcaro
The links from http://blog.pucp.edu.pe/blog/tito/2013/10/12/lazarus-la-biblia-del-synedit/
works OK for me. What kind of error you get?
-
The links from http://blog.pucp.edu.pe/blog/tito/2013/10/12/lazarus-la-biblia-del-synedit/
works OK for me. What kind of error you get?
This:
Se agotó el tiempo de espera
El servidor en blog.pucp.edu.pe está tomando mucho tiempo en responder.
El sitio podría estar temporalmente fuera de servicio o muy ocupado. Intenta nuevamente en un momento.
Si no puedes cargar ninguna página, verifica la conexión de red de tu computadora.
Si la red o tu computadora están protegidas por un firewall o proxy, asegúrate que Firefox pueda acceder a internet.
-
I see. :o
I have upload it to https://github.com/t-edson/SynFacilSyn in the folder /Docs. It's the last Revision.
-
Thanks (Gracias)
/BlueIcaro
-
Hello Edson,
I am a hobby programmer from Germany and have recently been working with the TSynEdit component. While getting to know the component, I also translated your bible into German. Of course I used Deepl and Google, but I read up on everything and also added some of my own screenshots. If you want, you can add the German translation to your Github repository.
Unfortunately I am new to this forum and have no idea how or if I can write you a personal message.
If you are interested and know how I can send you the PDF, I would be very happy to hear from you.
PS: Many thanks for this great document!
Best regards from Germany.
Bernd
-
open a issue and write it there your feature request. So he can direct answer there and see it. maybe he is not reading the task here.
-
Unfortunately I am new to this forum and have no idea how or if I can write you a perso
The PM feature is configured at a delay. That is, new users only get it after a certain time/activity on the forum. (this is automated, and I would have to look up the exact config...)
-
Hello Edson,
I am a hobby programmer from Germany and have recently been working with the TSynEdit component. While getting to know the component, I also translated your bible into German. Of course I used Deepl and Google, but I read up on everything and also added some of my own screenshots. If you want, you can add the German translation to your Github repository.
Unfortunately I am new to this forum and have no idea how or if I can write you a personal message.
If you are interested and know how I can send you the PDF, I would be very happy to hear from you.
Hi.
I'm glad to know there is a new translation of my document. I know SynEdit has new features that are not included in this book, but it's good to know the SynEdit control.
As "af0815" said, you can create an Request or an Issue in the Github site and I will include your document.
Thanks
-
Hello,
i create an Issue on your Github site.
Thanks for all answers.
Bernd