Commit 1dd925cdb9fe3f23095751e98bb02a67c8d655a9

Authored by Perry Werneck
2 parents dfefe3cf 5f8647ab
Exists in master and in 1 other branch develop

Merge branch 'master' into fix_apl_chars

Showing 1 changed file with 8 additions and 25 deletions   Show diff stats
src/selection/text.c
... ... @@ -53,6 +53,7 @@ gchar * v3270_get_selection_as_text(v3270 * terminal, const GList *selection, co
53 53 src++;
54 54  
55 55 }
  56 + g_string_append_c(string,'\n');
56 57 }
57 58  
58 59 selection = g_list_next(selection);
... ... @@ -60,6 +61,13 @@ gchar * v3270_get_selection_as_text(v3270 * terminal, const GList *selection, co
60 61  
61 62 g_autofree char * text = g_string_free(string,FALSE);
62 63  
  64 + // Remove ending CR.
  65 + {
  66 + size_t length = strlen(text);
  67 + if(length > 1 && text[length-1] == '\n') // The '\n' isn't really necessary but...
  68 + text[length-1] = 0;
  69 + }
  70 +
63 71 return g_convert(text, -1, (encoding ? encoding : "UTF-8"), lib3270_get_display_charset(terminal->host), NULL, NULL, NULL);
64 72  
65 73 }
... ... @@ -138,31 +146,6 @@ gchar * v3270_convert_to_3270_charset(GtkWidget *widget, const gchar *text, cons
138 146  
139 147 }
140 148  
141   - /*
142   - // Still failing, convert line by line
143   - {
144   - size_t f;
145   - gchar **ln = g_strsplit(text,"\n",-1);
146   -
147   - for(f=0;ln[f];f++)
148   - {
149   - GError *error = NULL;
150   - gchar *str = g_convert(ln[f], -1, charset, encoding, NULL, NULL, error);
151   -
152   - if(!str)
153   - {
154   - g_strfreev(ln);
155   - return NULL;
156   - }
157   -
158   - g_free(str);
159   -
160   - }
161   - g_strfreev(ln);
162   -
163   - }
164   - */
165   -
166 149 // Can't convert, use fallbacks
167 150 return g_convert_with_fallback(
168 151 text,
... ...