helwardany / pyscripter

Automatically exported from code.google.com/p/pyscripter
0 stars 0 forks source link

Implement duplicate line command #501

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. user has to select line, Ctrl+C, Ctrl+V (2 times) to duplicate existing line
2. some IDE allow for a duplicate command (usually mapped to Ctrl+D)
3.

What is the expected output? What do you see instead?
Ctrl+D should take the currect line contents and duplicate its contents to the 
line above (identical to duplicate to below and move cursor afterwards to the 
newly created line). This way the user can immediately edit the cloned line.

Original issue reported on code.google.com by robertsc...@googlemail.com on 8 Apr 2011 at 7:26

GoogleCodeExporter commented 9 years ago
this should be really easy to implement just summing the commands listed under 
1.

Original comment by robertsc...@googlemail.com on 8 Apr 2011 at 7:29

GoogleCodeExporter commented 9 years ago
if an area has already been selected, this area should be duplicated, i.e. the 
command should not be limited to a line

implementation could still rely on the summatino of commands with the selection 
of the line being conditional on an already existing selection

Original comment by robertsc...@googlemail.com on 8 Apr 2011 at 7:56

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Actually to duplicate a line you only need
Ctrl+Ins, Shift+Ins

Copy without a selection copies the current line to the clipboard.

Just two keystrokes.  So I am not sure this is worth the trouble.

Original comment by pyscripter on 6 Jun 2011 at 2:28

GoogleCodeExporter commented 9 years ago
I know this works for a single line but to duplicate multiple lines you need to 
select the area first (shift+arrows or mouse).

Additionally, after doing Ctrl+Ins + Shift+Ins (or Crtl+C + Crtl+V) you end up 
after the copied portion. For coding purposes it would be more prudent to leave 
the selected lines selected after the duplicate command, so that an additional 
comment out command will comment out the original code.

In this way, the user can easily and securely create a working copy of existing 
code for debugging/modifications. For me that's something happening quite often.

Original comment by robertsc...@googlemail.com on 6 Jun 2011 at 8:11

GoogleCodeExporter commented 9 years ago
Also the Ctrl+Ins, Shift+Ins trick does not work if you use Ctrl+C, Ctrl+V 
instead. That is, it would be great if hitting Ctrl+C with no selection simply 
copied the current line.

Original comment by angel.ez...@gmail.com on 21 Aug 2011 at 3:18

GoogleCodeExporter commented 9 years ago
I agree with @angel. Until I read @pyscripter's note, I had no idea that 
Ctrl+Ins would copy the whole line. I assumed this would be the case for *any* 
copy shortcut (e.g. Ctrl+C), as it is for many editors, but there is a 
discrepancy between the different copy shortcuts. (In the Editor 
Options->Keystrokes page, there is no distinguishing difference between the two 
copy shortcuts.)

This is very confusing for users and not a very discoverable feature (unless 
they regularly read the issues page!).

Original comment by pckuj...@gmail.com on 9 Mar 2012 at 5:26

Attachments:

GoogleCodeExporter commented 9 years ago
The Ctrl+C issue has been fixed.  Now both Ctrl+C and Ctrl+Inst copy the 
current line if the selection is empty.  

Note that Edit Cut works similarly.

Original comment by pyscripter on 10 Mar 2012 at 1:39