--- old/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.cpp 2015-09-18 17:00:24.157156999 +0530 +++ new/jdk/src/java.desktop/windows/native/libawt/windows/awt_TextField.cpp 2015-09-18 17:00:23.917037000 +0530 @@ -283,6 +283,38 @@ delete secs; } +/* +Remove any LF, CRLF i.e. EOL characters from pStr +*/ +int AwtTextField::RemoveEOL(WCHAR *pStr) +{ + int i, nLen = 0; + if (pStr) { + /* check to see if there are any LF's */ + if (wcschr(pStr, L'\n') == NULL) { + return static_cast(wcslen(pStr)); + } + + for (i = 0; pStr[i] != 0; i++) { + if (m_isLFonly == TRUE) { + if (pStr[i] == L'\n') { + pStr[nLen++] = ' '; + continue; + } + } + else { + if (pStr[i] == L'\r' && pStr[i + 1] == L'\n') { + pStr[nLen++] = ' '; + ++i; + continue; + } + } + pStr[nLen++] = pStr[i]; + } + pStr[nLen] = 0; + } + return nLen; +} /************************************************************************ * WTextFieldPeer native methods