Recent

Author Topic: How to remove bookmarks with Lazarus' Synedit  (Read 16945 times)

Henppy

  • Jr. Member
  • **
  • Posts: 60
How to remove bookmarks with Lazarus' Synedit
« on: December 21, 2013, 04:03:13 am »
Hello there.

I see SynEdit (the one shipped with Lazarus) automatically adds bookmarks when you press Ctrl-Shift-#, so you don't have to write any code at all to implement that feature. All fine there, my problem comes with the removal of said marks: when you press the shortcut again on a line that already has a bookmark with the same number, the bookmark doesn't go away. It works when you replace the bookmark with another (by pressing a different number), but when it's the same, the thing just stays there.

I can see the ClearBookmark event gets called, but after that the PlaceBookmark event is called. So it's like the editor is removing and then re-adding the same bookmark number.

So, how do you remove a bookmark then? I tried different ideas I had but no luck.

Thanks all for the help.

My Laz is 1.0.14, tried on Win7 64bits and Ubuntu. Same thing.

EDIT: in case I didn't make my self clear here, I'm talking about an app I'm writing using the SynEdit component, not the IDE source editor. :)
« Last Edit: December 21, 2013, 04:14:02 am by Henppy »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #1 on: December 21, 2013, 04:58:31 pm »
you should be able to edit the key combos in the object inspector.

it seems they are set to ecSetBookmark, but you need ecToggleBookmark

Henppy

  • Jr. Member
  • **
  • Posts: 60
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #2 on: December 21, 2013, 05:13:41 pm »
Hmm... It looks like there's no ecToggleBookmark or ecSetBookmark commands. Just to be clear, this is the SynEdit that comes pre-installed with Lazarus, although I didn't manage to find them in the latest SynEdit neither.

And thanks for the help.

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #3 on: December 21, 2013, 07:22:24 pm »
@Henppy

You have to go to the Object Inspector, and select "SynEdit1>KeyStrokes", then change the Shortcut number 64, 65, 66, ..
They are set to ecSetMarker0, ecSetMarker1, ...
You should change them to ecToggleMarker0, ecToggleMarker1, ...

@Martin,

I have found that when using the BookMark Shortcuts (enabled by default) with no assigning a ImageList to: "SynEdit1.BookMarkOptions.BookmarkImages", the SynEdit, crashes. At least in my system. Is that normal?


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

Henppy

  • Jr. Member
  • **
  • Posts: 60
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #4 on: December 21, 2013, 08:55:09 pm »
Aha! I completely misunderstood. I  thought there was a command called ecToggleMarker, without specific number on it.  ::)

Thanks for the help!


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #5 on: December 22, 2013, 11:00:58 am »
about the crash, did you test 1.2 ? If so then please report on mantis

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #6 on: January 13, 2014, 12:48:05 am »
It crashes too, in 1.2.  :(

I will report.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #7 on: January 13, 2014, 04:09:50 am »
Do I have to create another user for the Bugtracker?  :o
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #8 on: January 13, 2014, 04:31:52 am »
Yes.

Btw, what should be correct behaviour, if there are no images?

Display nothing? Or print the number (for bookmarks only / nothing for other marks)

Probably gonna make it nothing for now

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #9 on: January 13, 2014, 05:01:21 am »
Print the number will be the best. But by now, it will be better doing nothing, if there is not image to show; or have not the Keystroke assigned.

I have realized, there is one property called 'InternalImage' for TSynEditMark.
What is it for?
Is there some internal images for Bookmark?
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #10 on: January 13, 2014, 05:03:12 am »
I need to look it up myself. They are pointed in the Syn....Gutter unit

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #11 on: January 13, 2014, 03:37:54 pm »
InternalMarks do not work, because their resource is missing.

Probably will deprecate them. Otherwise, every app with SynEdit will get to include them. No point in that.

I cant reproduce the crash.

Dropped a synedit on a form, run, and set a bookmark (via keyboard.

There is a resource not found exception. But it is handled in a try except, so it is ok.

Otherwise works.

That is with Laz 1.3

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #12 on: January 13, 2014, 03:39:40 pm »
I have found that when using the BookMark Shortcuts (enabled by default) with no assigning a ImageList to: "SynEdit1.BookMarkOptions.BookmarkImages", the SynEdit, crashes. At least in my system. Is that normal?

What is the kind of crash, Sigxxx or exception (which?)?

Stacktrace

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #13 on: January 13, 2014, 05:27:17 pm »
Actually, it is an exception.

In the IDE, it shows the message of Exception.

I suppose, it's because the IDE catches the exception on execution time. When running alone, no windows are shown.

Is it the expected behaviour?

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

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: How to remove bookmarks with Lazarus' Synedit
« Reply #14 on: January 13, 2014, 05:38:24 pm »
Actually, it is an exception.

In the IDE, it shows the message of Exception.

I suppose, it's because the IDE catches the exception on execution time. When running alone, no windows are shown.

Is it the expected behaviour?

Yes that is expected.
The debugger shows exceptions, even if the will be handled by the app.

 

TinyPortal © 2005-2018