Skip to content

Commit 1e50f1c

Browse files
committed
If you arrow up or down and replace your typing, it can be saved automtically
1 parent 6669b22 commit 1e50f1c

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

dialogs/world_prefs/CommandOptionsDlg.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ BEGIN_MESSAGE_MAP(CCommandOptionsDlg, CDialog)
6464
ON_BN_CLICKED(IDC_DOUBLE_CLICK_INSERTS, OnDoubleClickInserts)
6565
//}}AFX_MSG_MAP
6666
ON_MESSAGE(WM_KICKIDLE, OnKickIdle)
67-
ON_UPDATE_COMMAND_UI(IDC_SAVE_DELETED, OnUpdateNeedEscapeDeletesTyping)
6867
END_MESSAGE_MAP()
6968

7069
/////////////////////////////////////////////////////////////////////////////
@@ -76,10 +75,6 @@ LRESULT CCommandOptionsDlg::OnKickIdle(WPARAM, LPARAM)
7675
return 0;
7776
} // end of CCommandOptionsDlg::OnKickIdle
7877

79-
void CCommandOptionsDlg::OnUpdateNeedEscapeDeletesTyping(CCmdUI* pCmdUI)
80-
{
81-
pCmdUI->Enable (m_ctlEscapeDeletesTypeing.GetCheck ());
82-
} // end of CCommandOptionsDlg::OnUpdateNeedEscapeDeletesTyping
8378

8479
BOOL CCommandOptionsDlg::OnInitDialog()
8580
{

dialogs/world_prefs/CommandOptionsDlg.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class CCommandOptionsDlg : public CDialog
5454
afx_msg void OnDoubleClickInserts();
5555
//}}AFX_MSG
5656
afx_msg LRESULT OnKickIdle(WPARAM, LPARAM);
57-
afx_msg void OnUpdateNeedEscapeDeletesTyping(CCmdUI* pCmdUI);
5857
DECLARE_MESSAGE_MAP()
5958
};
6059

sendvw.cpp

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,14 +1280,20 @@ bool CSendView::CheckTyping (CMUSHclientDoc* pDoc, CString strReplacement)
12801280
{
12811281
const int iLimit = 200;
12821282

1283-
if (!pDoc->m_bConfirmBeforeReplacingTyping)
1283+
// they didn't personally type anything, so accept it
1284+
if (!m_bChanged)
12841285
return false;
12851286

12861287
CString strCurrent;
12871288

12881289
GetEditCtrl().GetWindowText (strCurrent);
12891290

1290-
if (strCurrent.GetLength () != 0 && m_bChanged)
1291+
// nothing there? who cares?
1292+
if (strCurrent.GetLength () == 0)
1293+
return false;
1294+
1295+
// if they want confirmation, do it
1296+
if (pDoc->m_bConfirmBeforeReplacingTyping)
12911297
{
12921298

12931299
// don't echo ridiculous amounts of text
@@ -1317,31 +1323,33 @@ CString strCurrent;
13171323
return true;
13181324
}
13191325

1320-
// preserve what we are about to delete, if requested to do so
13211326

1322-
if (pDoc->m_bSaveDeletedCommand)
1323-
{
1324-
CString str = GetText (GetEditCtrl());
1327+
} // end if confirmation wanted
13251328

1326-
// do not record null commands, or ones identical to the previous one
13271329

1328-
if (!str.IsEmpty () && str != m_last_command)
1330+
// preserve what we are about to delete, if requested to do so
1331+
1332+
if (pDoc->m_bSaveDeletedCommand)
1333+
{
1334+
CString str = GetText (GetEditCtrl());
1335+
1336+
// do not record null commands, or ones identical to the previous one
1337+
1338+
if (!str.IsEmpty () && str != m_last_command)
1339+
{
1340+
if (m_inputcount >= pDoc->m_nHistoryLines)
13291341
{
1330-
if (m_inputcount >= pDoc->m_nHistoryLines)
1331-
{
1332-
m_msgList.RemoveHead (); // keep max of "m_nHistoryLines" previous commands
1333-
m_HistoryFindInfo.m_nCurrentLine--; // adjust for a "find again"
1334-
if (m_HistoryFindInfo.m_nCurrentLine < 0)
1335-
m_HistoryFindInfo.m_nCurrentLine = 0;
1336-
}
1337-
else
1338-
m_inputcount++;
1339-
m_msgList.AddTail (str);
1340-
m_last_command = str;
1342+
m_msgList.RemoveHead (); // keep max of "m_nHistoryLines" previous commands
1343+
m_HistoryFindInfo.m_nCurrentLine--; // adjust for a "find again"
1344+
if (m_HistoryFindInfo.m_nCurrentLine < 0)
1345+
m_HistoryFindInfo.m_nCurrentLine = 0;
13411346
}
1342-
}
1343-
1344-
}
1347+
else
1348+
m_inputcount++;
1349+
m_msgList.AddTail (str);
1350+
m_last_command = str;
1351+
} // end command different
1352+
} // end if save deleted command
13451353

13461354
return false;
13471355
}

0 commit comments

Comments
 (0)