From f1f14cc8fa0737badb4e3d729321eae207a0c6c3 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 25 Nov 2025 12:52:39 +0100 Subject: [PATCH] input: extract function for enqueuing query response --- src/input_common.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/input_common.rs b/src/input_common.rs index a311a4dc6..51d70fd96 100644 --- a/src/input_common.rs +++ b/src/input_common.rs @@ -1142,9 +1142,7 @@ fn parse_csi(&mut self, buffer: &mut Vec) -> Option { }; FLOG!(reader, "Received cursor position report y:", y, "x:", x); let cursor_pos = ViewportPosition { x, y }; - self.push_front(CharEvent::QueryResult(QueryResultEvent::Response( - QueryResponse::CursorPosition(cursor_pos), - ))); + self.push_query_response(QueryResponse::CursorPosition(cursor_pos)); return None; } b'S' => masked_key(function_key(4)), @@ -1196,9 +1194,7 @@ fn parse_csi(&mut self, buffer: &mut Vec) -> Option { }, b'c' if private_mode == Some(b'?') => { FLOG!(reader, "Received Primary Device Attribute response"); - self.push_front(CharEvent::QueryResult(QueryResultEvent::Response( - QueryResponse::PrimaryDeviceAttribute, - ))); + self.push_query_response(QueryResponse::PrimaryDeviceAttribute); return None; } b'u' => { @@ -1501,6 +1497,10 @@ fn push_front(&mut self, ch: CharEvent) { self.get_input_data_mut().queue.push_front(ch); } + fn push_query_response(&mut self, response: QueryResponse) { + self.push_front(CharEvent::QueryResult(QueryResultEvent::Response(response))); + } + /// Find the first sequence of non-char events, and promote them to the front. fn promote_interruptions_to_front(&mut self) { // Find the first sequence of non-char events.