<p>In <a href="https://github.com/geany/geany-plugins/pull/324#discussion_r49270781">lineoperations/src/linefunctions.c</a>:</p>
<pre style='color:#555'>> + }
> + else if(linelen != 1)
> + {
> + line = sci_get_line(doc->editor->sci, i);
> +
> + // copy current line into *newfile
> + for(j = 0; line[j] != '\0'; j++)
> + newfile[nfposn++] = line[j];
> + }
> + }
> + newfile[nfposn] = '\0';
> + sci_set_text(doc->editor->sci, newfile); // set new document
> +
> +
> + g_free(newfile);
> + }
</pre>
<p>I'd probably rather implement this one using only direct Scintilla manipulation:</p>
<div class="highlight highlight-source-c"><pre>gint line_count;
<span class="pl-en">sci_start_undo_action</span>(sci);
line_count = sci_get_line_count(sci);
<span class="pl-k">for</span> (gint line = <span class="pl-c1">0</span>; line < line_count; line++) {
<span class="pl-k">if</span> (<span class="pl-c1">sci_get_position_from_line</span>(sci, line) == <span class="pl-c1">sci_get_line_end_position</span>(sci, line)) {
<span class="pl-c1">scintilla_send_message</span>(sci, SCI_DELETERANGE,
<span class="pl-c1">sci_get_position_from_line</span>(sci, line),
<span class="pl-c1">sci_get_line_length</span>(sci, line));
line_count--;
}
}
<span class="pl-en">sci_end_undo_action</span>(sci);</pre></div>
<p>or similar</p>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/geany/geany-plugins/pull/324/files#r49270781">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABDrJwZr2K4JjlGArneYQIQuyrEsvj_Dks5pYbqtgaJpZM4HBhj7.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-plugins/pull/324/files#r49270781"></link>
<meta itemprop="name" content="View Pull Request"></meta>
</div>
<meta itemprop="description" content="View this Pull Request on GitHub"></meta>
</div>