| 843 | } |
| 844 | |
| 845 | std::tuple<CEPoint, CEPoint, CEPoint, CEPoint> CMergeDoc::GetCharacterRange(int srcPane, int dstPane, int activePane, int nDiff, |
| 846 | const CEPoint& ptStart, const CEPoint& ptEnd) |
| 847 | { |
| 848 | DIFFRANGE cd; |
| 849 | VERIFY(m_diffList.GetDiff(nDiff, cd)); |
| 850 | const int cd_dbegin = cd.dbegin; |
| 851 | const int cd_dend = cd.dend; |
| 852 | |
| 853 | std::vector<WordDiff> worddiffs = GetWordDiffArrayInDiffBlock(nDiff, true); |
| 854 | |
| 855 | int firstWordDiff = -1; |
| 856 | const int nBeginLineFlag = m_ptBuf[activePane]->GetLineFlags(ptEnd.y); |
| 857 | if ((nBeginLineFlag & LF_GHOST) == 0 && (nBeginLineFlag & LF_DIFF) != 0) |
| 858 | { |
| 859 | for (int i = 0; i < static_cast<int>(worddiffs.size()); ++i) |
| 860 | { |
| 861 | if ((ptStart.y == worddiffs[i].endline[activePane] && ptStart.x >= worddiffs[i].end[activePane]) || |
| 862 | (ptStart.y > worddiffs[i].endline[activePane])) |
| 863 | firstWordDiff = i; |
| 864 | } |
| 865 | } |
| 866 | int lastWordDiff = -1; |
| 867 | const int nEndLineFlag = m_ptBuf[activePane]->GetLineFlags(ptEnd.y); |
| 868 | if ((nEndLineFlag & LF_GHOST) == 0 && (nEndLineFlag & LF_DIFF) != 0) |
| 869 | { |
| 870 | for (int i = 0; i < static_cast<int>(worddiffs.size()); ++i) |
| 871 | { |
| 872 | if ((ptEnd.y == worddiffs[i].endline[activePane] && ptEnd.x >= worddiffs[i].end[activePane]) || |
| 873 | (ptEnd.y > worddiffs[i].endline[activePane])) |
| 874 | lastWordDiff = i; |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | CEPoint ptDstStart, ptDstEnd; |
| 879 | CEPoint ptSrcStart, ptSrcEnd; |
| 880 | |
| 881 | if (firstWordDiff == -1) |
| 882 | { |
| 883 | if (ptStart.y < cd_dbegin) |
| 884 | { |
| 885 | ptSrcStart = { 0, cd_dbegin }; |
| 886 | ptDstStart = ptSrcStart; |
| 887 | } |
| 888 | else |
| 889 | { |
| 890 | ptSrcStart = ptStart; |
| 891 | ptDstStart = ptStart; |
| 892 | if (srcPane == activePane) |
| 893 | { |
| 894 | if (ptDstStart.x > m_ptBuf[dstPane]->GetLineLength(ptDstStart.y)) |
| 895 | ptDstStart.x = m_ptBuf[dstPane]->GetLineLength(ptDstStart.y); |
| 896 | } |
| 897 | else |
| 898 | { |
| 899 | if (ptSrcStart.x > m_ptBuf[dstPane]->GetLineLength(ptSrcStart.y)) |
| 900 | ptSrcStart.x = m_ptBuf[dstPane]->GetLineLength(ptSrcStart.y); |
| 901 | } |
| 902 | } |
nothing calls this directly
no test coverage detected