From 9124851029700026bc937c81da829fbadcc5b29d Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 24 Aug 2016 23:38:50 +0100 Subject: [PATCH] JsonUi: try to handle all available requests, on input event, not just the first one --- src/json_ui.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/json_ui.cc b/src/json_ui.cc index 8ce6aff5..0e2bde05 100644 --- a/src/json_ui.cc +++ b/src/json_ui.cc @@ -425,7 +425,7 @@ void JsonUI::parse_requests(EventMode mode) m_requests += StringView{buf, buf + size}; } - if (not m_requests.empty()) + while (not m_requests.empty()) { const char* pos = nullptr; try @@ -442,8 +442,10 @@ void JsonUI::parse_requests(EventMode mode) // try to salvage request by dropping its first line pos = std::min(m_requests.end(), find(m_requests, '\n')+1); } - if (pos) - m_requests = String{pos, m_requests.end()}; + if (not pos) + break; // unterminated request ? + + m_requests = String{pos, m_requests.end()}; } while (m_input_callback and not m_pending_keys.empty())