From 03ea96096dca6c1a0db5b61e13613a2c95977c52 Mon Sep 17 00:00:00 2001 From: dijunkun Date: Fri, 9 Aug 2024 11:33:13 +0800 Subject: [PATCH] [feat] add space automaticlly for remote id input box --- src/single_window/remote_peer_window.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/single_window/remote_peer_window.cpp b/src/single_window/remote_peer_window.cpp index 9087ce1..c3617b7 100644 --- a/src/single_window/remote_peer_window.cpp +++ b/src/single_window/remote_peer_window.cpp @@ -5,9 +5,14 @@ #include "render.h" static int InputTextCallback(ImGuiInputTextCallbackData *data) { - if (data->CursorPos == 3 || data->CursorPos == 7) { - data->InsertChars(data->CursorPos, " "); + if (data->BufTextLen > 3 && data->Buf[3] != ' ') { + data->InsertChars(3, " "); } + + if (data->BufTextLen > 7 && data->Buf[7] != ' ') { + data->InsertChars(7, " "); + } + return 0; }