[gtkhtml] Skip \n and \r from whitespace recognition on HTML text paste
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkhtml] Skip \n and \r from whitespace recognition on HTML text paste
- Date: Fri, 28 Jun 2013 17:40:41 +0000 (UTC)
commit 0f5afe024fbef3bdc1cbf2dafcefd31f51c30cef
Author: Milan Crha <mcrha redhat com>
Date: Fri Jun 28 19:37:20 2013 +0200
Skip \n and \r from whitespace recognition on HTML text paste
This fixes a bug in the previous commit. In case of a mutliline
paste the new line markers are properly encoded within HTML tags,
thus adding them as plain text resulted in doubled new lines.
gtkhtml/gtkhtml.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtkhtml/gtkhtml.c b/gtkhtml/gtkhtml.c
index 635ce04..8d8f820 100644
--- a/gtkhtml/gtkhtml.c
+++ b/gtkhtml/gtkhtml.c
@@ -4631,7 +4631,9 @@ clipboard_paste_received_cb (GtkClipboard *clipboard,
gint leading_spaces = 0;
/* check for leading spaces */
- while (g_ascii_isspace (utf8[leading_spaces]))
+ while (g_ascii_isspace (utf8[leading_spaces]) &&
+ utf8[leading_spaces] != '\n' &&
+ utf8[leading_spaces] != '\r')
leading_spaces++;
if (leading_spaces)
@@ -4647,7 +4649,7 @@ clipboard_paste_received_cb (GtkClipboard *clipboard,
ptr = utf8;
while (ptr = g_utf8_next_char (ptr), ptr && *ptr) {
- if (g_ascii_isspace (*ptr)) {
+ if (g_ascii_isspace (*ptr) && *ptr != '\n' && *ptr != '\r') {
if (!from)
from = ptr;
} else {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]