Recent

Author Topic: Multi-caret in text box?  (Read 610 times)

vinny

  • Newbie
  • Posts: 1
Multi-caret in text box?
« on: February 05, 2019, 10:40:00 pm »
Is there a way of creating multiple carets in the included text area component?

Here's an example: https://www.youtube.com/watch?v=xnKN0T_UBgU

jamie

  • Hero Member
  • *****
  • Posts: 1654
Re: Multi-caret in text box?
« Reply #1 on: February 05, 2019, 10:42:49 pm »
In windows, there is only ONE caret.

If you want more and I don't know what you would you can simulate a caret using a Timer but then you
would also need to support all of that goes with a caret operation.



Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5454
    • wiki
Re: Multi-caret in text box?
« Reply #2 on: February 05, 2019, 10:48:07 pm »
SynEdit (The editor in the IDE) has this feature.

There are various options.
http://wiki.lazarus.freepascal.org/SynEdit_MultiCaret_plugin

In the IDE
1) Use shift-alt-cursor up/down. Same as creating a block-mode selection, but you can create it with zero width. A caret appears on each line.

2) shift-ctrl mouse

3) shift-ctrl insert, and then cursor keys. Repeat for each caret needed.
  As soon as you set all needed carets, start typing (add/del text)


home/end can either move all carets, or reduce to one caret.
There are options for this.
And you can set a keycombo to toggle this.

http://wiki.lazarus.freepascal.org/New_IDE_features_since#Multi_Caret



SynEdit also has syncro edit, which is similar.
http://wiki.lazarus.freepascal.org/New_IDE_features_since#Syncron-Edit



For the end of line...

Option 1)
Tools -> Option -> Editor -> General: "Navigation keys move all carets (column select)" = checked

- Go to start of first line,
- alt-shift-cursor_down until each line has a caret
- end key

Option 2)
Tools -> Option -> Editor -> General: "Navigation keys move all carets (column select)" = NOT checked
Tools -> Option -> Editor -> Key Mapping: "Multi Caret Commands" > "Cursor keys move all extra carets" = Alt-Shift-M  (or what you like)

- Go to start of first line,
- alt-shift-cursor_down until each line has a caret
- Alt-Shift-M
- end key

Option 3)
See the link above (new features...), animated gif
« Last Edit: February 05, 2019, 11:09:58 pm by Martin_fr »