Skip to content

Commit

Permalink
shiftcolumn: Fix shifting when the selection was created backwards
Browse files Browse the repository at this point in the history
  • Loading branch information
b4n committed Feb 20, 2016
1 parent 5a898d9 commit dc0af51
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions shiftcolumn/src/shiftcolumn.c
Expand Up @@ -123,6 +123,7 @@ static void shift_left_cb(G_GNUC_UNUSED GtkMenuItem *menuitem,

/* put the new text in */
sci_set_selection_start(sci, startpos - 1);
sci_set_selection_end(sci, endpos);
sci_replace_sel(sci, txt);

/* select the right bit again */
Expand Down Expand Up @@ -261,6 +262,7 @@ static void shift_right_cb(G_GNUC_UNUSED GtkMenuItem *menuitem,
sci_start_undo_action(sci);

/* put the new text in */
sci_set_selection_start(sci, startpos);
sci_set_selection_end(sci, endpos + 1);
sci_replace_sel(sci, txt);

Expand Down

1 comment on commit dc0af51

@b4n
Copy link
Member Author

@b4n b4n commented on dc0af51 Feb 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the selection start > end, just swapping the vars is not enough, when altering it it has to set both ends.

Please sign in to comment.