| 929 | |
| 930 | |
| 931 | static BOOL IntWriteText(HANDLE h, SHORT x, SHORT ForceDumpX, |
| 932 | const wchar_t *pFrom, DWORD cchWrite, |
| 933 | AnnotationInfo* pTrueColorLine, AnnotationInfo* pTrueColorEnd, |
| 934 | const AnnotationInfo& AIColor, |
| 935 | const CONSOLE_SCREEN_BUFFER_INFO& csbi, |
| 936 | WriteConsoleW_t lpfn = NULL) |
| 937 | { |
| 938 | SHORT nWindowWidth = csbi.srWindow.Right - csbi.srWindow.Left + 1; |
| 939 | _ASSERTEX(nWindowWidth > 0); |
| 940 | |
| 941 | // Write extended attributes if required |
| 942 | if (pTrueColorLine && (nWindowWidth > 0)) |
| 943 | { |
| 944 | AnnotationInfo* pTrueColor = pTrueColorLine + x; |
| 945 | const wchar_t *pch = pFrom; |
| 946 | |
| 947 | for (SHORT x1 = x; x1 <= ForceDumpX; x1++, pch++) |
| 948 | { |
| 949 | // This control chars do not have glyphs unless ENABLE_PROCESSED_OUTPUT is cleared! |
| 950 | switch (*pch) |
| 951 | { |
| 952 | case L'\r': |
| 953 | pTrueColor = pTrueColorLine; |
| 954 | continue; |
| 955 | case L'\n': |
| 956 | pTrueColor = pTrueColorLine = (pTrueColorLine + nWindowWidth); |
| 957 | continue; |
| 958 | case 7: // bell |
| 959 | continue; // non-spacing |
| 960 | case 8: // bs |
| 961 | pTrueColor = std::max(pTrueColorLine, pTrueColor-1); |
| 962 | continue; |
| 963 | case 9: // tab |
| 964 | TODO("Fill and mark affected console cells?"); |
| 965 | break; |
| 966 | } |
| 967 | |
| 968 | if (pTrueColor >= pTrueColorEnd) |
| 969 | { |
| 970 | #ifdef _DEBUG |
| 971 | static bool bBufferAsserted = false; |
| 972 | if (!bBufferAsserted) |
| 973 | { |
| 974 | bBufferAsserted = true; |
| 975 | _ASSERTE(pTrueColor && pTrueColor < pTrueColorEnd && "Allocated buffer was not enough"); |
| 976 | } |
| 977 | #endif |
| 978 | pTrueColor = NULL; // Выделенный буфер оказался недостаточным |
| 979 | break; |
| 980 | } |
| 981 | |
| 982 | *(pTrueColor++) = AIColor; |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | // Вывод в консоль "текста" |
| 987 | DWORD nWritten = 0; |
| 988 | BOOL lbRc = apiWriteConsoleW(h, pFrom, cchWrite, &nWritten, NULL, lpfn); |
no test coverage detected