fix remaining selection backspace bugs
This commit is contained in:
@@ -137,18 +137,20 @@ main :: proc() {
|
|||||||
earliest_selection := get_selection_for_line(earliest_line[:], earliest.line)
|
earliest_selection := get_selection_for_line(earliest_line[:], earliest.line)
|
||||||
remove_range(earliest_line, earliest_selection.start, earliest_selection.end)
|
remove_range(earliest_line, earliest_selection.start, earliest_selection.end)
|
||||||
if latest.line != earliest.line {
|
if latest.line != earliest.line {
|
||||||
latest_line := &lines[latest.line]
|
latest_line := lines[latest.line]
|
||||||
latest_selection := get_selection_for_line(latest_line[:], latest.line)
|
latest_selection := get_selection_for_line(latest_line[:], latest.line)
|
||||||
append(earliest_line, string(latest_line[latest_selection.end:len(latest_line)]))
|
append(earliest_line, string(latest_line[latest_selection.end:len(latest_line)]))
|
||||||
defer delete(latest_line^)
|
|
||||||
ordered_remove(&lines, latest.line)
|
ordered_remove(&lines, latest.line)
|
||||||
|
delete(latest_line)
|
||||||
|
if selection.start.line < selection.end.line {
|
||||||
cursor.line -= 1
|
cursor.line -= 1
|
||||||
|
}
|
||||||
for i := earliest.line + 1; i < latest.line; i += 1 {
|
for i := earliest.line + 1; i < latest.line; i += 1 {
|
||||||
line_to_remove := lines[i]
|
line_to_remove := lines[i]
|
||||||
defer delete(line_to_remove)
|
defer delete(line_to_remove)
|
||||||
ordered_remove(&lines, i)
|
ordered_remove(&lines, i)
|
||||||
// NOTE(grant): Should we do this here?
|
// NOTE(grant): Should we do this here?
|
||||||
if i < cursor.line {
|
if selection.start.line < selection.end.line {
|
||||||
cursor.line -= 1
|
cursor.line -= 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user