Skip to content

Commit

Permalink
Merge pull request #47 from visionmercer/master
Browse files Browse the repository at this point in the history
cross-platform terminal consistency for locate command.
  • Loading branch information
DualBrain committed Oct 13, 2023
2 parents c7fd3bb + ab386e0 commit a62074f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions internal/c/libqb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit a62074f

Please sign in to comment.