- if(m_WrapMargin > 0 && isspace(keyCode))
- {
- bool wrapped = m_llist->WrapLine(m_WrapMargin);
- // don´t insert space as first thing in line
- // after wrapping:
- if(! wrapped || m_llist->GetCursorPos().x != 0)
- m_llist->Insert((char)keyCode);
- }
- else
- m_llist->Insert((char)keyCode);
+ if(m_DoWordWrap
+ && m_WrapMargin > 0
+ && m_llist->GetCursorPos().x > m_WrapMargin
+ && isspace(keyCode))
+ m_llist->WrapLine(m_WrapMargin);
+ m_llist->Insert((char)keyCode);