diff options
author | infirit <[email protected]> | 2015-09-02 11:51:13 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2015-09-02 11:51:13 +0200 |
commit | ab31ab9b12f0741a1b7bf3e63cb9ee095e98e76e (patch) | |
tree | b4efdfd5e1f3a8c541cf529f7c9add043e5b7641 | |
parent | 0c974a2db537184870d498318fedc1ec36f32933 (diff) | |
download | pluma-ab31ab9b12f0741a1b7bf3e63cb9ee095e98e76e.tar.bz2 pluma-ab31ab9b12f0741a1b7bf3e63cb9ee095e98e76e.tar.xz |
Revert "Fix issue#100: CRLF across 8k boundary inserts an empty line."
This reverts commit f6d7a422f3f5f97e676cd18cef5bb46aca8da6be.
-rw-r--r-- | pluma/pluma-document-output-stream.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/pluma/pluma-document-output-stream.c b/pluma/pluma-document-output-stream.c index df1f58c9..06aa728d 100644 --- a/pluma/pluma-document-output-stream.c +++ b/pluma/pluma-document-output-stream.c @@ -290,6 +290,7 @@ pluma_document_output_stream_write (GOutputStream *stream, gsize len; gboolean freetext = FALSE; const gchar *end; + gsize nvalid; gboolean valid; if (g_cancellable_set_error_if_cancelled (cancellable, error)) @@ -327,22 +328,16 @@ pluma_document_output_stream_write (GOutputStream *stream, /* validate */ valid = g_utf8_validate (text, len, &end); - - /* Avoid keeping a CRLF across two buffers. */ - if (valid && len > 1 && end[-1] == '\r') { - valid = FALSE; - end--; - } + nvalid = end - text; if (!valid) { - gsize nvalid = end - text; - gsize remainder = len - nvalid; - gunichar ch; + gsize remainder; + + remainder = len - nvalid; if ((remainder < MAX_UNICHAR_LEN) && - ((ch = g_utf8_get_char_validated (text + nvalid, remainder)) == (gunichar)-2 || - ch == (gunichar)'\r')) + (g_utf8_get_char_validated (text + nvalid, remainder) == (gunichar)-2)) { ostream->priv->buffer = g_strndup (end, remainder); ostream->priv->buflen = remainder; @@ -350,7 +345,7 @@ pluma_document_output_stream_write (GOutputStream *stream, } else { - /* TODO: we could escape invalid text and tag it in red + /* TODO: we cuould escape invalid text and tag it in red * and make the doc readonly. */ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, |