[Github-comments] [geany-plugins] Add new "Lineoperations" plugin (#324)
Colomban Wendling
notifications at xxxxx
Sun Jan 10 02:34:21 UTC 2016
> + }
> + 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);
> + }
I'd probably rather implement this one using only direct Scintilla manipulation:
```C
gint line_count;
sci_start_undo_action(sci);
line_count = sci_get_line_count(sci);
for (gint line = 0; line < line_count; line++) {
if (sci_get_position_from_line(sci, line) == sci_get_line_end_position(sci, line)) {
scintilla_send_message(sci, SCI_DELETERANGE,
sci_get_position_from_line(sci, line),
sci_get_line_length(sci, line));
line_count--;
}
}
sci_end_undo_action(sci);
```
or similar
---
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/324/files#r49270781
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20160109/73878d2b/attachment.html>
More information about the Github-comments
mailing list