Recent

Author Topic: On entering the editor, a thought...  (Read 4614 times)

Elmug

  • Hero Member
  • *****
  • Posts: 849
On entering the editor, a thought...
« on: August 04, 2011, 03:53:27 am »
I thought that since one moves in and out of the Editor often, and in particular since the cursor can not be seen when one is out of the editor, wouldn't it be nice if upon entering the editor, no matter where one clicks, the cursor would be placed right at the last point where the cursor was before.

Right now, coming back to the editor, where the focus is pretty much depends on where/what one clicks.

I wonder what others think of something like this.

Thanks!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12119
  • Debugger - SynEdit - and more
    • wiki
Re: On entering the editor, a thought...
« Reply #1 on: August 04, 2011, 11:03:23 am »
You can use "Persistent Caret" form options Editor/General. Then the cursor stays visible, if the editor is unfocused.
With one limitation though. Windows only allows ONE caret (thats what the cursor is called) per application. So If you open more than one SourceEditor Window, then only one will show the caret.

Otherwise click the window title bar, and the editor get's focus without moving the caret.

Or, you can use "advanced mouse options". You can't differ between a move-focus click, and a already-focus click. But you can configure left-mouse to never move the caret.

Or you can define alt-left-mouse to not move the caret, and use this to click your window...

---
I am not sure, how "do-able" it is to add special behaviour for the focus click.

IIRC any control (including SynEdit) will receive 2 events in that case: Focus, mouse-down (and of course mouse-up)

But AFAIK there is no relation ship between the 2 msgs. It could have been that the focus was moved by something else, and the mouse-down actually only triggered afterwards by a separate click of the user.

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: On entering the editor, a thought...
« Reply #2 on: August 05, 2011, 10:59:40 am »
Thanks for the good explanations, Martin.

I will soon investigate how I can put them to use, as I stil find it a little hard, at times, to find where I was on the editor when returning to the editor, I click far away from where I was, or click the scrolldown bar. That's one of my worse ones, and I do it because I can have several windows covering the editor. But I am learning to avoid that too.

Perhaps a shortcut key could be provided which jumps to the last place the cursor was when one last left the editor, would be nice. I now know one can place a marker at any point, but this would be an automatically placed marker. The thing is that most times, when we exit the editor, we want to come back to where we were at the cursor, and that way we don't have to place a marker every time!

That way, maybe an easier add on to do. Not an urgent thing, though, but as per me, quite useful, and perhaps for others. ;D


Thanks.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12119
  • Debugger - SynEdit - and more
    • wiki
Re: On entering the editor, a thought...
« Reply #3 on: August 05, 2011, 12:16:39 pm »
If you are editing a form, press F12 to go to the editor.

Lazarus has a "jump history". But it doesn't include the last place before un-focus. Neither does it save the caret when you enter by mouse => so it doesn't help you.

It works if you use code navigation => e.g CTRL-LEFT-Click on the name of a procedure => which takes you to the declaration of the procedure.
The history is by default ctrl-h (though you can change that) or the 4th/5th mouse button. In the "View" menu is a window showing you all history locations.

About clicking the scrollbar. In "Options" Editor/General, is a checkbox: "Always visible cusror". UN-check it.
Then if you scroll, the cursor stays in the text, the cursor scrolls out of the window, and if you hit, the left/right key => it will scroll back.


You can click the editor with the SHIFT key: This will move the caret, but it will start a selection, from where the caret had been.
So you do see where the caret was before.

If you do have, but not not need the middle mouse key (which does paste the current selection, you can set the middle button to do nothing, and use it for selection.
It is also possible to set the left mouse do *never* do anything, but I guess once focused you need it to work....



Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: On entering the editor, a thought...
« Reply #4 on: August 05, 2011, 01:39:41 pm »
Good people,

I have now found and learned that when coming back to the Editor, EXACTLY what I wanted happens if only I click at the very top of the editor (the frame where the Lazarus Logo is at the left of the title "Source Editor".

So, if that part does not show, then I just need to move what covers it a little.

The shortcut key thought, though, I think is still valid.

Thanks!

 

TinyPortal © 2005-2018