Wish Duplicate Line should work on full selection, if one exists

Sandman

Expert
Licensed User
Longtime User
If I select a number of lines and use the Duplicate Line command, only the last selected line is duplicated.

I propose that if a selection exists, the full selection should be duplicated. If one line (or none, the cursor is just placed somewhere), it should work as it currently does.
 

wonder

Expert
Licensed User
Longtime User
IMO duplicated code is a very very bad practice. It shouldn't be encouraged by such functionality.
 

Sandman

Expert
Licensed User
Longtime User
IMO duplicated code is a very very bad practice. It shouldn't be encouraged by such functionality.

I am absolutely stunned by the fact that you could even imagine that I'd use it to simply duplicate code.

Also, I'd like to encourage you to use IMHO instead of IMO, and actually use the H.
 

wonder

Expert
Licensed User
Longtime User
It wasn't a personal attack, I simply expressed my (not humble) opinion.

You requested the expansion of the line duplication feature in B4X, so that it would be able to duplicate several lines of code.
Therefore I believe it's perfectly understandable that I assumed you would use it to duplicate lines of code.

"Code duplication is bad because it's hard to maintain, even with minor changes."
If you'd like to have a civilized discussion on this matter, I'll be happy to participate and elaborate on my point of view. :)
 

Sandman

Expert
Licensed User
Longtime User
I think you've already made your point of view quite clear, so I'll pass on your offer. However, I do find it disappointing that you are more interested in pushing your opinion than being interested in why I even feel the need to duplicate multiple lines.

For the people actually interested in my reasoning, I'm simply going to point to two factors:
  1. Consistency. This is how other things work in the IDE already. If you have a selection and Copy it, the whole selection is copied and not just the line where the cursor ended up. If you have a selection and move it using Alt-up/down, you move the whole selection and not just the line where the cursor ended up.

  2. Standard behaviour. At least two well-known editors commonly used for code have this exact behaviour: Both Sublime Text and Visual Studio Code has it under the keyboard command Control-Shift-d (might be different on Mac).
 

wonder

Expert
Licensed User
Longtime User
you are more interested in pushing your opinion than being interested in why I even feel the need to duplicate multiple lines
On the contrary, I'm always open to discuss new ideas and I'm not afraid of being wrong.

Now that you have made your reasoning quite clear, it's up to Erel's decision to consider your suggestion. Nevertheless, thanks for clarifying.

All I tried to point out was that, code duplication (and I am guilty of it) is a bad practice, don't you agree? :)
 

Sandman

Expert
Licensed User
Longtime User
I agree that it would have been better if this feature would duplicate all selected lines.

Not that it's overly important, but I'm a bit curious: Is this functionality handled by the IDE editor widget? (I understand you're using a third-party solution for that.)
 
Top