mirror of
https://github.com/lihop/godot-xterm.git
synced 2024-11-22 09:40:25 +01:00
refactored some collisions
This commit is contained in:
parent
2b3e40d39e
commit
85e6e8807e
4 changed files with 12 additions and 12 deletions
|
@ -291,8 +291,8 @@ func _reflow_smaller(new_cols: int, new_rows: int) -> void:
|
|||
|
||||
# Record original lines so they don't get overridden when we rearrange the list
|
||||
var original_lines = []
|
||||
for i in range(lines.length):
|
||||
original_lines.append(lines.get_line(i))
|
||||
for j in range(lines.length):
|
||||
original_lines.append(lines.get_line(j))
|
||||
var original_lines_length = lines.length
|
||||
|
||||
var original_line_index = original_lines_length - 1
|
||||
|
@ -322,10 +322,10 @@ func _reflow_smaller(new_cols: int, new_rows: int) -> void:
|
|||
|
||||
# Update markers
|
||||
var insert_count_emitted = 0
|
||||
for i in range(insert_events.size() - 1, -1, -1):
|
||||
insert_events[i].index += insert_count_emitted
|
||||
lines.emit_signal("inserted", insert_events[i])
|
||||
insert_count_emitted += insert_events[i].amount
|
||||
for k in range(insert_events.size() - 1, -1, -1):
|
||||
insert_events[k].index += insert_count_emitted
|
||||
lines.emit_signal("inserted", insert_events[k])
|
||||
insert_count_emitted += insert_events[k].amount
|
||||
var amount_to_trim = max(0, original_lines_length + count_to_insert - lines.max_length)
|
||||
if amount_to_trim > 0:
|
||||
lines.emit_signal("trimmed", amount_to_trim)
|
||||
|
|
|
@ -132,8 +132,8 @@ func insert_cells(pos: int, n: int, fill_cell_data, erase_attr = null) -> void:
|
|||
while i >= 0:
|
||||
set_cell(pos + n + i, load_cell(pos + i, cell))
|
||||
i -= 1
|
||||
for i in range(n):
|
||||
set_cell(pos + i, fill_cell_data)
|
||||
for j in range(n):
|
||||
set_cell(pos + j, fill_cell_data)
|
||||
else:
|
||||
for i in range(pos, length):
|
||||
set_cell(i, fill_cell_data)
|
||||
|
|
|
@ -75,8 +75,8 @@ static func reflow_larger_get_lines_to_remove(lines, old_cols: int, new_cols: in
|
|||
|
||||
# Work backwards and remove any rows at the end that only contain null cells
|
||||
var count_to_remove = 0
|
||||
for i in range(wrapped_lines.size() - 1, 0, -1):
|
||||
if i > dest_line_index or wrapped_lines[i].get_trimmed_length() == 0:
|
||||
for j in range(wrapped_lines.size() - 1, 0, -1):
|
||||
if j > dest_line_index or wrapped_lines[j].get_trimmed_length() == 0:
|
||||
count_to_remove += 1
|
||||
else:
|
||||
break
|
||||
|
|
|
@ -128,8 +128,8 @@ func splice(start: int, delete_count: int, items: Array = []) -> void:
|
|||
while i >= start:
|
||||
_array[_get_cyclic_index(i + items.size())] = _array[_get_cyclic_index(i)]
|
||||
i -= 1
|
||||
for i in range(items.size()):
|
||||
_array[_get_cyclic_index(start + i)] = items[i]
|
||||
for j in range(items.size()):
|
||||
_array[_get_cyclic_index(start + j)] = items[j]
|
||||
|
||||
# Adjust length as needed
|
||||
if length + items.size() > max_length:
|
||||
|
|
Loading…
Reference in a new issue