MCPcopy Create free account
hub / github.com/ConEmu/ConEmu / ExtWriteText

Function ExtWriteText

src/ConEmuHk/ExtConsole.cpp:997–1461  ·  view source on GitHub ↗

wchar_t* Buffer, NumberOfCharsToWrite

Source from the content-addressed store, hash-verified

995
996// wchar_t* Buffer, NumberOfCharsToWrite
997BOOL ExtWriteText(ExtWriteTextParm* Info)
998{
999 if (!Info || (Info->StructSize < sizeof(*Info)))
1000 {
1001 _ASSERTE(Info!=NULL && (Info->StructSize >= sizeof(*Info)));
1002 SetLastError(E_INVALIDARG);
1003 return FALSE;
1004 }
1005
1006 #ifdef _DEBUG
1007 // extern FARPROC CallWriteConsoleW;
1008 _ASSERTE((CallWriteConsoleW!=NULL) || !HooksWereSet);
1009 // ReSharper disable twice CppCStyleCast
1010 _ASSERTE((Info->Private == NULL) || (Info->Private == (void*)CallWriteConsoleW) || (!HooksWereSet && (Info->Private == (void*)WriteConsoleW)));
1011 #endif
1012
1013 // Arguments validation
1014 if (!Info->ConsoleOutput || !Info->Buffer || !Info->NumberOfCharsToWrite)
1015 {
1016 _ASSERTE(Info->ConsoleOutput && Info->Buffer && Info->NumberOfCharsToWrite);
1017 SetLastError(E_INVALIDARG);
1018 return FALSE;
1019 }
1020
1021 BOOL lbTrueColor = ExtCheckBuffers(Info->ConsoleOutput);
1022 UNREFERENCED_PARAMETER(lbTrueColor);
1023
1024 HANDLE h = Info->ConsoleOutput;
1025 CONSOLE_SCREEN_BUFFER_INFO csbi = {};
1026 SMALL_RECT srWork = {};
1027 if (!ExtGetBufferInfo(h, csbi, srWork))
1028 {
1029 return FALSE;
1030 }
1031
1032 bool bWrap = true;
1033 bool bVirtualWrap = false;
1034 bool bRevertMode = false;
1035 SHORT WrapAtCol = csbi.dwSize.X; // 1-based
1036 DWORD Mode = 0;
1037
1038 // "Working lines" may be defined (Vim and others)
1039 LONG scrollTop = 0, scrollBottom = 0;
1040 bool bScrollRegion = !!(Info->Flags & ewtf_Region);
1041 RECT rcScrollRegion = Info->Region;
1042 COORD crScrollCursor = {};
1043 if (bScrollRegion)
1044 {
1045 _ASSERTEX(Info->Region.left==-1 && Info->Region.right==-1); // Not used yet
1046 rcScrollRegion.left = 0; rcScrollRegion.right = (csbi.dwSize.X - 1);
1047 _ASSERTEX(Info->Region.top>=0 && Info->Region.bottom>=Info->Region.top);
1048 scrollTop = Info->Region.top;
1049 scrollBottom = Info->Region.bottom+1;
1050 }
1051 else
1052 {
1053 scrollTop = 0;
1054 scrollBottom = csbi.dwSize.Y;

Callers 1

WriteTextMethod · 0.85

Calls 11

ExtCheckBuffersFunction · 0.85
ExtGetBufferInfoFunction · 0.85
GetConsoleModeCachedFunction · 0.85
ExtGetAttributesFunction · 0.85
ExtPrepareColorFunction · 0.85
ExtScrollScreenFunction · 0.85
IntWriteTextFunction · 0.85
MakeCoordFunction · 0.85
GuiFlashWindowFunction · 0.85
ExtCommitFunction · 0.85
SetWriteAtEolMethod · 0.80

Tested by

no test coverage detected