[Github-comments] [geany/geany-plugins] git-changebar: Add the possibility to undo hunk at cursor position (#531)
Jiří Techet
notifications at xxxxx
Sat May 13 20:50:49 UTC 2017
techee commented on this pull request.
> +
+ if (data->found) {
+ ScintillaObject *sci = doc->editor->sci;
+
+ sci_start_undo_action(sci);
+
+ if (data->new_lines > 0) {
+ gint pos = sci_get_position_from_line(sci, data->new_start - 1);
+ sci_set_target_start(sci, pos);
+ pos = sci_get_position_from_line(sci, data->new_start + data->new_lines - 1);
+ sci_set_target_end(sci, pos);
+ sci_replace_target(sci, "", FALSE);
+ }
+
+ if (data->old_lines > 0) {
+ gint line = sci_get_current_line (sci);
`gint pos = sci_get_position_from_line (sci, data->new_start - 1);` returns the pos on the previous line which is wrong when undoing deleted-only diff - I need to advance it to the next line if `new_lines == 0` (see a few lines below). I could probably get the length of the line and add it to pos in this case.
Just to understand - what does scintilla return from sci_get_current_line() when you right-click somewhere - I'd expect it doesn't change the current line, does it?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/531#discussion_r116367044
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170513/da5cfd9e/attachment.html>
More information about the Github-comments
mailing list