Okay! Invalidate(FALSE) seems to solve it. Not sure why, but hey, I can roll with it.
--- doc.cpp Mon Jan 19 17:26:36 1970
+++ doc.cpp Mon Jan 19 17:26:36 1970
@@ -7822,4 +7822,20 @@
sort (m_MiniWindowsOrder.begin (), m_MiniWindowsOrder.end (), lessWindow);
} // end of CMUSHclientDoc::SortWindows
+void CMUSHclientDoc::FixInputWrap()
+{
+ for(POSITION pos=GetFirstViewPosition();pos!=NULL;)
+ {
+ CView* pView = GetNextView(pos);
+
+ if (pView->IsKindOf(RUNTIME_CLASS(CSendView)))
+ {
+ CSendView* pmyView = (CSendView*)pView;
+
+ CEdit& theEdit = pmyView->GetEditCtrl();
+
+ pmyView->UpdateWrap();
+}
+
+ }}
--- doc.h Mon Jan 19 17:26:36 1970
+++ doc.h Mon Jan 19 17:26:36 1970
@@ -371,6 +371,7 @@
#define OPT_FIX_OUTPUT_BUFFER 0x000800 // if changed, rework output buffer size
#define OPT_FIX_WRAP_COLUMN 0x001000 // if changed, wrap column has changed
#define OPT_FIX_SPEEDWALK_DELAY 0x002000 // if changed, speedwalk delay has changed
+#define OPT_FIX_INPUT_WRAP 0x003000 // Added for input wrapping.
#define OPT_USE_MXP 0x004000 // if changed, use_mxp has changed
#define OPT_PLUGIN_CANNOT_READ 0x100000 // plugin may not read its value
#define OPT_PLUGIN_CANNOT_WRITE 0x200000 // plugin may not write its value
@@ -880,6 +881,9 @@
unsigned short m_bTreeviewAliases; // show aliases in tree view?
unsigned short m_bTreeviewTimers; // show timers in tree view?
+ // Input window wrap
+ unsigned short m_bAutoWrapInput; // Match input wrap to output?
+
// end of stuff saved to disk **************************************************************
// stuff from pre version 11, read from disk but not saved
@@ -1423,6 +1427,8 @@
CArgumentList & ArgumentList);
void AddToCommandHistory (LPCTSTR Message);
+
+ void FixInputWrap();
// simple test to see if we are in secure mode right now
inline bool MXP_Secure (void)
--- mushview.cpp Mon Jan 19 17:26:36 1970
+++ mushview.cpp Mon Jan 19 17:26:36 1970
@@ -3213,6 +3213,7 @@
pDoc->SendWindowSizes (pDoc->m_nWrapColumn);
EnableScrollBarCtrl (SB_VERT, pDoc->m_bScrollBarWanted);
+ m_bottomview->UpdateWrap();
}
void CMUSHView::OnDisplayFreezeoutput()
--- scriptingoptions.cpp Mon Jan 19 17:26:36 1970
+++ scriptingoptions.cpp Mon Jan 19 17:26:36 1970
@@ -205,10 +205,10 @@
{"utf_8", false, O(m_bUTF_8)},
{"validate_incoming_chat_calls", false, O(m_bValidateIncomingCalls)},
{"warn_if_scripting_inactive", true, O(m_bWarnIfScriptingInactive)},
-{"wrap", true, O(m_wrap)},
-{"wrap_column", 80, O(m_nWrapColumn), 20, MAX_LINE_WIDTH, OPT_FIX_WRAP_COLUMN},
+{"wrap", true, O(m_wrap)},
+{"wrap_input", false, O(m_bAutoWrapInput, 0, 0, OPT_FIX_INPUT_WRAP)}, // Added this, also fix wrap on column change.
+{"wrap_column", 80, O(m_nWrapColumn), 20, MAX_LINE_WIDTH, OPT_FIX_WRAP_COLUMN | OPT_FIX_INPUT_WRAP},
{"write_world_name_to_log", true, O(m_bWriteWorldNameToLog)},
-
{NULL} // end of table marker
}; // end of OptionsTable
@@ -517,6 +517,11 @@
if (m_pCurrentLine) // a new world might not have a line yet
FixUpOutputBuffer (Value);
+ if (OptionsTable [iItem].iFlags & OPT_FIX_INPUT_WRAP)
+ {
+
+ FixInputWrap();
+ }
if (OptionsTable [iItem].iFlags & OPT_FIX_WRAP_COLUMN)
{
if (m_pCurrentLine) // a new world might not have a line yet
--- sendvw.cpp Mon Jan 19 17:26:36 1970
+++ sendvw.cpp Mon Jan 19 17:26:36 1970
@@ -1174,6 +1174,10 @@
NotifyPluginCommandChanged ();
+ CString strCommand = GetText (GetEditCtrl());
+
+ UpdateWrap();
+
} // end of CSendView::OnChange
@@ -1221,8 +1225,54 @@
// if they want auto-command size, put back to 1
AdjustCommandWindowSize ();
+
+ UpdateWrap();
+
} // end of CSendView::OnInitialUpdate
+void CSendView::UpdateWrap() {
+
+ CMUSHclientDoc* pDoc = GetDocument();
+ CEdit& theEdit = GetEditCtrl();
+
+ int iOffset = pDoc->m_iPixelOffset; // Need this either way.
+
+if (pDoc->m_bAutoWrapInput) {
+
+ CRect r;
+ GetClientRect(r); // How big is the input window?
+
+ int iWidth = pDoc->m_nWrapColumn + 1; // Letter-width of the line.
+
+ if (iWidth < 20)
+ iWidth = 20;
+ if (iWidth > MAX_LINE_WIDTH)
+ iWidth = MAX_LINE_WIDTH; // Uses the minimums and maximums from elsewhere.
+
+ // Subtracts the pixel width of text and the left-side offset to determine what the right side should be.
+ int rMargin = r.Width() - (iWidth * pDoc->m_InputFontWidth) - iOffset;
+
+ // If the right side isn't at least as big as the offset, use the offset.
+ if (rMargin < iOffset)
+ rMargin = iOffset;
+
+ // If the margin needs to change, change it.
+ if (rMargin != HIWORD(theEdit.GetMargins()))
+ {
+ theEdit.SetMargins(iOffset,rMargin);
+ theEdit.Invalidate(FALSE);
+ }
+
+} else {
+
+ if ( HIWORD(theEdit.GetMargins()) != iOffset) // If the option is off, just using the offset.
+ {
+ theEdit.SetMargins(iOffset,iOffset);
+ theEdit.Invalidate(FALSE);
+ }
+}
+
+}
void CSendView::OnContextMenu(CWnd*, CPoint point)
{
--- sendvw.h Mon Jan 19 17:26:36 1970
+++ sendvw.h Mon Jan 19 17:26:36 1970
@@ -86,6 +86,7 @@
//{{AFX_VIRTUAL(CSendView)
public:
virtual void OnInitialUpdate();
+ virtual void UpdateWrap();
virtual BOOL PreTranslateMessage(MSG* pMsg);
protected:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
|