Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Ignore missing trailing EOL" option to Compare settings #2573

Merged
merged 25 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Src/CompareEngines/ByteComparator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@
}
else // don't skip blank lines, but still ignore eol difference
{
const char* ptr0b = ptr0;
const char* ptr1b = ptr1;
HandleSide0Eol((char **) &ptr0, end0, eof0);
HandleSide1Eol((char **) &ptr1, end1, eof1);

Expand All @@ -353,6 +355,8 @@
if ((!m_eol0 || !m_eol1) && (orig0 == end0 || orig1 == end1))
{
// one side had an end-of-line, but the other didn't
ptr0 = ptr0b;

Check warning

Code scanning / CodeQL

Local variable address stored in non-local memory Warning

A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
ptr1 = ptr1b;

Check warning

Code scanning / CodeQL

Local variable address stored in non-local memory Warning

A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
A stack address which arrived via a
parameter
may be assigned to a non-local variable.
result = RESULT_DIFF;
goto exit;
}
Expand Down
29 changes: 28 additions & 1 deletion Src/CompareEngines/ByteCompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
// because transform code converted any UCS-2 files to UTF-8
// We could compare directly in UCS-2LE here, as an optimization, in that case
char buff[2][WMCMPBUFF]; // buffered access to files
std::string lasteol[2];
int i;
unsigned diffcode = 0;

Expand Down Expand Up @@ -126,11 +127,23 @@
if (rtn < space)
eof[i] = true;
bfend[i] += rtn;
if (m_pOptions->m_bIgnoreMissingTrailingEol)
{
for (int64_t j = (std::max)(bfstart[i], bfend[i] - 4); j < bfend[i]; ++j)
{
const char c = buff[i][j];
if (c == '\r' || c == '\n')
lasteol[i].push_back(c);
else
lasteol[i].clear();
}
}
if (diffData->m_inf[0].desc == diffData->m_inf[1].desc)
{
bfstart[1] = bfstart[0];
bfend[1] = bfend[0];
eof[1] = eof[0];
lasteol[1] = lasteol[0];
diffData->m_FileLocation[1] = diffData->m_FileLocation[0];
memcpy(&buff[1][bfend[1] - rtn], &buff[0][bfend[0] - rtn], rtn);
break;
Expand Down Expand Up @@ -165,7 +178,21 @@
}
else
{
diffcode |= DIFFCODE::DIFF;
if (m_pOptions->m_bIgnoreMissingTrailingEol)
{
if ((eof[0] || eof[1]) &&
((end0 - ptr0 <= 1 && (lasteol[0] == "\r" || lasteol[0] == "\n" || lasteol[0] == "\r\n") && (end1 == ptr1))) ||
((end0 - ptr0 == 2 && (lasteol[0] == "\r\n") && (end1 == ptr1))) ||
((end1 - ptr1 <= 1 && (lasteol[1] == "\r" || lasteol[1] == "\n" || lasteol[1] == "\r\n") && (end0 == ptr0))) ||
((end1 - ptr1 == 2 && (lasteol[1] == "\r\n") && (end0 == ptr0))))
Comment on lines +183 to +187

Check notice

Code scanning / CodeQL

Complex condition Note

Complex condition: too many logical operations in this expression.
;
else
diffcode |= DIFFCODE::DIFF;
}
else
{
diffcode |= DIFFCODE::DIFF;
}
ptr0 = end0;
ptr1 = end1;
// move our current pointers over what we just compared
Expand Down
1 change: 1 addition & 0 deletions Src/CompareEngines/Wrap_DiffUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ int DiffUtils::CompareFiles(DiffFileData* diffData)
if (script != nullptr)
{
const bool usefilters = m_pDiffWrapper->GetOptions().m_filterCommentsLines ||
m_pDiffWrapper->GetOptions().m_bIgnoreMissingTrailingEol ||
(m_pDiffWrapper->GetFilterList() && m_pDiffWrapper->GetFilterList()->HasRegExps()) ||
(m_pDiffWrapper->GetSubstitutionList() && m_pDiffWrapper->GetSubstitutionList()->HasRegExps());

Expand Down
3 changes: 3 additions & 0 deletions Src/CompareOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CompareOptions::CompareOptions()
, m_bIgnoreCase(false)
, m_bIgnoreEOLDifference(false)
, m_bIgnoreNumbers(false)
, m_bIgnoreMissingTrailingEol(false)
{
}

Expand Down Expand Up @@ -48,6 +49,7 @@ void CompareOptions::SetFromDiffOptions(const DIFFOPTIONS &options)
m_bIgnoreCase = options.bIgnoreCase;
m_bIgnoreEOLDifference = options.bIgnoreEol;
m_bIgnoreNumbers = options.bIgnoreNumbers;
m_bIgnoreMissingTrailingEol = options.bIgnoreMissingTrailingEol;
}

/**
Expand Down Expand Up @@ -187,6 +189,7 @@ void DiffutilsOptions::GetAsDiffOptions(DIFFOPTIONS &options) const
options.bIgnoreEol = m_bIgnoreEOLDifference;
options.bIgnoreNumbers = m_bIgnoreNumbers;
options.nDiffAlgorithm = m_diffAlgorithm;
options.bIgnoreMissingTrailingEol = m_bIgnoreMissingTrailingEol;

switch (m_ignoreWhitespace)
{
Expand Down
2 changes: 2 additions & 0 deletions Src/CompareOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ struct DIFFOPTIONS
bool bFilterCommentsLines; /**< Ignore Multiline comments differences -option. */
bool bIndentHeuristic; /**< Ident heuristic -option */
bool bCompletelyBlankOutIgnoredChanges;
bool bIgnoreMissingTrailingEol; /**< Ignore missing trailing EOL -option. */
};

/**
Expand All @@ -105,6 +106,7 @@ class CompareOptions
bool m_bIgnoreCase; /**< Ignore case differences? */
bool m_bIgnoreNumbers; /**< Ignore number differences? */
bool m_bIgnoreEOLDifference; /**< Ignore EOL style differences? */
bool m_bIgnoreMissingTrailingEol; /**< Ignore missing trailing EOL */
};

/**
Expand Down
29 changes: 29 additions & 0 deletions Src/DiffWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,28 @@ static void ReplaceChars(std::string & str, const char* chars, const char *rep)
}
}

/**
* @brief Remove the end-of-line (EOL) characters (LF, CR, or CRLF) from the end of a string.
*
* This function removes any of the following EOL characters from the end of the string:
* - LF (line feed, '\n')
* - CR (carriage return, '\r')
* - CRLF (carriage return + line feed, "\r\n")
*
* @param [in,out] str - A string from which the EOL characters will be removed.
*/
static void RemoveEOL(std::string& str)
{
if (str.empty())
return;
if (str.size() >= 2 && str[str.size() - 2] == '\r' && str[str.size() - 1] == '\n')
str.erase(str.size() - 2, 2);
else if (str.back() == '\n')
str.pop_back();
else if (str.back() == '\r')
str.pop_back();
}

/**
* @brief The main entry for post filtering. Performs post-filtering, by setting comment blocks to trivial
* @param [in, out] thisob Current change
Expand Down Expand Up @@ -447,6 +469,11 @@ int CDiffWrapper::PostFilter(PostFilterContext& ctxt, change* thisob, const file
Replace(lineDataRight, "\r\n", "\n");
Replace(lineDataRight, "\r", "\n");
}
if (thisob->link == nullptr && m_options.m_bIgnoreMissingTrailingEol && (file_data_ary[0].missing_newline || file_data_ary[1].missing_newline))
{
RemoveEOL(lineDataLeft);
RemoveEOL(lineDataRight);
}

// If both match after filtering, mark this diff hunk as trivial and return.
if (lineDataLeft == lineDataRight)
Expand Down Expand Up @@ -1200,6 +1227,7 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript(struct change * script, const
struct change *next = script;

const bool usefilters = m_options.m_filterCommentsLines ||
m_options.m_bIgnoreMissingTrailingEol ||
(m_pFilterList && m_pFilterList->HasRegExps()) ||
(m_pSubstitutionList && m_pSubstitutionList->HasRegExps());

Expand Down Expand Up @@ -1371,6 +1399,7 @@ CDiffWrapper::LoadWinMergeDiffsFromDiffUtilsScript3(
diff12.Clear();

const bool usefilters = m_options.m_filterCommentsLines ||
m_options.m_bIgnoreMissingTrailingEol ||
(m_pFilterList && m_pFilterList->HasRegExps()) ||
(m_pSubstitutionList && m_pSubstitutionList->HasRegExps());

Expand Down
14 changes: 14 additions & 0 deletions Src/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
ON_UPDATE_COMMAND_UI(ID_DIFF_OPTIONS_IGNORE_CODEPAGE, OnUpdateDiffIgnoreCP)
ON_COMMAND(ID_DIFF_OPTIONS_IGNORE_COMMENTS, OnDiffIgnoreComments)
ON_UPDATE_COMMAND_UI(ID_DIFF_OPTIONS_IGNORE_COMMENTS, OnUpdateDiffIgnoreComments)
ON_COMMAND(ID_DIFF_OPTIONS_IGNORE_MISSING_TRAILING_EOL, OnDiffIgnoreMissingTrailingEol)
ON_UPDATE_COMMAND_UI(ID_DIFF_OPTIONS_IGNORE_MISSING_TRAILING_EOL, OnUpdateDiffIgnoreMissingTrailingEol)
ON_COMMAND(ID_DIFF_OPTIONS_INCLUDE_SUBFOLDERS, OnIncludeSubfolders)
ON_UPDATE_COMMAND_UI(ID_DIFF_OPTIONS_INCLUDE_SUBFOLDERS, OnUpdateIncludeSubfolders)
ON_COMMAND_RANGE(ID_DIFF_OPTIONS_COMPMETHOD_FULL_CONTENTS, ID_DIFF_OPTIONS_COMPMETHOD_SIZE, OnCompareMethod)
Expand Down Expand Up @@ -3217,6 +3219,18 @@ void CMainFrame::OnUpdateDiffIgnoreComments(CCmdUI* pCmdUI)
pCmdUI->Enable();
}

void CMainFrame::OnDiffIgnoreMissingTrailingEol()
{
GetOptionsMgr()->SaveOption(OPT_CMP_IGNORE_MISSING_TRAILING_EOL, !GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_MISSING_TRAILING_EOL));
ApplyDiffOptions();
}

void CMainFrame::OnUpdateDiffIgnoreMissingTrailingEol(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(GetOptionsMgr()->GetBool(OPT_CMP_IGNORE_MISSING_TRAILING_EOL));
pCmdUI->Enable();
}

void CMainFrame::OnIncludeSubfolders()
{
GetOptionsMgr()->SaveOption(OPT_CMP_INCLUDE_SUBDIRS, !GetOptionsMgr()->GetBool(OPT_CMP_INCLUDE_SUBDIRS));
Expand Down
2 changes: 2 additions & 0 deletions Src/MainFrm.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ class CMainFrame : public CMDIFrameWnd
afx_msg void OnUpdateDiffIgnoreCP(CCmdUI* pCmdUI);
afx_msg void OnDiffIgnoreComments();
afx_msg void OnUpdateDiffIgnoreComments(CCmdUI* pCmdUI);
afx_msg void OnDiffIgnoreMissingTrailingEol();
afx_msg void OnUpdateDiffIgnoreMissingTrailingEol(CCmdUI* pCmdUI);
afx_msg void OnIncludeSubfolders();
afx_msg void OnUpdateIncludeSubfolders(CCmdUI* pCmdUI);
afx_msg void OnCompareMethod(UINT nID);
Expand Down
18 changes: 11 additions & 7 deletions Src/Merge.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,7 @@ BEGIN
MENUITEM "Ignore codepage &differences", ID_DIFF_OPTIONS_IGNORE_CODEPAGE
MENUITEM "Ignore num&bers", IDC_DIFF_IGNORENUMBERS
MENUITEM "Ignore c&omment differences", ID_DIFF_OPTIONS_IGNORE_COMMENTS
MENUITEM "Ignore &missing trailing EOL", ID_DIFF_OPTIONS_IGNORE_MISSING_TRAILING_EOL
MENUITEM SEPARATOR
MENUITEM "&Include subfolders", ID_DIFF_OPTIONS_INCLUDE_SUBFOLDERS
POPUP "&Compare method:"
Expand Down Expand Up @@ -1123,6 +1124,7 @@ BEGIN
MENUITEM "Ignore codepage &differences", ID_PROJECT_DIFF_OPTIONS_IGNORE_CODEPAGE
MENUITEM "Ignore num&bers", ID_PROJECT_DIFF_OPTIONS_IGNORE_NUMBERS
MENUITEM "Ignore c&omment differences", ID_PROJECT_DIFF_OPTIONS_IGNORE_COMMENTS
MENUITEM "Ignore &missing trailing EOL", ID_PROJECT_DIFF_OPTIONS_IGNORE_MISSING_TRAILING_EOL
MENUITEM SEPARATOR
POPUP "&Compare method:"
BEGIN
Expand Down Expand Up @@ -1952,14 +1954,16 @@ BEGIN
CONTROL "Ignore codepage &differences",IDC_CP_SENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,108,269,10
CONTROL "Ignore c&omment differences",IDC_FILTERCOMMENTS_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,120,239,10
CONTROL "E&nable moved block detection",IDC_MOVED_BLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,132,269,10
CONTROL "Align &similar lines",IDC_ALIGN_SIMILAR_LINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,144,269,10
LTEXT "Diff &algorithm:",IDC_STATIC,7,156,269,10
COMBOBOX IDC_DIFF_ALGORITHM,6,168,270,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable indent &heuristic",IDC_INDENT_HEURISTIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,186,269,10
CONTROL "Ignore &missing trailing EOL",IDC_IGNEOFEOL_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,132,239,10
CONTROL "E&nable moved block detection",IDC_MOVED_BLOCKS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,144,269,10
CONTROL "Align &similar lines",IDC_ALIGN_SIMILAR_LINES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,156,269,10
LTEXT "Diff &algorithm:",IDC_STATIC,7,168,269,10
COMBOBOX IDC_DIFF_ALGORITHM,6,180,270,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Enable indent &heuristic",IDC_INDENT_HEURISTIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,198,269,10
CONTROL "Completely unhighlight the ignored differences",IDC_COMPLETELY_BLANK_OUT_IGNORED_DIFFERENCES,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,198,269,10
PUSHBUTTON "Defaults",IDC_COMPARE_DEFAULTS,191,228,88,14
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,210,269,10
PUSHBUTTON "Defaults",IDC_COMPARE_DEFAULTS,191,240,88,14
END

IDD_PROPPAGE_EDITOR DIALOGEX 0, 0, 285, 242
Expand Down
23 changes: 23 additions & 0 deletions Src/OpenView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ BEGIN_MESSAGE_MAP(COpenView, CFormView)
ON_UPDATE_COMMAND_UI(ID_PROJECT_DIFF_OPTIONS_IGNORE_CODEPAGE, OnUpdateDiffIgnoreCP)
ON_COMMAND(ID_PROJECT_DIFF_OPTIONS_IGNORE_COMMENTS, OnDiffIgnoreComments)
ON_UPDATE_COMMAND_UI(ID_PROJECT_DIFF_OPTIONS_IGNORE_COMMENTS, OnUpdateDiffIgnoreComments)
ON_COMMAND(ID_PROJECT_DIFF_OPTIONS_IGNORE_MISSING_TRAILING_EOL, OnDiffIgnoreMissingTrailingEol)
ON_UPDATE_COMMAND_UI(ID_PROJECT_DIFF_OPTIONS_IGNORE_MISSING_TRAILING_EOL, OnUpdateDiffIgnoreMissingTrailingEol)
ON_COMMAND_RANGE(ID_PROJECT_DIFF_OPTIONS_COMPMETHOD_FULL_CONTENTS, ID_PROJECT_DIFF_OPTIONS_COMPMETHOD_SIZE, OnCompareMethod)
ON_UPDATE_COMMAND_UI_RANGE(ID_PROJECT_DIFF_OPTIONS_COMPMETHOD_FULL_CONTENTS, ID_PROJECT_DIFF_OPTIONS_COMPMETHOD_SIZE, OnUpdateCompareMethod)
ON_WM_ACTIVATE()
Expand Down Expand Up @@ -876,6 +878,8 @@ void COpenView::OnLoadProject()
m_bIgnoreNumbers = projItem.GetIgnoreNumbers();
if (projItem.HasIgnoreCodepage())
m_bIgnoreCodepage = projItem.GetIgnoreCodepage();
if (projItem.HasIgnoreMissingTrailingEol())
m_bIgnoreMissingTrailingEol = projItem.GetIgnoreMissingTrailingEol();
if (projItem.HasFilterCommentsLines())
m_bFilterCommentsLines = projItem.GetFilterCommentsLines();
if (projItem.HasCompareMethod())
Expand Down Expand Up @@ -921,6 +925,7 @@ void COpenView::OnSaveProject()
projItem.SetSaveIgnoreEol(bSaveCompareOptions);
projItem.SetSaveIgnoreNumbers(bSaveCompareOptions);
projItem.SetSaveIgnoreCodepage(bSaveCompareOptions);
projItem.SetSaveIgnoreMissingTrailingEol(bSaveCompareOptions);
projItem.SetSaveFilterCommentsLines(bSaveCompareOptions);
projItem.SetSaveCompareMethod(bSaveCompareOptions);
projItem.SetSaveHiddenItems(bSaveHiddenItems);
Expand Down Expand Up @@ -986,6 +991,7 @@ void COpenView::OnSaveProject()
projItem.SetIgnoreEol(m_bIgnoreEol);
projItem.SetIgnoreNumbers(m_bIgnoreNumbers);
projItem.SetIgnoreCodepage(m_bIgnoreCodepage);
projItem.SetIgnoreMissingTrailingEol(m_bIgnoreMissingTrailingEol);
projItem.SetFilterCommentsLines(m_bFilterCommentsLines);
projItem.SetCompareMethod(m_nCompareMethod);
}
Expand Down Expand Up @@ -1614,6 +1620,23 @@ void COpenView::OnUpdateDiffIgnoreComments(CCmdUI* pCmdUI)
pCmdUI->SetCheck(m_bFilterCommentsLines);
}

/**
* @brief Toggle "Ignore missing trailing EOL" setting.
*/
void COpenView::OnDiffIgnoreMissingTrailingEol()
{
m_bIgnoreMissingTrailingEol = !m_bIgnoreMissingTrailingEol;
}

/**
* @brief Update "Ignore missing trailing EOL" state.
* @param [in] pCmdUI UI component to update.
*/
void COpenView::OnUpdateDiffIgnoreMissingTrailingEol(CCmdUI* pCmdUI)
{
pCmdUI->SetCheck(m_bIgnoreMissingTrailingEol);
}

/**
* @brief Set "Compare method" setting.
* @param [in] nID Menu ID of the selected item
Expand Down
3 changes: 3 additions & 0 deletions Src/OpenView.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class COpenView : public CFormView, public DlgUtils<COpenView>
bool m_bIgnoreNumbers; /**< The value of the "Ignore numbers" setting */
bool m_bIgnoreCodepage; /**< The value of the "Ignore codepage differences" setting */
bool m_bFilterCommentsLines; /**< The value of the "Ignore comment differences" setting */
bool m_bIgnoreMissingTrailingEol; /**< The value of the "Ignore missing trailing EOL" setting */
int m_nCompareMethod; /**< The value of the "Compare method" setting */
// Overrides
public:
Expand Down Expand Up @@ -149,6 +150,8 @@ virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
afx_msg void OnUpdateDiffIgnoreCP(CCmdUI* pCmdUI);
afx_msg void OnDiffIgnoreComments();
afx_msg void OnUpdateDiffIgnoreComments(CCmdUI* pCmdUI);
afx_msg void OnDiffIgnoreMissingTrailingEol();
afx_msg void OnUpdateDiffIgnoreMissingTrailingEol(CCmdUI* pCmdUI);
afx_msg void OnCompareMethod(UINT nID);
afx_msg void OnUpdateCompareMethod(CCmdUI* pCmdUI);
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
Expand Down
1 change: 1 addition & 0 deletions Src/OptionsDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ inline const String OPT_CMP_IGNORE_CASE {_T("Settings/IgnoreCase"s)};
inline const String OPT_CMP_IGNORE_NUMBERS {_T("Settings/IgnoreNumbers"s)};
inline const String OPT_CMP_IGNORE_EOL {_T("Settings/IgnoreEol"s)};
inline const String OPT_CMP_IGNORE_CODEPAGE {_T("Settings/IgnoreCodepage"s)};
inline const String OPT_CMP_IGNORE_MISSING_TRAILING_EOL {_T("Settings/IgnoreMissingTrailingEol"s)};
inline const String OPT_CMP_METHOD {_T("Settings/CompMethod2"s)};
inline const String OPT_CMP_MOVED_BLOCKS {_T("Settings/MovedBlocks"s)};
inline const String OPT_CMP_ALIGN_SIMILAR_LINES {_T("Settings/MatchSimilarLines"s)};
Expand Down
3 changes: 3 additions & 0 deletions Src/OptionsDiffOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ void Init(COptionsMgr *pOptionsMgr)
pOptionsMgr->InitOption(OPT_CMP_DIFF_ALGORITHM, (int)0, 0, 4);
pOptionsMgr->InitOption(OPT_CMP_INDENT_HEURISTIC, true);
pOptionsMgr->InitOption(OPT_CMP_COMPLETELY_BLANK_OUT_IGNORED_CHANGES, false);
pOptionsMgr->InitOption(OPT_CMP_IGNORE_MISSING_TRAILING_EOL, false);
}

void Load(const COptionsMgr *pOptionsMgr, DIFFOPTIONS& options)
Expand All @@ -36,6 +37,7 @@ void Load(const COptionsMgr *pOptionsMgr, DIFFOPTIONS& options)
options.bIgnoreCase = pOptionsMgr->GetBool(OPT_CMP_IGNORE_CASE);
options.bIgnoreNumbers = pOptionsMgr->GetBool(OPT_CMP_IGNORE_NUMBERS);
options.bIgnoreEol = pOptionsMgr->GetBool(OPT_CMP_IGNORE_EOL);
options.bIgnoreMissingTrailingEol = pOptionsMgr->GetBool(OPT_CMP_IGNORE_MISSING_TRAILING_EOL);
options.bIndentHeuristic = pOptionsMgr->GetBool(OPT_CMP_INDENT_HEURISTIC);
options.bCompletelyBlankOutIgnoredChanges = pOptionsMgr->GetBool(OPT_CMP_COMPLETELY_BLANK_OUT_IGNORED_CHANGES);
}
Expand All @@ -49,6 +51,7 @@ void Save(COptionsMgr *pOptionsMgr, const DIFFOPTIONS& options)
pOptionsMgr->SaveOption(OPT_CMP_IGNORE_CASE, options.bIgnoreCase);
pOptionsMgr->SaveOption(OPT_CMP_IGNORE_NUMBERS, options.bIgnoreNumbers);
pOptionsMgr->SaveOption(OPT_CMP_IGNORE_EOL, options.bIgnoreEol);
pOptionsMgr->SaveOption(OPT_CMP_IGNORE_MISSING_TRAILING_EOL, options.bIgnoreMissingTrailingEol);
pOptionsMgr->SaveOption(OPT_CMP_INDENT_HEURISTIC, options.bIndentHeuristic);
pOptionsMgr->SaveOption(OPT_CMP_COMPLETELY_BLANK_OUT_IGNORED_CHANGES, options.bCompletelyBlankOutIgnoredChanges);
}
Expand Down
Loading
Loading