From 38f6495dd65bd26687d4c1c1cd9fbd67ce5e9e3a Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 16 Feb 2025 15:12:02 +0100 Subject: minor readability improvement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libterminput_read.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libterminput_read.c b/libterminput_read.c index 50095bd..0c46585 100644 --- a/libterminput_read.c +++ b/libterminput_read.c @@ -187,20 +187,7 @@ parse_sequence(union libterminput_input *input, struct libterminput_state *ctx) } } input->mouseevent.button = (enum libterminput_button)nums[0]; - } else if (!nnums & !(ctx->flags & LIBTERMINPUT_DECSET_1005)) { - /* Parsing output for legacy mouse tracking output. */ - ctx->mouse_tracking = 0; - nums = numsbuf; - nums[0] = (unsigned long long int)(unsigned char)ctx->stored[ctx->stored_tail++]; - nums[1] = (unsigned long long int)(unsigned char)ctx->stored[ctx->stored_tail++]; - nums[2] = (unsigned long long int)(unsigned char)ctx->stored[ctx->stored_tail++]; - nums[0] = (nums[0] - 32ULL) & 255ULL; - nums[1] = (nums[1] - 32ULL) & 255ULL; - nums[2] = (nums[2] - 32ULL) & 255ULL; - if (ctx->stored_head == ctx->stored_tail) - ctx->stored_head = ctx->stored_tail = 0; - goto decimal_mouse_tracking_set_press; - } else if (!nnums) { + } else if (!nnums && (ctx->flags & LIBTERMINPUT_DECSET_1005)) { /* Parsing for semi-legacy \e[?1000;1005h output. */ ctx->mouse_tracking = 0; nums = numsbuf; @@ -218,6 +205,19 @@ parse_sequence(union libterminput_input *input, struct libterminput_state *ctx) if (ctx->stored_head == ctx->stored_tail) ctx->stored_head = ctx->stored_tail = 0; goto decimal_mouse_tracking_set_press; + } else if (!nnums) { + /* Parsing output for legacy mouse tracking output. */ + ctx->mouse_tracking = 0; + nums = numsbuf; + nums[0] = (unsigned long long int)(unsigned char)ctx->stored[ctx->stored_tail++]; + nums[1] = (unsigned long long int)(unsigned char)ctx->stored[ctx->stored_tail++]; + nums[2] = (unsigned long long int)(unsigned char)ctx->stored[ctx->stored_tail++]; + nums[0] = (nums[0] - 32ULL) & 255ULL; + nums[1] = (nums[1] - 32ULL) & 255ULL; + nums[2] = (nums[2] - 32ULL) & 255ULL; + if (ctx->stored_head == ctx->stored_tail) + ctx->stored_head = ctx->stored_tail = 0; + goto decimal_mouse_tracking_set_press; } else { goto suppress; } -- cgit v1.2.3-70-g09d2