CGroupEditBox: ignore enter key when ctrl is pressed (ctrl+m combo) (issue #225)

This commit is contained in:
Nimetu 2015-01-09 12:59:53 +02:00
parent bdfa7a624e
commit c05b296472
2 changed files with 7 additions and 6 deletions

View file

@ -999,7 +999,8 @@ namespace NLGUI
break; break;
// OTHER // OTHER
default: default:
if ((rEDK.getChar() == KeyRETURN) && !_WantReturn) bool isKeyRETURN = !rEDK.getKeyCtrl() && rEDK.getChar() == KeyRETURN;
if (isKeyRETURN && !_WantReturn)
{ {
// update historic. // update historic.
if(_MaxHistoric) if(_MaxHistoric)
@ -1030,9 +1031,9 @@ namespace NLGUI
// If the char is not alphanumeric -> return. // If the char is not alphanumeric -> return.
// if(!isalnum(ec.Char)) // if(!isalnum(ec.Char))
// return // return
if( (rEDK.getChar()>=32) || (rEDK.getChar() == KeyRETURN) ) if( (rEDK.getChar()>=32) || isKeyRETURN )
{ {
if (rEDK.getChar() == KeyRETURN) if (isKeyRETURN)
{ {
ucstring copyStr= _InputString; ucstring copyStr= _InputString;
if ((uint) std::count(copyStr.begin(), copyStr.end(), '\n') >= _MaxNumReturn) if ((uint) std::count(copyStr.begin(), copyStr.end(), '\n') >= _MaxNumReturn)
@ -1049,7 +1050,7 @@ namespace NLGUI
cutSelection(); cutSelection();
} }
ucchar c = (rEDK.getChar() == KeyRETURN)?'\n':rEDK.getChar(); ucchar c = isKeyRETURN ? '\n' : rEDK.getChar();
if (isFiltered(c)) return; if (isFiltered(c)) return;
switch(_EntryType) switch(_EntryType)
{ {
@ -1128,7 +1129,7 @@ namespace NLGUI
++ _CursorPos; ++ _CursorPos;
triggerOnChangeAH(); triggerOnChangeAH();
} }
if (rEDK.getChar() == KeyRETURN) if (isKeyRETURN)
{ {
CAHManager::getInstance()->runActionHandler(_AHOnEnter, this, _AHOnEnterParams); CAHManager::getInstance()->runActionHandler(_AHOnEnter, this, _AHOnEnterParams);
} }

View file

@ -2207,7 +2207,7 @@ namespace NLGUI
} }
// Manage complex "Enter" // Manage complex "Enter"
if (eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyRETURN) if( eventDesc.getKeyEventType() == CEventDescriptorKey::keychar && eventDesc.getChar() == NLMISC::KeyRETURN && !eventDesc.getKeyCtrl() )
{ {
// If the top window has Enter AH // If the top window has Enter AH
CInterfaceGroup *tw= getTopWindow(); CInterfaceGroup *tw= getTopWindow();