Commit a146d6d7 authored by Davis King's avatar Davis King

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
parent 49440999
......@@ -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 +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment