aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2025-02-16 15:12:02 +0100
committerMattias Andrée <m@maandree.se>2025-02-16 15:12:02 +0100
commit38f6495dd65bd26687d4c1c1cd9fbd67ce5e9e3a (patch)
tree7f22d6ac8b7672b999ca4c0c559c5634aa181e54
parentImprove code organisation, documentation, and m code improvement (diff)
downloadlibterminput-38f6495dd65bd26687d4c1c1cd9fbd67ce5e9e3a.tar.gz
libterminput-38f6495dd65bd26687d4c1c1cd9fbd67ce5e9e3a.tar.bz2
libterminput-38f6495dd65bd26687d4c1c1cd9fbd67ce5e9e3a.tar.xz
minor readability improvement
Signed-off-by: Mattias Andrée <m@maandree.se>
-rw-r--r--libterminput_read.c28
1 files 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;
}