mirror of
https://github.com/joel16/VitaShell.git
synced 2024-11-24 04:09:44 +00:00
texteditor: fix cutting moves cursor out of view
This commit is contained in:
parent
9fb4f4778f
commit
2b79149cdc
13
text.c
13
text.c
@ -545,14 +545,19 @@ int textViewer(char *file) {
|
||||
n_lines = 1;
|
||||
buffer[0] = '\n';
|
||||
}
|
||||
|
||||
if (base_pos + rel_pos >= n_lines) {
|
||||
rel_pos = n_lines - base_pos - 1;
|
||||
}
|
||||
|
||||
if (rel_pos < 0) {
|
||||
base_pos += rel_pos;
|
||||
rel_pos = 0;
|
||||
}
|
||||
|
||||
// Update entries
|
||||
updateTextEntries(buffer, base_pos, size, offset_list, list.head);
|
||||
|
||||
if (base_pos + rel_pos >= n_lines) {
|
||||
rel_pos = n_lines - 1;
|
||||
}
|
||||
|
||||
changed = 1;
|
||||
copy_current_size++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user