[geany/geany-plugins] 15d28a: TableConvert: Fixing an issue on handling \r and \n (Windows style files) and 'empty' lines inside created table
Frank Lanitz
git-noreply at xxxxx
Sun Oct 5 10:14:39 UTC 2014
Branch: refs/heads/master
Author: Frank Lanitz <frank at frank.uvena.de>
Committer: Frank Lanitz <frank at frank.uvena.de>
Date: Sun, 05 Oct 2014 10:14:39 UTC
Commit: 15d28a574d644dba500c9f3f75615d2e31b0c44c
https://github.com/geany/geany-plugins/commit/15d28a574d644dba500c9f3f75615d2e31b0c44c
Log Message:
-----------
TableConvert: Fixing an issue on handling \r and \n (Windows style files) and 'empty' lines inside created table
Modified Paths:
--------------
tableconvert/ChangeLog
tableconvert/src/tableconvert.c
Modified: tableconvert/ChangeLog
7 lines changed, 7 insertions(+), 0 deletions(-)
===================================================================
@@ -1,3 +1,10 @@
+2014-10-05 Frank Lanitz <frank at frank.uvena.de>
+
+ * Fixing an issue where \r and \n on e.g. Windows files handled as
+ seperate lines ending up in 'empty' table lines.
+
+
+
2014-09-28 Frank Lanitz <frank at frank.uvena.de>
* SQL: Treating every column as a string when transfering data to SQL
Modified: tableconvert/src/tableconvert.c
8 lines changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -184,10 +184,18 @@ static void convert_to_table(gboolean header)
gchar *selection = NULL;
gchar **rows = NULL;
gchar *replacement = NULL;
+ GString *selection_str = NULL;
/* Actually grabbing selection and splitting it into single
* lines we will work on later */
selection = sci_get_selection_contents(doc->editor->sci);
+
+ selection_str = g_string_new(selection);
+ utils_string_replace_all(selection_str, "\r\n", "\n");
+
+ g_free(selection);
+ selection = g_string_free(selection_str, FALSE);
+
rows = g_strsplit_set(selection, "\r\n", -1);
g_free(selection);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list