Recent

Author Topic: Is synedit able to do all of that?  (Read 6893 times)

souimet

  • Newbie
  • Posts: 1
Is synedit able to do all of that?
« on: August 12, 2013, 07:01:29 pm »
Hello all,

TL-DR: Can SynEdit "relatively easily" can do multi-caret stuff?

Long version:

I'm a long time programmer, but new to lazarus. I'm trying to make my own free and legal mini-toad for database development and administration.

I looked at a couple of different possible editors with syntax highlight and there are a lot of great features, but none can be easily controled for my goal (displaying database info in a grid or running custom batches on the selected text or something like that).

So, I'm looking to code one myself and invest a good bit of time. I saw SynEdit Control in Lazarus, Scintilla dll mostly for C++ and .Net Dev, and Jedit for java, which all have the code available and are free or mostly free. I wanted to be sure I won't get stuck somewhere and need to check another alternative.

There are a couple of features I need to have or code:

Those that I could find easily and already available in Synedit:
* Syntax Highlight (obviously)
* Folding (there are some samples)
* Be able to add tables and columns as keywords (TSynSQLSyn can for tables, not for columns, probably need a custom highlighter)
* Be able to add other keywords (like custom procedures and functions, easy if I build a custom highlighter)
* Auto-suggest / auto-complete the tables and columns (there are some different samples, I could probably find something already usable in there)
* Block/Column mode selecting (already there with one property)

Those that I couldn't find or easily do, related to typing more than one place at the same time:
* Block/Column mode editing (drag selecting a vertical line and start typing in all of those rows)
* Multi-caret mode (I've seen the Ctrl+J mode in Lazarus Ide, which would probably suffice for my needs if I knew how it worked, but can't decode how for now. The best would be like in Jedit, being able to have a mode that can multi-select more than one part and typing in all of those)
* Being able to search and replace by regular expressions (ideally having the multi-caret mode in each of those places like in sublime text editor)

and another one for the fun:
* Case change for the keywords (like the good old vba code in office, if the keyword is "Select" and I type sELECT because of capslock, I want it to change automatically after typing or after changing line. I can put in uppercase if I change the TSynSQLSyn GetTokenAttribute, but it's not exactly what I want. I might get somewhere with the custom highlighter sample, and using the slow mode instead of hash, but if there's a better alternative...)

I know Scintilla should be able to do those features if I spend enough time, but I couldn't get a simple (except c++) programming language that can easily give access to the scintilla control and have a good database grid or even a simple grid.

Thanks

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Is synedit able to do all of that?
« Reply #1 on: August 12, 2013, 10:42:46 pm »
TL-DR: Can SynEdit "relatively easily" can do multi-caret stuff?

Quote
Those that I couldn't find or easily do, related to typing more than one place at the same time:
* Block/Column mode editing (drag selecting a vertical line and start typing in all of those rows)
no (not yet)

there was another topic very recently
http://forum.lazarus.freepascal.org/index.php/topic,21684.0.html

synedit uses the caret provided by the OS (windows / lcl does it on gtk). that is limited to one.
however as long as there is no word wrap, it can be used (simply a caret with more height). still even that needs to be implemented

once there is wordwrap it will be even more work

Quote
* Multi-caret mode (I've seen the Ctrl+J mode in Lazarus Ide, which would probably suffice for my needs if I knew how it worked, but can't decode how for now. The best would be like in Jedit, being able to have a mode that can multi-select more than one part and typing in all of those)

there is a component as add on to synedit. not sure though if it is on the palette or needs to be added in code

search "syncro"


Quote
* Being able to search and replace by regular expressions (ideally having the multi-caret mode in each of those places like in sublime text editor)
is there: http://wiki.lazarus.freepascal.org/Editor_Macros_PascalScript#Caller:_TSynEdit (same function in real object

there is a callback event where a "do you want ..." dialog can be added.

Quote
and another one for the fun:
* Case change for the keywords (like the good old vba code in office, if the keyword is "Select" and I type sELECT because of capslock, I want it to change automatically after typing or after changing line. I can put in uppercase if I change the TSynSQLSyn GetTokenAttribute, but it's not exactly what I want. I might get somewhere with the custom highlighter sample, and using the slow mode instead of hash, but if there's a better alternative...)
you mean automatically change the text in the editor?

1) make the highlighter case insensitive
2) add an event synedit,OnChange (or maybe OnModified / also check the reason, and save time if only the caret moved) and check what was typed (and ask the highlighter, so you do not change strings)



Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Is synedit able to do all of that?
« Reply #2 on: August 18, 2013, 06:46:15 pm »
Quote
* Block/Column mode editing (drag selecting a vertical line and start typing in all of those rows)

I'm currently doing Colum Mode Editing on SynEdit. It`s not a factory feature, but it could be implemented simply. Of course there are some issues i have to improve, but I'm working on it.

Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9792
  • Debugger - SynEdit - and more
    • wiki
Re: Is synedit able to do all of that?
« Reply #3 on: August 18, 2013, 08:00:34 pm »
@Edson

great to hear.

feel free to contact me, if you need advice.

Also, if you want to contribute your code to the project, then it may be good to coordinate early

lazarus # mfriebe.de

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Is synedit able to do all of that?
« Reply #4 on: August 19, 2013, 06:09:24 am »
Of course i would like to contribute. All I need to do first, is improve my code for make it more generic. I hope to have some advance soon.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

 

TinyPortal © 2005-2018