[Github-comments] [geany/geany-plugins] git-changebar: Add the possibility to undo hunk at cursor position (#531)

Colomban Wendling notifications at xxxxx
Fri May 5 02:08:10 UTC 2017


b4n commented on this pull request.

I didn't yet do any kind of proper review (not even tested it yet), but sounds reasonable and the feature seems great :)

I'll try and make a proper review in the upcoming days if I can get enough Internet (yeah, not sure I'll make it through without any, crossing fingers :]).

> @@ -1044,13 +1053,13 @@ goto_next_hunk_diff_hunk_cb (const git_diff_delta *delta,
       if (data->next_line >= 0) {
         return 1;
       } else if (data->line < hunk->new_start - 1) {
-        data->next_line = hunk->new_start - 1;
+        data->next_line = (hunk->new_start == 0) ? 0 : hunk->new_start - 1;

maybe it'd be worth creating a function/macro for that, as it's repeated 3 times?  Not sure of a name for it yet though :)

> +  gint             old_pos_start, old_pos_end;
+  gchar           *old_range;
+  
+  /* convert the buffer to UTF-8 if necessary */
+  if (encoding_needs_coversion (doc->encoding)) {
+    free_buf = convert_encoding_inplace (&old_buf, &old_buf_len, free_buf,
+                                         "UTF-8", doc->encoding, NULL);
+  }
+  
+  scintilla_send_message (old_sci, SCI_ADDTEXT, old_buf_len, (glong) old_buf);
+
+  old_pos_start = sci_get_position_from_line (old_sci, old_start);
+  old_pos_end = sci_get_position_from_line (old_sci, old_start + old_lines);
+  old_range = sci_get_contents_range (old_sci, old_pos_start, old_pos_end);
+
+  sci_insert_text(doc->editor->sci, pos, old_range);

style: space before the open parenthesis

-- 
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#pullrequestreview-36425261
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20170504/867d7187/attachment.html>


More information about the Github-comments mailing list