From eaed653ad3e5011a503316ee7547719c26a8431b Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 23 Mar 2020 15:53:56 +0000 Subject: [PATCH] WebView 1.93: - handle the case when '&' is written as non special caracter like   - handle emply lines of list to aboid more than 2 emply lines for better readability - improve img tag display - show colored background of all text in debug mode - improve page display if no html or body tag but the page is still has tags to display git-svn-id: svn://kolibrios.org@7749 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 38 ++++++++++++++++++++++----------- programs/cmm/TWB/unicode_tags.h | 20 ++++++++--------- programs/cmm/browser/WebView.c | 4 ++-- programs/cmm/lib/strings.h | 1 + 4 files changed, 39 insertions(+), 24 deletions(-) diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index 8921196ab7..b25f7277f6 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -96,6 +96,10 @@ void TWebBrowser::DrawStyle() stolbec_len = strlen(#line) * zoom; line_length = stolbec_len * list.font_w; + if (debug_mode) { + DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h-1, 0xDDDddd); + } + if (style.bg_color!=page_bg) { DrawBuf.DrawBar(start_x, draw_y, line_length, list.item_h-1, style.bg_color); } @@ -154,8 +158,10 @@ void TWebBrowser::Prepare(){ dword bufpos; dword line_len; SetPageDefaults(); - if (strstri(bufpointer, "';') && (j<7); j++, bufpos++;) + for (j=1, tag=0; (ESBYTE[bufpos+j]<>';') && (j<8); j++) { - bukva = ESBYTE[bufpos]; + bukva = ESBYTE[bufpos+j]; chrcat(#tag, bukva); } - if (bukva = GetUnicodeSymbol()) goto DEFAULT_MARK; + if (bukva = GetUnicodeSymbol(#tag)) { + bufpos += j; + } else { + bukva = '&'; + } + goto DEFAULT_MARK; break; case '<': bufpos++; @@ -224,7 +233,7 @@ void TWebBrowser::Prepare(){ sprintf(#tagparam, "", #tag); j = strstri(bufpos, #tagparam); if (j!=-1) { - bufpos = j; + bufpos = j-1; } tag = tagparam = NULL; break; @@ -286,7 +295,7 @@ void TWebBrowser::Perenos() } //============================================================================================ void TWebBrowser::SetStyle() { - char img_path[4096]; + char img_path[4096]=0; int left1 = body_magrin + list.x; int meta_encoding; if (istag("html")) { @@ -396,14 +405,16 @@ void TWebBrowser::SetStyle() { if (istag("img")) { do{ if (isattr("src=")) strncpy(#img_path, #val, sizeof(img_path)-1); - if (isattr("alt=")) && (strlen(#val)=0) && (j<=72) && (strlen(#tag) == 5) + + j = atoi(in_tag + 1) - 1040; + if (tag[1] == '1') && (j>=0) && (j<=72) && (strlen(in_tag) == 5) { - return unicode_chars[j]; + chrcat(#line, unicode_chars[j]); + return true; } - - strcat(#line,#tag); //âûâîäèì íà ýêðàí íåîáðàáîòàííûé òåã, òàê áðàóçåðû çà÷åì-òî äåëàþò - return NULL; + + return false; } diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 072e0f9dd3..16a329f2f4 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -32,7 +32,7 @@ _http http = {0, 0, 0, 0, 0, 0, 0}; #ifdef LANG_RUS -char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.92"; +char version[]="’¥ªáâ®¢ë© ¡à ã§¥à 1.93"; #define T_LOADING "‡ £à㧪  áâà ­¨æë..." #define T_RENDERING "¥­¤¥à¨­£..." char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; @@ -48,7 +48,7 @@ char link_menu[] = "Š®¯¨à®¢ âì áá뫪㠑ª ç âì ᮤ¥à¦¨¬®¥ áá뫪¨"; #else -char version[]="Text-based Browser 1.9"; +char version[]="Text-based Browser 1.93"; #define T_LOADING "Loading..." #define T_RENDERING "Rendering..." char page_not_found[] = FROM "html\\page_not_found_en.htm""\0"; diff --git a/programs/cmm/lib/strings.h b/programs/cmm/lib/strings.h index a5757fb4fb..a3fd769a51 100644 --- a/programs/cmm/lib/strings.h +++ b/programs/cmm/lib/strings.h @@ -14,6 +14,7 @@ // strcpy( EDI, ESI) --- 0 if == // strlcpy(dword text1,text2,signed length) // strcat( EDI, ESI) +// chrcat(ESI, BL) // strncat(dword text1,text2,signed length) --- pasting the text of a certain length // strchr( ESI,BL) --- find first BL // strrchr( ESI,BL) --- find last BL