Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2009-07

Persistent blocks in Lazarus

14 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Friebe

[cross-posted to lazarus list => please join there to continue the topic]

I am trying to figure out how they work....

- Block is kept, if cursor moves away. (obvious)
- Shift Cursur keys:
- Block is extended if cursor was next to block
- New block is started , if cursor was away from block. (could also be used to extend the block, like shift-left-mouse)
- Block is kept, position/size adjusted if text is typed before, or into the block (exception, column mode block is not adapted)
- ctrl-c copies the block, at any time

annoyances I found in turbo explorer (the free delphi), not sure if they are supposed to be.
- Move the caret via mouse (left click) => block is undone
- paste/ctrl-v : the newly inserted text is selected as new block? (this means the current block is lost)

That's all the knowledge I have about them sofar.

Anyone wants to update me?

Martin

Andreas Berger wrote 18 lines
> On Thu, Jul 16, 2009 at 01:36:15PM +0200, Andreas Berger wrote: > >>> Out of curiosity (because I never used this feature in any editor), >>> what would you use it for? >>> >> Persistent blocks and the full Wordstar keyboard shortcuts is why I >> use the Delphi IDE until today. >> > > If you miss wordstar stuff, please list it. Well, maybe I should use the Lazarus IDE again for a bit a jot down what I would like. I may even soon have time to help add some options. _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Jürgen Hestermann
to Martin Friebe
Martin Friebe schrieb: - Shift Cursur keys: - Block is extended if cursor was next to block

I would not like that. Shift+Cursor should always start a new block. And what would be "next to block"?

(could also be used to extend the block, like shift-left-mouse)

Yes, Shift+Mouse should extend the block.

- Block is kept, position/size adjusted if text is typed before, or into the block (exception, column mode block is not adapted)

Agree.

- ctrl-c copies the block, at any time

Yes.

annoyances I found in turbo explorer (the free delphi), not sure if they are supposed to be. - Move the caret via mouse (left click) => block is undone

That should not happen.

- paste/ctrl-v : the newly inserted text is selected as new block? (this means the current block is lost)

That could be debated. All versions I came across did it this way. But I also think it should not change the current block.

Reply by email

Andreas Berger
to Martin Friebe: [cross-posted to lazarus list => please join there to continue the topic] I am trying to…

Persistent blocks:
Keyboard:
- Ctrl-K + B or Ctrl-K + Ctrl-B will define the beginning of the block. If it is before the end of the block the block is shown even if it was hidden before.
- Ctrl-K + K or Ctrl-K + Ctrl-K will define the end of the block. If it is after the end of of the block the block is shown even if it was hidden before.
- Ctrl-K + H or Ctrl-K + Ctrl-H will hide\unhide the block.
- Shift-Up / Shift-Left / Shift-PgUp / Shift-Ctrl-Home / Shift-Ctrl-Left / Shift-Home:
1) If the cursor was not at the beginning of the block then a new block is defined and the old one removed. The block end is at the original cursor position and the block beginning is at the new cursor position.
2) If the cursor WAS at the beginning of the block then the block is extended by placing the block beginning at the new cursor position.
- Shift-Down / Shift-Right / Shift-PgDn / Shift-Ctrl-End / Shift-Ctrl-Right / Shift-End
1) If the cursor was not at the end of the block then a new block is defined and the old one removed. The block start is at the original cursor position and the block end is at the new cursor position.
2) If the cursor WAS at the end of the block then the block is extended by placing the block ending at the new cursor position.

Mouse:
- The mouse works similarly. Dragging the mouse with the left button pressed will either define a new block if the start position was not at the block start (up) or end (down). If the drag start position was at the block start when moving up or at the block end when moving down the the block is extended.
- To mark a column-based block use Shift-LeftMouseButton. Wordstar used to use Ctrl-K + N or Ctrl-K + Ctrl-N to turn on/off colum based blocks, but this does not seem to work in delphi.

- Persistent blocks are moved when a Ctrl-K + V or Ctrl-K + Ctrl-K + Ctrl-V is pressed.
- Persistent blocks are copied when a Ctrl-K + C or Ctrl-K + Ctrl-K + Ctrl-C is pressed.
- Persistent blocks are moved to the clipboard with the normal windows commands (Ctrl-Ins or Ctrl-C). However, the block is not unmarked with this command.
- Persistent blocks are pasted from the clipboard with the normal windows commands (Shift-Ins or Ctrl-V). In this case the old block is undefined and the pasted block becomes the new persistent block.
- Persistent blocks are moved to the clipboard with the normal windows commands (Shift-Del or Ctrl-X). Persistent block start and block end are then positioned at the original block start.
- Persistend blocks are deleted via Ctrl-K + Y or Ctrl-K + Ctrl-Y or Ctrl-Del. Persistent block start and block end are then positioned at the original block start.
- Ctrl-K + I or Ctrl-K + Ctrl-I indents a persistent block
- Ctrl-K + U or Ctrl-K + Ctrl-U unindents a persistent block
- Ctrl-Q + B or Ctrl-Q + Ctrl-B will move the cursor to the beginning of the persistent block.
- Ctrl-Q + K or Ctrl-Q + Ctrl-K will move the cursor to the end of the persistent block.

Editing inside the persistent block (inserting chars or deleting them) will grow or shrink the block acordingly.

I hope I did not forget anything.

Martin Friebe wrote 20 lines
I am trying to figure out how they work.... - Block is kept, if cursor moves away. (obvious) - Shift Cursur keys: - Block is extended if cursor was next to block - New block is started , if cursor was away from block. (could also be used to extend the block, like shift-left-mouse) - Block is kept, position/size adjusted if text is typed before, or into the block (exception, column mode block is not adapted) - ctrl-c copies the block, at any time annoyances I found in turbo explorer (the free delphi), not sure if they are supposed to be. - Move the caret via mouse (left click) => block is undone - paste/ctrl-v : the newly inserted text is selected as new block? (this means the current block is lost) That's all the knowledge I have about them sofar. Anyone wants to update me?

Reply by email

Hans-Peter Diettrich
to Andreas Berger
Show quoted text 8 lines
Persistent blocks: Keyboard: - Ctrl-K + B or Ctrl-K + Ctrl-B will define the beginning of the block. If it is before the end of the block the block is shown even if it was hidden before. - Ctrl-K + K or Ctrl-K + Ctrl-K will define the end of the block. If it is after the end of of the block the block is shown even if it was hidden before.

IMO there is no requirement that ^BB must reside before ^BK in the text (equivalent to the mouse UI).

Show quoted text 16 lines
- Ctrl-K + H or Ctrl-K + Ctrl-H will hide\unhide the block. - Shift-Up / Shift-Left / Shift-PgUp / Shift-Ctrl-Home / Shift-Ctrl-Left / Shift-Home: 1) If the cursor was not at the beginning of the block then a new block is defined and the old one removed. The block end is at the original cursor position and the block beginning is at the new cursor position. 2) If the cursor WAS at the beginning of the block then the block is extended by placing the block beginning at the new cursor position. - Shift-Down / Shift-Right / Shift-PgDn / Shift-Ctrl-End / Shift-Ctrl-Right / Shift-End 1) If the cursor was not at the end of the block then a new block is defined and the old one removed. The block start is at the original cursor position and the block end is at the new cursor position. 2) If the cursor WAS at the end of the block then the block is extended by placing the block ending at the new cursor position.

IMO it is (or should be) much simpler: When the cursor was not on ^BK, the ^BB is set to the old cursor position. Then ^BK is set to the new cursor position.

Show quoted text 7 lines
Mouse: - The mouse works similarly. Dragging the mouse with the left button pressed will either define a new block if the start position was not at the block start (up) or end (down). If the drag start position was at the block start when moving up or at the block end when moving down the the block is extended.

IMO the same as with the keyboard, i.e. depending on the previous position of ^BK. ^BB is set when the mouse button is pressed without Shift (new block), else ^BB is unchanged. Then ^BK follows the mouse, until the button is released.

DoDi

Reply by email

Martin Friebe
to Andreas Berger: Persistent blocks: Keyboard: - Ctrl-K + B or Ctrl-K + Ctrl-B will define the beginning of…

I added this (enable via editor options).

Test on latest SVN / snapshot.

Andreas Berger wrote 10 lines
Persistent blocks: Keyboard: - Ctrl-K + B or Ctrl-K + Ctrl-B will define the beginning of the block. If it is before the end of the block the block is shown even if it was hidden before. - Ctrl-K + K or Ctrl-K + Ctrl-K will define the end of the block. If it is after the end of of the block the block is shown even if it was hidden before. - Ctrl-K + H or Ctrl-K + Ctrl-H will hide\unhide the block.

.....

Reply by email

Luk Vandelaer
to Andreas Berger: Persistent blocks: Keyboard: - Ctrl-K + B or Ctrl-K + Ctrl-B will define the beginning of…
Andreas Berger wrote 5 lines
Persistent blocks: - To mark a column-based block use Shift-LeftMouseButton. Wordstar used to use Ctrl-K + N or Ctrl-K + Ctrl-N to turn on/off colum based blocks, but this does not seem to work in delphi.

Delphi uses
Ctrl-O + C for column blocks,
Ctrl-O + K for character blocks (default)
Ctrl-O + L for line blocks

Luk Vandelaer

Reply by email

Jürgen Hestermann
to Martin Friebe: I added this (enable via editor options). Test on latest SVN / snapshot. .....
Martin Friebe schrieb: I added this (enable via editor options). Test on latest SVN / snapshot.

That's absolutely fantastic!
And even much better than in Delphi (at least in Version 7, where persistent blocks are used as search default - when existing - which is realy annoying).

I wasn't expecting someone to add this (and so fast). Thanks a lot.

But now that we have it, may I ask for yet another change? ;-) Is it possible that Ctrl+Q,B and Ctrl+Q,K jump to the beginning and end of the persistent block (even if hidden)? Mnemonics are: B and K are first and last character of "BlocK" in the same way as for Ctrl+K,B and Ctrl+K,K.

Reply by email

Jürgen Hestermann
to Jürgen Hestermann
Is it possible that Ctrl+Q,B and Ctrl+Q,K jump to the beginning and end of the persistent block (even if hidden)?

I just saw in the key map that these commands should already exist. But they do not work. The commands jump somewhere (but not to the beginning/end of the block) and afterwards the block does no longer exist (not even Ctrl+K,H brings it back).

Reply by email

Martin Friebe
to Jürgen Hestermann: That's absolutely fantastic! And even much better than in Delphi (at least in Version 7,…
J?rgen Hestermann wrote 8 lines
> Martin Friebe schrieb: > I added this (enable via editor options). > Test on latest SVN / snapshot. That's absolutely fantastic! And even much better than in Delphi (at least in Version 7, where persistent blocks are used as search default - when existing - which is realy annoying).

Are you sore? I think Lazarus does too. But persistent or not, Lazarus only uses "one line" blocks as default. So any multi-line block is always ignored

I wasn't expecting someone to add this (and so fast).

:)

Show quoted text 7 lines
Thanks a lot. But now that we have it, may I ask for yet another change? ;-) Is it possible that Ctrl+Q,B and Ctrl+Q,K jump to the beginning and end of the persistent block (even if hidden)? Mnemonics are: B and K are first and last character of "BlocK" in the same way as for Ctrl+K,B and Ctrl+K,K.

I made it work for hidden blocks.

I just saw in the key map that these commands should already exist. But they do not work. The commands jump somewhere (but not to the beginning/end of the block) and afterwards the block does no longer exist (not even Ctrl+K,H brings it back).

Here they do. If they still jump to random locations, please give exact directions how to reproduce. Also make sure (if you use SVN) that you did a "clean" build.

The other thing you may find about the 2 block points is that some IDE/Editor actions may change them (even is the block is shown => it would hide it). The reason is that a lot of IDE stuff (like codetools) used the selection to modify the text (this would work, that a new selection would be set, replaced, and cleared). All this had to be changed. I did so, for the stuff I found. If I missed anything, I only need to know what.

BTW column mode: should work the same as in non-persistent:
- you can use the alt key (alt left mouse; or alt shift cursor keys)
- there are three commands in the keyboard section, to change the 3 block modes (normal, column, line). You can assign whatever you want there, and then use the normal commands to set thee block

Another thing:
Syncro edit mode: It will stop offering (hide the icon) syncro edit, on a persistent block, as soon as you edit any text (inside or outside the block). In order to get it back start a new block, or hide/unhide the current. (extending the current block will NOT work) In delphi the icon stays, but is no longer updated (that is if you edit the inside of the block, and remove the last word with multiply occurrences the icon still shows / if you add the first such word, the icon would still not show, if it hadn't been there).

Martin

Reply by email

Martin Friebe
to Jürgen Hestermann: That's absolutely fantastic! And even much better than in Delphi (at least in Version 7,…

The other thing is paste from clipboard.
It doesn't set a new acts like any other edit
operation. IMHO it's more logical. But it can be changed easily.

Martin

J?rgen Hestermann wrote 18 lines
> Martin Friebe schrieb: > I added this (enable via editor options). > Test on latest SVN / snapshot. That's absolutely fantastic! And even much better than in Delphi (at least in Version 7, where persistent blocks are used as search default - when existing - which is realy annoying). I wasn't expecting someone to add this (and so fast). Thanks a lot. But now that we have it, may I ask for yet another change? ;-) Is it possible that Ctrl+Q,B and Ctrl+Q,K jump to the beginning and end of the persistent block (even if hidden)? Mnemonics are: B and K are first and last character of "BlocK" in the same way as for Ctrl+K,B and Ctrl+K,K.

Reply by email

Jürgen Hestermann
to Martin Friebe: Are you sore? I think Lazarus does too. But persistent or not, Lazarus only uses "one…
Show quoted text 6 lines
> And even much better than in Delphi (at least in Version 7, where > persistent blocks are used as search default - when existing - which > is realy annoying). Are you sore? I think Lazarus does too. But persistent or not, Lazarus only uses "one line" blocks as default. So any multi-line block is always ignored

Yes, I see it now. I only tested it with multiline blocks. But I find that behaviour a bit illogical. Why should the search dialog suddenly use the block as default (instead of the text at cursor) only because it consists of one line only? That makes no sense. I would want to use the text at cursor in *all* cases (independent from persistent blocks) because I may not even be aware that a block is still active. This way I have to think about this side effect whenever I use the search function.

> Is it possible that Ctrl+Q,B and Ctrl+Q,K jump to the beginning and > end of the persistent block (even if hidden)? I made it work for hidden blocks.

Yes, the code tools commands to jump to BEGIN and END had the same keys. After I changed that it works now.

Show quoted text 7 lines
The other thing you may find about the 2 block points is that some IDE/Editor actions may change them (even is the block is shown => it would hide it). The reason is that a lot of IDE stuff (like codetools) used the selection to modify the text (this would work, that a new selection would be set, replaced, and cleared). All this had to be changed. I did so, for the stuff I found. If I missed anything, I only need to know what.

There seems to be 2 other code tools functions that change the persistent block: Jump to BEGIN or END. Afterwards the persistent block no longer exists and cannot be recovered with Ctrl+K,H nor can I jump to its former location with Ctrl+Q,B or Ctrl+Q,K.

BTW column mode: should work the same as in non-persistent:

Yes, it works very intuitive. Here it's configured to use Alt+Shift+Cursor to select a column block while Shift-Cursor does it in standard mode.

Thanks again for adding this!

Reply by email

Martin Friebe
to Jürgen Hestermann
J?rgen Hestermann wrote 15 lines
>> And even much better than in Delphi (at least in Version 7, where >> persistent blocks are used as search default - when existing - which >> is realy annoying). > Are you sore? I think Lazarus does too. But persistent or not, > Lazarus only uses "one line" blocks as default. So any multi-line > block is always ignored Yes, I see it now. I only tested it with multiline blocks. But I find that behaviour a bit illogical. Why should the search dialog suddenly use the block as default (instead of the text at cursor) only because it consists of one line only? That makes no sense. I would want to use the text at cursor in *all* cases (independent from persistent blocks) because I may not even be aware that a block is still active. This way I have to think about this side effect whenever I use the search function.

I don't disagree.
I just pointed out, that nothing changed. For non persistent blocks, it was ok to use the block, and since you usually not search for multi line strings it was ok to limit it to one line blocks.

For persistent, I would actually think the past was to limit it to one-line blocks, but only if the cursor is IN or AT the block

Show quoted text 13 lines
> The other thing you may find about the 2 block points is that some > IDE/Editor actions may change them (even is the block is shown => it > would hide it). The reason is that a lot of IDE stuff (like > codetools) used the selection to modify the text (this would work, > that a new selection would be set, replaced, and cleared). All this > had to be changed. I did so, for the stuff I found. If I missed > anything, I only need to know what. There seems to be 2 other code tools functions that change the persistent block: Jump to BEGIN or END. Afterwards the persistent block no longer exists and cannot be recovered with Ctrl+K,H nor can I jump to its former location with Ctrl+Q,B or Ctrl+Q,K.

Will look at later.

Reply by email

Jürgen Hestermann
to Martin Friebe
Show quoted text 12 lines
> Yes, I see it now. I only tested it with multiline blocks. But I find > that behaviour a bit illogical. Why should the search dialog suddenly > use the block as default (instead of the text at cursor) only because > it consists of one line only? That makes no sense. I would want to use > the text at cursor in *all* cases (independent from persistent blocks) > because I may not even be aware that a block is still active. This way > I have to think about this side effect whenever I use the search > function. I don't disagree. I just pointed out, that nothing changed. For non persistent blocks, it was ok to use the block, and since you usually not search for multi line strings it was ok to limit it to one line blocks.

So the behaviour is the same for persistent and non-persistant blocks? I may see a merit in having this default for non-persistent blocks (because in general there will be no block selected when starting the search function) but for persistent blocks it's a nightmare.

For persistent, I would actually think the past was to limit it to one-line blocks, but only if the cursor is IN or AT the block

I think that this is trying to be too smart. Users have problems to consider such side effects. KISS would be better here (Keep It Simple and Stupid). It should always work predictable without doing lengthy thinking.

There are many reasons why a block is selected when start searching for something (especially in persistent mode) so it's not a good idea to use it as default at all (independent from whether it's a one or more line block). I think the way it was in Turbo Pascal was the best. If a user wanted to search for text from the code he could simply put the cursor on a word and the search dialog took it as default (no need to think about current block definitions). With Shift+CursorRight the default could even be extended.

So my wish would be to switch off using the block as search default (at least in persistent mode). Maybe one day I am able to do such things myself but currently I am still learning about Lazarus/Free Pascal.

Reply by email

Martin Friebe
to Luk Vandelaer: Delphi uses Ctrl-O + K for character blocks (default) Ctrl-O + L for line blocks Luk…

enviroment => options => eitor => "key mapping" => "text selection commands" => 4th to 6th entry:
Normal selection mode
column selection mode
Line selection mode

Luk Vandelaer wrote 21 lines
On Wednesday 22 July 2009 13:43, Andreas Berger wrote: > Persistent blocks: > - To mark a column-based block use Shift-LeftMouseButton. Wordstar used > to use Ctrl-K + N or Ctrl-K + Ctrl-N to turn on/off colum based blocks, > but this does not seem to work in delphi. > > Delphi uses Ctrl-O + C for column blocks, Ctrl-O + K for character blocks (default) Ctrl-O + L for line blocks Luk Vandelaer -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email