Recent

Author Topic: SynEdit and how to add functionality  (Read 979 times)

scasparz

  • Jr. Member
  • **
  • Posts: 55
SynEdit and how to add functionality
« on: December 10, 2020, 07:05:34 am »
Have been messing around with SynEdit for some time now. Am Linux Mint on Lazarus 2.0.10. Time has come for me to add some little additional functionality to the one already provided by the component and I believe SynEdit was build with this in mind.

At the moment what I want is to add a ^L, that is to continue the last search, then at some later stage a ^QP to take me to the previous text position, which by the way has not yet been implemented on the Lazarus editor and I miss it a lot.
 
I have no idea on how to implement either. Fundamentally I have failed to locate any kind of documentation on how to add a new command to SynEdit and it is exactly this am in need of help for.

Idea is to take a look on the Lazarus synedit code hoping to find something similar, study it and comprehand the way it is done as a working example, but I am lost, do not know where to start looking at.
 
Can someone please provide me with a lead?



thanks in advance
s

jamie

  • Hero Member
  • *****
  • Posts: 6090
Re: SynEdit and how to add functionality
« Reply #1 on: December 10, 2020, 12:59:06 pm »
The SyncPlugInSyncroEdit I think is a start

It looks promising

The only true wisdom is knowing you know nothing

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: SynEdit and how to add functionality
« Reply #2 on: December 10, 2020, 02:40:57 pm »
At the moment what I want is to add a ^L, that is to continue the last search,
Is not that the <F3> shortcut?
I think it depends of the tool you use to search.

then at some later stage a ^QP to take me to the previous text position, which by the way has not yet been implemented on the Lazarus editor and I miss it a lot.

Is not that the <Ctrl>+H shortcut?
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: SynEdit and how to add functionality
« Reply #3 on: December 10, 2020, 05:08:21 pm »
First of all, lets differentiate between:
1) The shortcut: F3 versus ^L
2) The actual functionality

1) The shortcut: This is configurable.
Both TSynEdit (as a component, in ObjectInspector) and the IDE offer full configuration of keyboard shortcuts.

2)
Search again exists in the IDE.

SynEdit itself does not have a search nor search-again command. That is, because SynEdit does not include any dialogue to do a search. Such a dialogue must always be provided by the application using SynEdit.
SynEdit offer methods, that can be called to do the actual search.

Back to previous position
Again the IDE has "history jumps" (back and forward). Assign the keys you want.
I do have to check, if a history point is created, when a search is started [A]. And also if or if not, in case of a "Search again"

[A] Actually, it would be created when jumping to the found search result. And it will only be created, if that is at least a few lines from the previous location.

You could record editor-macros for "set history point", "search" => that would probably always set one (not sure if it needs to be a bit away from the previous history point). You could then assign that macro to your key-combo.

scasparz

  • Jr. Member
  • **
  • Posts: 55
Re: SynEdit and how to add functionality
« Reply #4 on: December 13, 2020, 06:11:10 pm »
Thanks everyone for their contributions. Much obliged.



kind regards
s

 

TinyPortal © 2005-2018