Lazarus

Programming => Packages and Libraries => SynEdit => Topic started by: Edson on October 12, 2013, 07:26:50 pm

Title: Documentation for SynEdit (La biblia del SynEdit)
Post 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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Martin_fr on October 12, 2013, 07:50:48 pm
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)


Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Martin_fr on October 12, 2013, 07:58:00 pm
Quote
SynEdit1.ExecuteCommand(ecChar,'x',nil);

There is a better way:
Code: [Select]
    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
                                  );

Code: [Select]
SynEdit.InsertTextAtCaret('A');
or to delete/replace text
Code: [Select]
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
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on October 12, 2013, 08:23:45 pm
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?
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Martin_fr on October 12, 2013, 08:35:50 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on October 12, 2013, 09:30:38 pm
Is this image better?
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Martin_fr on October 12, 2013, 10:01:51 pm
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.

Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: BlueIcaro on October 12, 2013, 10:59:38 pm
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
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on October 12, 2013, 11:29:13 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: eldonfsr on October 13, 2013, 04:11:17 am
Great job edson thanks a lot.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: BigChimp on October 13, 2013, 12:11:05 pm
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.
:)
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on October 20, 2013, 04:28:51 am
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: BigChimp on October 20, 2013, 10:09:26 am
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Morton on October 20, 2013, 01:50:48 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on October 20, 2013, 05:32:22 pm
Quote
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.

Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Morton on October 20, 2013, 06:30:12 pm
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.

Quote
In all of these, the hash lose.

Laughable statement.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Martin_fr on October 20, 2013, 06:30:49 pm
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.


Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Morton on October 20, 2013, 06:46:59 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on October 20, 2013, 06:54:36 pm
Quote
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Morton on October 21, 2013, 01:00:28 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on November 01, 2013, 02:47:20 am
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on February 23, 2014, 06:54:19 pm
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.

Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on July 10, 2014, 06:57:53 pm
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
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: M.A.R.C. on April 13, 2015, 11:04:13 am
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on April 13, 2015, 04:30:54 pm
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)
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Guillermo on December 29, 2015, 08:16:48 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on December 29, 2015, 08:34:25 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Guillermo on December 30, 2015, 04:28:39 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: BlueIcaro on January 15, 2018, 01:42:37 pm
Any link doesn't work.
Any one can send me a copy of this document'. or update the links?
/blueIcaro
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on January 15, 2018, 02:56:40 pm
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?
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: BlueIcaro on January 15, 2018, 03:38:07 pm
Quote
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:
Quote
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on January 15, 2018, 03:45:51 pm
I see.   :o

I have upload it to https://github.com/t-edson/SynFacilSyn in the folder /Docs. It's the last Revision.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: BlueIcaro on January 15, 2018, 05:35:43 pm
Thanks (Gracias)
/BlueIcaro
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: wennerer on March 15, 2024, 06:43:19 pm
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
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: af0815 on March 15, 2024, 06:54:02 pm
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.
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Martin_fr on March 15, 2024, 08:12:04 pm
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...)
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: Edson on March 15, 2024, 09:39:18 pm
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
Title: Re: Documentation for SynEdit (La biblia del SynEdit)
Post by: wennerer on March 16, 2024, 06:35:37 am
Hello,
i  create an Issue on your Github site.

Thanks for all answers.
Bernd
TinyPortal © 2005-2018