Duplicating lines does not work properly, e.g. if I try to duplicate the lines in the following screenshot:
then I get this:
instead of this:
Is there a setting so I can change this behaviour so that it works just like in NetBeans?
Is there a setting so I can change this behaviour so that it works just like in NetBeans?
For "Duplicate Selection" action (which is what you are using) -- No; there is no such option (to auto reformat code after such operation or whatnot) and you will have to make "proper" selection (to include whole lines) to have desired behaviour.
Currently this action (Duplicate Selection) behaves correctly: it duplicates only selected text and nothing else.
But .. you can use "Duplicate Entire Lines" action instead ... which will duplicate WHOLE lines where selection is present (even if it's only one character selected on that line).
Just assign desired shortcut and use where needed.
Settings/Preferences | Keymap
duplicate
into local search box to narrow possible resultsEditor Actions | Duplicate Entire Lines
in those results