Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Mon, 22 May 2017 13:06:15 UTC
Commit: c02fc17affdecaa3743a6dc012e21f061b4e4020
https://github.com/geany/geany-plugins/commit/c02fc17affdecaa3743a6dc012e21…
Log Message:
-----------
git-changebar: Move cursor at the end of the undone hunk text for deleted hunk
For deleted hunk, move cursor at the end of the undone text. This
behavior corresponds to what normal undo does - when undoing deletion,
cursor is also placed at the end of the newly inserted text.
Also change primary position for SCI_SCROLLRANGE in this case so it becomes
the cursor position.
Modified Paths:
--------------
git-changebar/src/gcb-plugin.c
Modified: git-changebar/src/gcb-plugin.c
12 lines changed, 7 insertions(+), 5 deletions(-)
===================================================================
@@ -1190,28 +1190,30 @@ undo_hunk_cb (const gchar *path,
if (data->found) {
ScintillaObject *sci = doc->editor->sci;
gint line = data->new_start - (data->new_lines ? 1 : 0);
+ gint pos = sci_get_position_from_line (sci, line);
sci_start_undo_action (sci);
if (data->new_lines > 0) {
- gint pos = sci_get_position_from_line (sci, line);
sci_set_target_start (sci, pos);
pos = sci_get_position_from_line (sci, line + data->new_lines);
sci_set_target_end (sci, pos);
sci_replace_target (sci, "", FALSE);
}
if (data->old_lines > 0) {
- gint pos = sci_get_position_from_line (sci, line);
-
+ pos = sci_get_position_from_line (sci, line);
insert_buf_range (doc, contents, pos,
data->old_start - 1,
data->old_lines);
+
+ pos = sci_get_position_from_line (sci, line + data->old_lines);
+ sci_set_current_position (sci, pos, FALSE);
}
scintilla_send_message (sci, SCI_SCROLLRANGE,
- sci_get_position_from_line (sci, line + data->old_lines),
- sci_get_position_from_line (sci, line));
+ sci_get_position_from_line (sci, line),
+ pos);
sci_end_undo_action (sci);
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
Branch: refs/heads/master
Author: Jiří Techet <techet(a)gmail.com>
Committer: Jiří Techet <techet(a)gmail.com>
Date: Mon, 22 May 2017 13:06:15 UTC
Commit: 4242fb95d60f8bf35bbe16780927aa8e72987614
https://github.com/geany/geany-plugins/commit/4242fb95d60f8bf35bbe16780927a…
Log Message:
-----------
git-changebar: Update documentation with the "undo hunk" feature
Modified Paths:
--------------
git-changebar/README
Modified: git-changebar/README
8 lines changed, 6 insertions(+), 2 deletions(-)
===================================================================
@@ -8,8 +8,8 @@ Git Change Bar
About
=====
-This plugin highlights uncommitted changes to files tracked with Git, and
-allows to navigate through the hunks.
+This plugin highlights uncommitted changes to files tracked with Git,
+allows to navigate through the hunks and undo them.
Requirements
@@ -38,6 +38,10 @@ To navigate through the hunks of the current file, you need to configure the
plugin's *Go to next hunk* and *Go to previous hunk* keybindings in Geany's
preferences dialog.
+Hunks can also be undone by either setting a cursor at a line with a hunk and
+invoking the *Undo hunk at the cursor position* or by right-clicking in the
+editor where the hunk is located and selecting *Undo Git hunk* from the popup
+menu.
License
=======
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).