mirror of https://github.com/davisking/dlib.git
Added a check to prevent the user from pasting a multi-line
string into a single line text_field. --HG-- extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402754
This commit is contained in:
parent
4944099961
commit
a146d6d757
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "widgets.h"
|
||||
#include <algorithm>
|
||||
#include "../string.h"
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
|
@ -471,6 +472,14 @@ namespace dlib
|
|||
{
|
||||
ustring temp_str;
|
||||
get_from_clipboard(temp_str);
|
||||
|
||||
// If this is a multi line string then just take the first line.
|
||||
ustring::size_type pos = temp_str.find_first_of('\n');
|
||||
if (pos != ustring::npos)
|
||||
{
|
||||
temp_str = temp_str.substr(0,pos);
|
||||
}
|
||||
|
||||
if (highlight_start <= highlight_end)
|
||||
{
|
||||
text_ = text_.substr(0,highlight_start) + temp_str +
|
||||
|
|
Loading…
Reference in New Issue