From db3293060f90a23ce6c2fcce827e4180e111bf44 Mon Sep 17 00:00:00 2001 From: Yves Rizoud Date: Tue, 27 Sep 2011 00:03:16 +0000 Subject: [PATCH] Clipboard paste: Support carriage returns and characters 128-255 git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1836 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/readline.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/readline.c b/src/readline.c index e9afbd36..c33d7dfe 100644 --- a/src/readline.c +++ b/src/readline.c @@ -104,7 +104,7 @@ int Prepend_string(char* dest, char* src, int max) return sizes; } -int Valid_character(int c, int input_type) +int Valid_character(word c, int input_type) // returns 0 = Not allowed // returns 1 = Allowed // returns 2 = Allowed only once at start of string (for - sign in numbers) @@ -166,9 +166,17 @@ int Valid_character(int c, int input_type) void Cleanup_string(char* str, int input_type) { - int pos = 0; - while(Valid_character(str[pos++], input_type)); - str[--pos] = 0; + int i,j=0; + + for(i=0; str[i]!='\0'; i++) + { + if (Valid_character((unsigned char)(str[i]), input_type)) + { + str[j]=str[i]; + j++; + } + } + str[j] = '\0'; } void Display_whole_string(word x_pos,word y_pos,char * str,byte position)