<p>It's actually a feature that <kbd>Ctrl+D</kbd> 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 <code>ABC\n</code> (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.</p>

<p>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.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/geany/geany/issues/1075#issuecomment-226508846">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe/ABDrJzIH8BXAViYChpNRCxN7YTKsWVJsks5qMWLQgaJpZM4I3bGF">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJ3Vi_-CRBhu8IzxLBM4Sgp9eysBoks5qMWLQgaJpZM4I3bGF.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/geany/geany/issues/1075#issuecomment-226508846"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>