From 7d4d55278651134cb98a461db1fffbfb995166af Mon Sep 17 00:00:00 2001 From: Ole Christian Eidheim Date: Sun, 1 Nov 2015 13:41:17 +0100 Subject: [PATCH] Fixes #77. --- src/source.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/source.cc b/src/source.cc index de59144..f2865f8 100644 --- a/src/source.cc +++ b/src/source.cc @@ -531,13 +531,11 @@ void Source::View::replace_all(const std::string &replacement) { void Source::View::paste() { auto text=Gtk::Clipboard::get()->wait_for_text(); - //replace stand-alone carriage returns (which makes clang return wrong line index) with newlines + + //remove carriage returns (which leads to crash) for(auto it=text.begin();it!=text.end();it++) { if(*it=='\r') { - auto it2=it; - it2++; - if(it2==text.end() || *it2!='\n') - text.replace(it, it2, "\n"); + it=text.erase(it); } }