From 2058a2537389fc85d58564cccea7f0ddc2ea31fe Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Tue, 31 May 2016 11:31:58 +0000 Subject: [PATCH] Hopefully final fix of HTML entity handling git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@11763 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Help_View.cxx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx index 588ed6d52..fcf3fe1a0 100644 --- a/src/Fl_Help_View.cxx +++ b/src/Fl_Help_View.cxx @@ -71,7 +71,6 @@ #define MAX_COLUMNS 200 - // // Typedef the C API sort function type the only way I know how... // @@ -1126,7 +1125,7 @@ Fl_Help_View::draw() if (!pre) current_pos = (int) (ptr-value_); needspace = 1; } - else if (*ptr == '&')// process html entity + else if (*ptr == '&') // process html entity { ptr ++; @@ -3042,7 +3041,7 @@ void Fl_Help_View::end_selection(int clipboard) // convert the select part of our html text into some kind of somewhat readable UTF-8 // and store it in the selection buffer int p = 0; - char pre = 0;; + char pre = 0; int len = (int) strlen(value_); char *txt = (char*)malloc(len+1), *d = txt; const char *s = value_, *cmd, *src; @@ -3090,7 +3089,7 @@ void Fl_Help_View::end_selection(int clipboard) *d++ = *src++; } c = src[-1] & 0xff; - p = isspace(c&255) ? ' ' : c; + p = isspace(c) ? ' ' : c; } continue; } @@ -3107,8 +3106,8 @@ void Fl_Help_View::end_selection(int clipboard) } int n = (int) (s2-value_); if (n>selection_first && n<=selection_last) { - if (!pre && isspace(c)) c = ' '; - if (p!=' ' || c!=' ') { + if (!pre && c < 256 && isspace(c)) c = ' '; + if (p != ' ' || c != ' ') { if (s2 != s) { // c was an HTML entity d += fl_utf8encode(c, d); } @@ -3120,6 +3119,7 @@ void Fl_Help_View::end_selection(int clipboard) } *d = 0; Fl::copy(txt, (int) strlen(txt), clipboard); + // printf("copy [%s]\n", txt); free(txt); }