Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctrl-D duplicating too much text #1075

Open
philiprbrenan opened this issue Jun 16, 2016 · 2 comments · May be fixed by #1228
Open

Ctrl-D duplicating too much text #1075

philiprbrenan opened this issue Jun 16, 2016 · 2 comments · May be fixed by #1228

Comments

@philiprbrenan
Copy link

philiprbrenan commented Jun 16, 2016

If I select line 1 and just 1 character of line 2 and press Ctrl-D I get more text from line 2 duplicated than expected. In other contexts, Ctrl-D duplicates just the hilighted text. Please consider making the behavior more consistent as consistency is one of the reasons that Geany is so useful and easy to learn. Thanks!

b1
b2

Before
a1

After Ctrl-D
a2

Before
c1
After Ctrl-D
c2

@philiprbrenan philiprbrenan changed the title Cntrl-D duplicating too much text Ctrl-D duplicating too much text Jun 16, 2016
@b4n
Copy link
Member

b4n commented Jun 16, 2016

It's actually a feature that Ctrl+D duplicates whole lines when more than one is selected. Your first before/after duplicating exactly one line is also expected, because you actually only selected 1 whole line, nothing on the next. You selected ABC\n (e.g. the line contents and the line ending character), so only 1 line, hence it duplicates that line only. In your first example it duplicated the 2 lines because you selected more than one line.

If there is a bug here, it is that when a line doesn't end with a newline (like in your first unexpected example) it doesn't add such a new line and simply duplicates the range (missing the newline), leading to the lines combining as in your example. This does not happen if there's a newline character at the end of the line.

@elextr
Copy link
Member

elextr commented Jun 16, 2016

My comment seems to have been "misplaced", it said:

The keystroke is used to do two things, duplicate selection and duplicate lines, so it has to choose which one to do.

The choice is to duplicate lines anytime the selection includes a line end, or there is no selection, otherwise to duplicate the selection.

The documentation could be improved to spell this out.

mgruben added a commit to mgruben/geany that referenced this issue Sep 11, 2016
Previously, the documentation on the duplication did not clearly delineate the behavior of the `duplication` keystroke.
Specifically, it was possible to interpret this keystroke as performing selection-only `duplication`.
However, `duplication` only duplicates the selection on the same line, or the multiple lines which are selected.

Accordingly, add additional statements clarifying the behavior of `duplication`.

This is intended to fix [issue geany#1075](geany#1075)
@mgruben mgruben linked a pull request Sep 11, 2016 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants