diff options
| author | 2024-09-09 11:46:35 -0400 | |
|---|---|---|
| committer | 2024-09-09 11:46:35 -0400 | |
| commit | 0ec71db3d3697f9af459d4b4e341e7ce8feef7b5 (patch) | |
| tree | 3127cbcc7c11727bd80d8c3f72def8b8eeff2db5 /src | |
| parent | updated gitignore (diff) | |
fixed line wrapping when deleting inline
Diffstat (limited to '')
| -rw-r--r-- | src/lush.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -411,6 +411,14 @@ char *lush_read_line() { memmove(&buffer[pos - 1], &buffer[pos], strlen(&buffer[pos]) + 1); pos--; + // handle edge case where cursor should be moved down + int width = get_terminal_width(); + char *prompt = get_prompt(); + size_t prompt_length = get_stripped_length(prompt); + if ((prompt_length + pos) % width == width - 2 && + pos < strlen(buffer)) { + printf("\033[A"); + } // if modifying text reset history history_pos = -1; reprint_buffer(buffer, &last_lines, &pos, history_pos); |
