Repository: spyder-ide/spyder

Issue:
Copy line and duplicate line shortcuts are confusing
In my opinion, the `copy line` and `duplicate line` shortcuts are confusing. From the dosctrings in the source code, these shortcuts are defined as :

copy line :  Paste the duplicated text *before* the current line/selected text
duplicate line: Paste the duplicated text *after* the current line/selected text

I think that "copy" and "duplicate" do not imply that the text is copied either up or down or below or after. I think it would be clearer if, as in vscode for example, we refer to these shortcuts as:

- `Copy line down` and `Copy line up` or
- `Copy line above` and `Copy line below` or
- `Duplicate line down` and `Duplicate line up` or
- `Duplicate line above` and `Duplicate line below`

https://vscode-docs.readthedocs.io/en/stable/customization/keybindings/

![image](https://user-images.githubusercontent.com/10170372/70855889-45a0fb00-1ea0-11ea-8c28-91a76db7d7a6.png)



Discussion:
Agreed!
+1 from me too.

Resolving patch:
diff --git a/spyder/config/main.py b/spyder/config/main.py
--- a/spyder/config/main.py
+++ b/spyder/config/main.py
@@ -366,10 +366,10 @@
               # ---- Editor ----
               # -- In widgets/sourcecode/codeeditor.py
               'editor/code completion': CTRL+'+Space',
-              'editor/duplicate line': "Ctrl+Alt+Up" if WIN else \
-                                       "Shift+Alt+Up",
-              'editor/copy line': "Ctrl+Alt+Down" if WIN else \
-                                  "Shift+Alt+Down",
+              'editor/duplicate line up': (
+                  "Ctrl+Alt+Up" if WIN else "Shift+Alt+Up"),
+              'editor/duplicate line down': (
+                  "Ctrl+Alt+Down" if WIN else "Shift+Alt+Down"),
               'editor/delete line': 'Ctrl+D',
               'editor/transform to uppercase': 'Ctrl+Shift+U',
               'editor/transform to lowercase': 'Ctrl+U',
@@ -615,4 +615,4 @@
 #    or if you want to *rename* options, then you need to do a MAJOR update in
 #    version, e.g. from 3.0.0 to 4.0.0
 # 3. You don't need to touch this value if you're just adding a new option
-CONF_VERSION = '55.0.0'
+CONF_VERSION = '56.0.0'
diff --git a/spyder/plugins/editor/widgets/base.py b/spyder/plugins/editor/widgets/base.py
--- a/spyder/plugins/editor/widgets/base.py
+++ b/spyder/plugins/editor/widgets/base.py
@@ -676,17 +676,17 @@ def __duplicate_line_or_selection(self, after_current_line=True):
         cursor.insertText(text)
         cursor.endEditBlock()
 
-    def duplicate_line(self):
+    def duplicate_line_down(self):
         """
-        Duplicate current line or selected text
-        Paste the duplicated text *after* the current line/selected text
+        Copy current line or selected text and paste the duplicated text
+        *after* the current line or selected text.
         """
         self.__duplicate_line_or_selection(after_current_line=True)
 
-    def copy_line(self):
+    def duplicate_line_up(self):
         """
-        Copy current line or selected text
-        Paste the duplicated text *before* the current line/selected text
+        Copy current line or selected text and paste the duplicated text
+        *before* the current line or selected text.
         """
         self.__duplicate_line_or_selection(after_current_line=False)
 
diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py
--- a/spyder/plugins/editor/widgets/codeeditor.py
+++ b/spyder/plugins/editor/widgets/codeeditor.py
@@ -693,8 +693,8 @@ def create_shortcuts(self):
         """Create the local shortcuts for the CodeEditor."""
         shortcut_context_name_callbacks = (
             ('editor', 'code completion', self.do_completion),
-            ('editor', 'duplicate line', self.duplicate_line),
-            ('editor', 'copy line', self.copy_line),
+            ('editor', 'duplicate line down', self.duplicate_line_down),
+            ('editor', 'duplicate line up', self.duplicate_line_up),
             ('editor', 'delete line', self.delete_line),
             ('editor', 'move line up', self.move_line_up),
             ('editor', 'move line down', self.move_line_down),


Test patch:
diff --git a/spyder/plugins/editor/widgets/tests/test_editor.py b/spyder/plugins/editor/widgets/tests/test_editor.py
--- a/spyder/plugins/editor/widgets/tests/test_editor.py
+++ b/spyder/plugins/editor/widgets/tests/test_editor.py
@@ -253,14 +253,14 @@ def test_copy_lines_down_up(editor_bot, mocker, qtbot):
     assert editor.textCursor().selection().toPlainText() == 'a = 1\nprint(a)\n'
 
     # Copy lines down.
-    editor.duplicate_line()
+    editor.duplicate_line_down()
     qtbot.wait(100)
     assert editor.get_cursor_line_column() == (2, 0)
     assert editor.textCursor().selection().toPlainText() == 'a = 1\nprint(a)\n'
     assert editor.toPlainText() == 'a = 1\nprint(a)\n' * 2 + '\nx = 2\n'
 
     # Copy lines up.
-    editor.copy_line()
+    editor.duplicate_line_up()
     qtbot.wait(100)
     assert editor.get_cursor_line_column() == (4, 0)
     assert editor.textCursor().selection().toPlainText() == 'a = 1\nprint(a)\n'