[Lazarus] Where can I switch OFF automatic copy in code editor?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Where can I switch OFF automatic copy in code editor?

Free Pascal - Lazarus mailing list
I try to enter ifdef/endif blocks into my code and so I have this
copied to the clipboard:

{$IFDEF USE_ANALYZER}
{$ENDIF}

When I get to a block I want to condition I put the cursor at the
beginning of the block and paste these lines.
Then I select the second line I pasted and drag it to the end of the
block so it covers the whole block.

Next I find the subsequent block to treat and I place the cursor at
the start and make a Ctrl-V to paste.
But now only the line
{$ENDIF}
is pasted!

I could not understand this until in one place I did the opposite,
after pasting the two lines at the start of the block I selected the
block and dragged it to the start of the second pasted line.
When I then went to the next location in the code and pasted the
clipboard then the last block I moved into the ifdef section was
pasted!!!!!!!!!

So apparently the IDE is copying whatever I select and replaces what I
have myself put into the clipboard!

Where can I switch this strange behaviour OFF!
I am using Lazarus 2.0.8 with FPC 3.0.4 on Raspbian Linux.

And I rearrange the code frequently by using mouse moves (dragging).


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Where can I switch OFF automatic copy in code editor?

Free Pascal - Lazarus mailing list
On 19/07/2020 22:27, Bo Berglund via lazarus wrote:

> I try to enter ifdef/endif blocks into my code and so I have this
> copied to the clipboard:
>
> {$IFDEF USE_ANALYZER}
> {$ENDIF}
>
> When I get to a block I want to condition I put the cursor at the
> beginning of the block and paste these lines.
> Then I select the second line I pasted and drag it to the end of the
> block so it covers the whole block.
>
> Next I find the subsequent block to treat and I place the cursor at
> the start and make a Ctrl-V to paste.
> But now only the line
> {$ENDIF}
> is pasted!
>
> Where can I switch this strange behaviour OFF!
> I am using Lazarus 2.0.8 with FPC 3.0.4 on Raspbian Linux.

On Linux you should have 2 clipboards.
One  is automatically assigned, if you select text. It is used for
pasting via middle mouse button. (it only reacts OnRequest)

Afaik there isn't an option for that.
This is the first time I hear that this replaces the other clipboard....

See TCustomSynEdit.AquirePrimarySelection;


Unless something happens during dragging... (I could not find anything
in the code from a cursory look)
If you just select the text, and then do ctrl-v, do you get the original
clipboard, or the selection?

> And I rearrange the code frequently by using mouse moves (dragging).
If you use trunk, you can move lines (or selected lines, or even random
selection) up and down via keyboard.

   ecMoveLineUp:          VK_UP,[XCtrl, ssShift, ssAlt]);  // or
selected lines
   ecMoveLineDown:     VK_DOWN,[XCtrl, ssShift, ssAlt]); // or selected
lines
   ecDuplicateLine:        VK_INSERT,[XCtrl, ssShift, ssAlt]); // or
selected lines

   ecMoveSelectUp:      VK_NUMPAD8,[XCtrl, ssAlt]);
   ecMoveSelectDown: VK_NUMPAD2,[XCtrl, ssAlt]);
   ecMoveSelectLeft:     VK_NUMPAD4,[XCtrl, ssAlt]);
   ecMoveSelectRight:  VK_NUMPAD6,[XCtrl, ssAlt]);
   ecDuplicateSelection: VK_NUMPAD0,[XCtrl, ssAlt]);

(You can also add to the clipboard, collecting content from diff places. )
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Where can I switch OFF automatic copy in code editor?

Free Pascal - Lazarus mailing list
On Sun, 19 Jul 2020 22:48:58 +0200, Martin Frb via lazarus
<[hidden email]> wrote:

>On 19/07/2020 22:27, Bo Berglund via lazarus wrote:
>> I try to enter ifdef/endif blocks into my code and so I have this
>> copied to the clipboard:
>>
>> {$IFDEF USE_ANALYZER}
>> {$ENDIF}
>>
>> When I get to a block I want to condition I put the cursor at the
>> beginning of the block and paste these lines.
>> Then I select the second line I pasted and drag it to the end of the
>> block so it covers the whole block.
>>
>> Next I find the subsequent block to treat and I place the cursor at
>> the start and make a Ctrl-V to paste.
>> But now only the line
>> {$ENDIF}
>> is pasted!
>>
>> Where can I switch this strange behaviour OFF!
>> I am using Lazarus 2.0.8 with FPC 3.0.4 on Raspbian Linux.

>
>On Linux you should have 2 clipboards.
>One  is automatically assigned, if you select text. It is used for
>pasting via middle mouse button. (it only reacts OnRequest)
>
>Afaik there isn't an option for that.
>This is the first time I hear that this replaces the other clipboard....
>
>See TCustomSynEdit.AquirePrimarySelection;
>
>
>Unless something happens during dragging... (I could not find anything
>in the code from a cursory look)
>If you just select the text, and then do ctrl-v, do you get the original
>clipboard, or the selection?
>

>> And I rearrange the code frequently by using mouse moves (dragging).

>If you use trunk, you can move lines (or selected lines, or even random
>selection) up and down via keyboard.
>
>   ecMoveLineUp:          VK_UP,[XCtrl, ssShift, ssAlt]);  // or
>selected lines
>   ecMoveLineDown:     VK_DOWN,[XCtrl, ssShift, ssAlt]); // or selected
>lines
>   ecDuplicateLine:        VK_INSERT,[XCtrl, ssShift, ssAlt]); // or
>selected lines
>
>   ecMoveSelectUp:      VK_NUMPAD8,[XCtrl, ssAlt]);
>   ecMoveSelectDown: VK_NUMPAD2,[XCtrl, ssAlt]);
>   ecMoveSelectLeft:     VK_NUMPAD4,[XCtrl, ssAlt]);
>   ecMoveSelectRight:  VK_NUMPAD6,[XCtrl, ssAlt]);
>   ecDuplicateSelection: VK_NUMPAD0,[XCtrl, ssAlt]);
>
>(You can also add to the clipboard, collecting content from diff places. )

I cannot find any of this in the Lazarus Tools/Options tree...
Are you referring to the source code of Lazarus itself?

But I made a test now and just selecting text does not put it into the
clipboard.

But when a line that is selected inside the code editor is moved using
the mouse, then it replaces whatever is in Clipboard.

If something in a line is selected and moved then what gets into the
clipboard is the first character of that selection!!!
What a strange functionality!

I have no clue about any secondary clipboard, I use Notepad++ on my
Windows laptop and that is where I copied the two lines.

Then inside the RaspberryPi VNC session where I run Lazarus I could
paste it into the code editor until such time as when I have dragged
something using the mouse in Lazarus. Following that the clipboard
contains the moved text instead.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Where can I switch OFF automatic copy in code editor?

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Apart from your problem you describe here, do you know of Shift+Ctrl+D? You can select
the source lines press Shift+Ctrl+D and select one of the conditional defines or create a new one.
Then you get the {$IFDEF  ...} at the beging of the selected text and {$ENDIF} at the end of the selected text.

Pascal

> Bo Berglund via lazarus <[hidden email]> hat am 19. Juli 2020 um 22:27 geschrieben:
>
>
> I try to enter ifdef/endif blocks into my code and so I have this
> copied to the clipboard:
>
> {$IFDEF USE_ANALYZER}
> {$ENDIF}
>
> When I get to a block I want to condition I put the cursor at the
> beginning of the block and paste these lines.
> Then I select the second line I pasted and drag it to the end of the
> block so it covers the whole block.
>
> Next I find the subsequent block to treat and I place the cursor at
> the start and make a Ctrl-V to paste.
> But now only the line
> {$ENDIF}
> is pasted!
>
> I could not understand this until in one place I did the opposite,
> after pasting the two lines at the start of the block I selected the
> block and dragged it to the start of the second pasted line.
> When I then went to the next location in the code and pasted the
> clipboard then the last block I moved into the ifdef section was
> pasted!!!!!!!!!
>
> So apparently the IDE is copying whatever I select and replaces what I
> have myself put into the clipboard!
>
> Where can I switch this strange behaviour OFF!
> I am using Lazarus 2.0.8 with FPC 3.0.4 on Raspbian Linux.
>
> And I rearrange the code frequently by using mouse moves (dragging).
>
>
> --
> Bo Berglund
> Developer in Sweden
>
> --
> _______________________________________________
> lazarus mailing list
> [hidden email]
> https://lists.lazarus-ide.org/listinfo/lazarus
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Where can I switch OFF automatic copy in code editor?

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 20/07/2020 06:56, Bo Berglund via lazarus wrote:

> On Sun, 19 Jul 2020 22:48:58 +0200, Martin Frb via lazarus
> <[hidden email]> wrote:
>> On 19/07/2020 22:27, Bo Berglund via lazarus wrote:
>>> I am using Lazarus 2.0.8 with FPC 3.0.4 on Raspbian Linux.
>
>> If you use trunk, you can move lines (or selected lines, or even random
>> selection) up and down via keyboard.
>>
>>    ecMoveLineUp:          VK_UP,[XCtrl, ssShift, ssAlt]);  // or
>> selected lines
>>    ecMoveLineDown:     VK_DOWN,[XCtrl, ssShift, ssAlt]); // or selected
> I cannot find any of this in the Lazarus Tools/Options tree...
> Are you referring to the source code of Lazarus itself?
The above is from the source, but it shows the default keys.
In Tools Options, under Keymap, they are in "Text Editing commands" >
"Move line down" etc

Again: Trunk only. Not avail in 2.0.x

> But I made a test now and just selecting text does not put it into the
> clipboard.
Good.

> But when a line that is selected inside the code editor is moved using
> the mouse, then it replaces whatever is in Clipboard.
Strange. Not indented.

> I have no clue about any secondary clipboard, I use Notepad++ on my
> Windows laptop and that is where I copied the two lines.
That is a Linux thing.
Try this (in a terminal)

- Select and Copy some text (ctrl-v, or context menu copy)
- Select other text
- Middle click => inserts the other text
- Paste (context menu) insert the original text


> Then inside the RaspberryPi VNC
Do you use a shared clipboard, or other VNC clipboard functionality?
Maybe vnc is messing around.

If vnc is pulling either or both clipboards....
What happens to the clipboard, if you select text, and do nothing for a
minute?

What happens to the clipboard, if you select text in a terminal (on the
rpi) and middle click it?

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Where can I switch OFF automatic copy in code editor?

Free Pascal - Lazarus mailing list
On Mon, 20 Jul 2020 13:26:08 +0200, Martin Frb via lazarus
<[hidden email]> wrote:

>
>> But I made a test now and just selecting text does not put it into the
>> clipboard.

>Good.

>
>> But when a line that is selected inside the code editor is moved using
>> the mouse, then it replaces whatever is in Clipboard.

>Strange. Not indented.
>

>> I have no clue about any secondary clipboard, I use Notepad++ on my
>> Windows laptop and that is where I copied the two lines.

>That is a Linux thing.
>Try this (in a terminal)

Do you mean a terminal window in the RPi GUI on a monitor attached to
the RPi itself?

>
>- Select and Copy some text (ctrl-v, or context menu copy)
>- Select other text
>- Middle click => inserts the other text
>- Paste (context menu) insert the original text

So now I used the Text Editor on RPi *via VNC* for testing:
- Select and copy text
- Move caret to other location and Ctrl-V paste (works)
- Select text somewhere
- Middle click mouse when it is somewhere else in the text.
  Pastes on mouse location without moving caret from selection.
- Move caret to other location in text, this clears the selection
- Middle click does nothing now!
- But Ctrl-V pastes the original copied text

Then starting Lazarus and inside the code editor:
- Select and copy text
- Move caret and Ctrl-V paste works
- Select other text
- Without moving caret middle click somewhere - pastes selected text
- Move caret and middle click - nothing happens
- Ctrl-V paste - *previously* copied text pasted

Seems like middle click will paste whatever is currently selected at
the location where the mouse pointer is moved.

>
>> Then inside the RaspberryPi VNC
>Do you use a shared clipboard, or other VNC clipboard functionality?
>Maybe vnc is messing around.

I don't know how this works, I have not modified any VNC config I am
aware of. It probably uses the installation defaults.
But I very often move text back and forth between Win and RPi using
Copy/Paste, so using the clipboard.


Based on the above experiments it seems like I can make copies of a
piece of text by just selecting it and then pointing the mouse at the
destination and hit the middle button. It will then be copied there.

Since I did not know that I had been holding the Ctrl key on the
keyboard while dragging the selection to the destination. This action
seems to affect the clipboard so what was in it is replaced by the
dragged text.

I will change my work habit...

>If vnc is pulling either or both clipboards....
>What happens to the clipboard, if you select text, and do nothing for a
>minute?
>
>What happens to the clipboard, if you select text in a terminal (on the
>rpi) and middle click it?

I cannot really do any of the "on the RPi" stuff since I do not have a
monitor to connect the RPi to and no other keyboard or mouse either.
VNC has worked reasonably good over the years, first with TightVNC and
then later with the RealVNC that now come bundled with the RPi images.
So I enable the VNC server on all of my GUI style RPi units and use
the RealVNC application on my Windows10 notebook computer to use the
RPi desktop.
Still have some older RPi units so I also occationally use TightVNC
for these.

But the tests you suggested revealed previously hidden (for me)
functionality I can use going forward!

 Thanks!


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Where can I switch OFF automatic copy in code editor?

Free Pascal - Lazarus mailing list
On 21/07/2020 11:37, Bo Berglund via lazarus wrote:

> Seems like middle click will paste whatever is currently selected at
> the location where the mouse pointer is moved.

Yes middle click, will get current selection. And afaik it can do this
cross applications.

>
> Based on the above experiments it seems like I can make copies of a
> piece of text by just selecting it and then pointing the mouse at the
> destination and hit the middle button. It will then be copied there.
>
> Since I did not know that I had been holding the Ctrl key on the
> keyboard while dragging the selection to the destination. This action
> seems to affect the clipboard so what was in it is replaced by the
> dragged text.
That still should not replace the ctrl-c/v clipboard.... Strange.

If you drag without ctrl, will the ctrl-c/v clipboard also be affected,
or does it keep its content?

Also, just curiosity, but you said you drag the "{$Endif} to a diff
location? Holding Ctrl means you drag it, but keep the orginal => so you
end up with 2 $ENDIF ?

> But the tests you suggested revealed previously hidden (for me)
> functionality I can use going forward!
>

Btw, on top of the other suggestion doing the $Endif stuff. You can
assign a single keycombo to type {$Endif}.
(Editor macros are in the view menu)

- record an editor macro  (IIRC  ctrl-shift r)
- type: {$Endif}
- stop recording (IIRC  ctrl-shift r)

In the editor macro dialog, move the macro to IDE (so its global), and
assign a key-combo.

Then you just paste the {IFDEF....}
and insert the $Endif via your key combo.


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus