summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorForNeVeR <neverthness@gmail.com>2015-01-04 16:09:40 +0000
committerForNeVeR <neverthness@gmail.com>2015-01-04 16:09:40 +0000
commit853d5d167ab5c81388963155c4e1e51814b659c9 (patch)
tree39bd48f9b4e4ae55c99612aedee7dbef7930d24f
parent59e9871bf384e6b26d0a0f7c31cc17a76780b5e0 (diff)
Fix history handling in TabsRMM chats. It will no longer be discarded on Ctrl-Up / Ctrl-Down.
git-svn-id: http://svn.miranda-ng.org/main/trunk@11768 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp20
-rw-r--r--plugins/TabSRMM/src/msgs.h3
2 files changed, 21 insertions, 2 deletions
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 8679ba7687..f4db3d6fb4 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -837,6 +837,17 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
LOGFONTA lf;
char *lpPrevCmd = pci->SM_GetPrevCommand(Parentsi->ptszID, Parentsi->pszModule);
+ if (!Parentsi->lpCurrentCommand || !Parentsi->lpCurrentCommand->last) {
+ // Next command is not defined. It means currently entered text is not saved in the history and it
+ // need to be saved in the window context.
+ char *enteredText = Chat_Message_GetFromStream(hwndParent, Parentsi);
+ if (mwdat->enteredText) {
+ mir_free(mwdat->enteredText);
+ }
+
+ mwdat->enteredText = enteredText;
+ }
+
SendMessage(hwnd, WM_SETREDRAW, FALSE, 0);
LoadLogfont(MSGFONTID_MESSAGEAREA, &lf, NULL, FONTMODULE);
@@ -869,8 +880,12 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
ste.codepage = CP_ACP;
if (lpPrevCmd)
SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)lpPrevCmd);
- else
- SetWindowText(hwnd, _T(""));
+ else if (mwdat->enteredText) {
+ // If we cannot load the message from history, load the last edited text.
+ SendMessage(hwnd, EM_SETTEXTEX, (WPARAM)&ste, (LPARAM)mwdat->enteredText);
+ mir_free(mwdat->enteredText);
+ mwdat->enteredText = NULL;
+ }
gtl.flags = GTL_PRECISE;
gtl.codepage = CP_ACP;
@@ -3484,6 +3499,7 @@ LABEL_SHOWWINDOW:
delete dat->Panel;
if (dat->pContainer->dwFlags & CNT_SIDEBAR)
dat->pContainer->SideBar->removeSession(dat);
+ mir_free(dat->enteredText);
mir_free(dat);
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
}
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index d4551f333f..d510046ba1 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -332,6 +332,9 @@ struct TWindowData
LONG iInputAreaHeight;
bool bIsAutosizingInput;
bool fLimitedUpdate;
+
+ // Used for history in chats.
+ char *enteredText;
};
#define MESSAGE_WINDOW_DATA_SIZE offsetof(_MessageWindowData, hdbEventFirst);