| 5928 | } |
| 5929 | |
| 5930 | int CBaseView::SaveFile(int nFlags) |
| 5931 | { |
| 5932 | Invalidate(); |
| 5933 | if (m_pViewData && m_pWorkingFile) |
| 5934 | { |
| 5935 | CFileTextLines file; |
| 5936 | m_SaveParams.m_LineEndings = m_lineendings; |
| 5937 | m_SaveParams.m_UnicodeType = m_texttype; |
| 5938 | file.SetSaveParams(m_SaveParams); |
| 5939 | |
| 5940 | for (int i=0; i<m_pViewData->GetCount(); i++) |
| 5941 | { |
| 5942 | //only copy non-removed lines |
| 5943 | DiffState state = m_pViewData->GetState(i); |
| 5944 | switch (state) |
| 5945 | { |
| 5946 | case DiffState::Conflicted: |
| 5947 | case DiffState::Conflicted_Ignored: |
| 5948 | { |
| 5949 | int first = i; |
| 5950 | int last = i; |
| 5951 | do |
| 5952 | { |
| 5953 | last++; |
| 5954 | } while((last<m_pViewData->GetCount()) && ((m_pViewData->GetState(last)==DiffState::Conflicted)||(m_pViewData->GetState(last)==DiffState::Conflicted_Ignored))); |
| 5955 | file.Add(L"<<<<<<< .mine", EOL::NoEnding); |
| 5956 | for (int j=first; j<last; j++) |
| 5957 | { |
| 5958 | file.Add(m_pwndRight->m_pViewData->GetLine(j), m_pwndRight->m_pViewData->GetLineEnding(j)); |
| 5959 | } |
| 5960 | file.Add(L"=======", EOL::NoEnding); |
| 5961 | for (int j=first; j<last; j++) |
| 5962 | { |
| 5963 | file.Add(m_pwndLeft->m_pViewData->GetLine(j), m_pwndLeft->m_pViewData->GetLineEnding(j)); |
| 5964 | } |
| 5965 | file.Add(L">>>>>>> .theirs", EOL::NoEnding); |
| 5966 | i = last-1; |
| 5967 | } |
| 5968 | break; |
| 5969 | case DiffState::Empty: |
| 5970 | break; |
| 5971 | case DiffState::ConflictEmpty: |
| 5972 | case DiffState::IdenticalRemoved: |
| 5973 | case DiffState::Removed: |
| 5974 | case DiffState::TheirsRemoved: |
| 5975 | case DiffState::YoursRemoved: |
| 5976 | case DiffState::ConflictResolvedEmpty: |
| 5977 | if ((nFlags&SAVE_REMOVEDLINES) == 0) |
| 5978 | { |
| 5979 | // do not save removed lines |
| 5980 | break; |
| 5981 | } |
| 5982 | default: |
| 5983 | file.Add(m_pViewData->GetLine(i), m_pViewData->GetLineEnding(i)); |
| 5984 | break; |
| 5985 | } |
| 5986 | } |
| 5987 | CString filename = m_pWorkingFile->GetFilename(); |
nothing calls this directly
no test coverage detected