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

Function ExtMoveColorData

src/ConEmuHk/ExtConsole.cpp:1575–1618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1573}
1574
1575static void ExtMoveColorData(ssize_t dest, ssize_t from, ssize_t ccCells)
1576{
1577 if (!gpTrueColor || (ccCells <= 0))
1578 return;
1579
1580 const ssize_t bufferSize = gpTrueColor->bufferSize;
1581 if (bufferSize <= 0)
1582 {
1583 _ASSERTE(bufferSize > 0);
1584 return;
1585 }
1586
1587 AnnotationInfo* pTrueColorStart = (AnnotationInfo*)(((LPBYTE)gpTrueColor) + gpTrueColor->struct_size); //-V104
1588 AnnotationInfo* pTrueColorEnd = (pTrueColorStart + bufferSize); //-V104
1589
1590 if (dest < 0 || from < 0)
1591 {
1592 ssize_t outOfRange = -std::min(dest,from);
1593 ccCells -= outOfRange;
1594 if (ccCells <= 0)
1595 return;
1596 dest += outOfRange;
1597 from += outOfRange;
1598 }
1599
1600 if ((std::max(dest,from) + ccCells) > bufferSize)
1601 {
1602 ssize_t outOfRange = ((std::max(dest,from) + ccCells) - bufferSize);
1603 ccCells -= outOfRange;
1604 if (ccCells <= 0)
1605 return;
1606 }
1607
1608 AnnotationInfo* pTrueColorDest = pTrueColorStart + dest;
1609 const AnnotationInfo* pTrueColorFrom = pTrueColorStart + from;
1610 _ASSERTEX((uint64_t(pTrueColorDest)+ccCells)<uint64_t(pTrueColorEnd) && uint64_t(pTrueColorDest)>=uint64_t(pTrueColorStart));
1611 _ASSERTEX((uint64_t(pTrueColorFrom)+ccCells)<uint64_t(pTrueColorEnd) && uint64_t(pTrueColorFrom)>=uint64_t(pTrueColorStart));
1612
1613 // #OPTIMIZE: Не нужно двигать заполненную нулями память. Нет атрибутов в строке - и не дергаться?
1614 if (ccCells > 0)
1615 {
1616 memmove(pTrueColorDest, pTrueColorFrom, ccCells * sizeof(*pTrueColorDest));
1617 }
1618}
1619
1620// From the cursor position!
1621BOOL ExtScrollLine(ExtScrollScreenParm* Info)

Callers 2

ExtScrollLineFunction · 0.85
ExtScrollScreenFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected