From dbd29da00d47bd4f0db1048443ebecc07ae2f9c7 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Sat, 29 Apr 2017 20:04:25 +1000 Subject: [PATCH] Improvements to message quoting --- utils/magiedit/main.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/utils/magiedit/main.c b/utils/magiedit/main.c index a67fc90..2f4596d 100644 --- a/utils/magiedit/main.c +++ b/utils/magiedit/main.c @@ -499,7 +499,7 @@ char *message_editor() { } position_x = 0; q_done = 1; - } else if (ch.chKeyPress == 24) { + } else if (ch.chKeyPress == 24 || ch.chKeyPress == 27) { if (q_line_count) { free(q_lines); } @@ -514,6 +514,17 @@ char *message_editor() { q_lines[q_line_count] = q_position; q_line_count++; + + q_position++; + if (q_position >= quote_lines_count) { + q_position = quote_lines_count - 1; + } + if (q_position >= q_start + 7) { + q_start = q_start + 7; + if (q_start + 7 >= quote_line_count) { + q_start = quote_line_count - 7; + } + } redraw = 1; } }