From ab386e04f10dcb7a76b9eaac9e9ab645e36cffca Mon Sep 17 00:00:00 2001 From: visionmercer <62051836+visionmercer@users.noreply.github.com> Date: Tue, 24 Jan 2023 13:04:40 +0100 Subject: [PATCH] Update libqb.cpp cross-platform consistency for locate command --- internal/c/libqb.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/internal/c/libqb.cpp b/internal/c/libqb.cpp index 4a3a14afd..b5d82eed4 100644 --- a/internal/c/libqb.cpp +++ b/internal/c/libqb.cpp @@ -11555,12 +11555,19 @@ void qbg_sub_locate(int32 row,int32 column,int32 cursor,int32 start,int32 stop,i HANDLE output = GetStdHandle (STD_OUTPUT_HANDLE); SetConsoleCursorPosition(output, pos); #else - // We don't have a good way of getting the current cursor position, so we ignore any LOCATEs - // that don't give an absolute position. - if (!(passed & 1 && passed & 2)) + if (passed & 1 && passed & 2){ + printf("\033[%d;%dH", row, column); return; - printf("\033[%d;%dH", row, column); - #endif + } + if (passed & 1){ + printf("\033[%dd", row); + return; + } + if (passed & 2){ + printf("\033[%d;%dG", column); + return; + } + #endif return; }