Bookstore

Recent

Author Topic: [solved] IDE Shortcuts to move and duplicate lines?  (Read 9852 times)

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6051
    • wiki
Re: [solved] IDE Shortcuts to move and duplicate lines?
« Reply #15 on: January 19, 2020, 01:08:29 am »
It's better to move whole statements when possible. Like in IntelliJ.
There is little sense to move a part of statement or declaration.
I can see that people may want to move part of an expression/calculation. Or change order of arguments passed to a function.

Anyway, if there is move-line an move-selection, then it would be a matter of selecting to statement boundaries (which is not on my current list, sorry). Most people will not have more than one statement per line. So moving lines will do this in that case.


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6051
    • wiki
Re: [solved] IDE Shortcuts to move and duplicate lines?
« Reply #16 on: January 21, 2020, 08:29:45 pm »
Added DuplicateSelection,
Also added MoveSelection... left/right/up/down

They do nothing, if there is no selection.



If you want the "duplicate line" to act on selection (if a selection is available), then you can create an editor macro "if Caller.SelAvail then ecDuplicateSelection else ecDuplicateLine;"
https://wiki.lazarus.freepascal.org/Editor_Macros_PascalScript
« Last Edit: January 21, 2020, 08:32:56 pm by Martin_fr »