Skip to content

Commit f82819a

Browse files
committed
Improved way variables with imbedded newlines are edited
1 parent 65921ff commit f82819a

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

dialogs/world_prefs/prefspropertypages.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6980,7 +6980,8 @@ void CPrefsP18::LoadDialog (CDialog * pDlg, CObject * pItem)
69806980
ASSERT( variable_item->IsKindOf( RUNTIME_CLASS( CVariable ) ) );
69816981

69826982
dlg->m_strName = variable_item->strLabel;
6983-
dlg->m_strContents = variable_item->strContents;
6983+
dlg->m_strContents = Replace (variable_item->strContents, "\r", "", true);
6984+
dlg->m_strContents = Replace (dlg->m_strContents, "\n", ENDLINE, true);
69846985

69856986
dlg->m_pVariableMap = &m_doc->m_VariableMap;
69866987
dlg->m_bDoingChange = true;
@@ -7157,8 +7158,12 @@ int nItem;
71577158
m_ctlVariableList.SetItemText(nItem, eColumnName, variable_item->strLabel);
71587159
}
71597160

7160-
m_ctlVariableList.SetItemText(nItem, eColumnContents,
7161-
Replace (variable_item->strContents, ENDLINE, "\\n", true));
7161+
// first get rid of carriage-returns
7162+
CString strContents = Replace (variable_item->strContents, "\r", "", true);
7163+
// now show newlines as \n
7164+
strContents = Replace (strContents, "\n", "\\n", true);
7165+
7166+
m_ctlVariableList.SetItemText(nItem, eColumnContents, strContents);
71627167

71637168
return nItem;
71647169

world_debug.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,8 +2015,11 @@ void CMUSHclientDoc::DebugHelper (const CString strAction, CString strArgument)
20152015
CString strSendTo;
20162016
strSendTo.Format (" [%s]", (LPCTSTR) GetSendToString (m_CommandToSendToMap [sit->second]));
20172017

2018-
CString strContents = Replace (command.c_str (), ENDLINE, "\\n", true);
2019-
2018+
// first get rid of carriage-returns
2019+
CString strContents = Replace (command.c_str (), "\r", "", true);
2020+
// now show newlines as \n
2021+
strContents = Replace (strContents, "\n", "\\n", true);
2022+
20202023
if (strContents.GetLength () > 40)
20212024
{
20222025
strContents = strContents.Left (37);

0 commit comments

Comments
 (0)