Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Mon, 22 May 2017 13:06:15 UTC Commit: c02fc17affdecaa3743a6dc012e21f061b4e4020 https://github.com/geany/geany-plugins/commit/c02fc17affdecaa3743a6dc012e21f...
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).
plugins-commits@lists.geany.org