Skip to content

Commit

Permalink
🐛 Fix incorrect cut & copy range
Browse files Browse the repository at this point in the history
  • Loading branch information
ayuusweetfish committed Feb 21, 2019
1 parent ed877d9 commit db56a3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion main.pixi
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ menu_btns_text[4].cb = roll_redo
menu_btns_text[5].cb = {
if (roll_shift) { roll_clearsel() } else { roll_cut() }
}
menu_btns_text[6].cb = roll_copy
menu_btns_text[6].cb = { roll_copy(1) }
menu_btns_text[7].cb = roll_paste
menu_btns_text[8].cb = {
roll_toggle_play()
Expand Down
13 changes: 6 additions & 7 deletions roll.pixi
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ fn roll_remove_dup_attr($tid, $x) {
$i = 0
while ($i < $cnt) {
$n = $l[$i]
if ($n.len == 0 && $n.x == $x) {
if ($n.y == NOCHANGE && $n.x == $x) {
remove_note($tid, $i)
$cnt - 1
continue
Expand Down Expand Up @@ -603,9 +603,8 @@ fn roll_break($x) {
}

fn roll_cut() {
roll_copy()
roll_copy(0)
roll_shrink()
roll_push_history()
}

fn sort_sel_endpts() {
Expand All @@ -616,7 +615,7 @@ fn sort_sel_endpts() {
}
}

fn roll_copy() {
fn roll_copy($save_history) {
sort_sel_endpts()
$x1 = roll_sside
$x2 = roll_sfin
Expand All @@ -637,7 +636,7 @@ fn roll_copy() {
$new = 0
while ($i < $cnt) {
$n = $l[$i]
if ($n.x >= $x1 && $n.x < $x2) {
if ($n.x >= $x1 && $n.x <= $x2) {
roll_clip[$j][$new] = clone($n)
roll_clip[$j][$new].x - $x1
$new + 1
Expand All @@ -649,7 +648,7 @@ fn roll_copy() {
$j + 1
}

roll_push_history()
if ($save_history) { roll_push_history() }
}

fn roll_clear_clipboard() {
Expand Down Expand Up @@ -723,7 +722,7 @@ fn roll_shrink() {
$i = 0
while ($i < $cnt) {
$n = $l[$i]
if ($n.x >= $x2) {
if ($n.x > $x2) {
$n.x - ($x2 - $x1 + 1)
} else {
if ($n.x >= $x1) {
Expand Down

0 comments on commit db56a3f

Please sign in to comment.