diff --git a/programs/cmm/browser/TWB/TWB.c b/programs/cmm/browser/TWB/TWB.c index b4116354e0..102e321eb1 100644 --- a/programs/cmm/browser/TWB/TWB.c +++ b/programs/cmm/browser/TWB/TWB.c @@ -216,8 +216,11 @@ void TWebBrowser::AddCharToTheLine(unsigned char _char) if (draw_x==left_gap) && (!linebuf) return; //no paces at the beginning of the line if (link) && (line_len==0) return; } - if (line_len < sizeof(TWebBrowser.linebuf)) chrcat(#linebuf+line_len, _char); - if (line_len+1 * list.font_w + draw_x >= draw_w) RenderTextbuf(); + if (line_len < sizeof(TWebBrowser.linebuf)) { + chrcat(#linebuf+line_len, _char); + } else { + RenderTextbuf(); + } } //============================================================================================ void TWebBrowser::NewLine() diff --git a/programs/cmm/browser/TWB/render.h b/programs/cmm/browser/TWB/render.h index 76979d5498..231f141b87 100644 --- a/programs/cmm/browser/TWB/render.h +++ b/programs/cmm/browser/TWB/render.h @@ -54,14 +54,15 @@ void TWebBrowser::RenderLine() } draw_x += pw; if (debug_mode) debugln(#linebuf); - linebuf = NULL; } + linebuf = NULL; } + void TWebBrowser::RenderTextbuf() { int break_pos; - char next_line[4096]; + char next_line[sizeof(TWebBrowser.linebuf)]; int zoom = list.font_w / BASIC_CHAR_W; //Do we need a line break? @@ -72,20 +73,30 @@ void TWebBrowser::RenderTextbuf() //Is a new line fits in the current line? if (break_pos * list.font_w + draw_x > draw_w) { break_pos = draw_w - draw_x /list.font_w; - while(break_pos) && (linebuf[break_pos]!=' ') break_pos--; + while(break_pos) { + if (linebuf[break_pos]==' ') { + break_pos++; + break; + } + break_pos--; + } } //Maybe a new line is too big for the whole new line? Then we have to split it if (!break_pos) && (style.tag_list.level*5 + strlen(#linebuf) * zoom >= list.column_max) { break_pos = draw_w - draw_x / list.font_w; } - strcpy(#next_line, #linebuf + break_pos); - linebuf[break_pos] = 0x00; - - RenderLine(); - strcpy(#linebuf, #next_line); - NewLine(); + if (break_pos) { + strlcpy(#next_line, #linebuf + break_pos, sizeof(next_line)); + linebuf[break_pos] = 0x00; + RenderLine(); + strlcpy(#linebuf, #next_line, sizeof(TWebBrowser.linebuf)); + NewLine(); + } else { + NewLine(); + RenderLine(); + } } RenderLine(); } diff --git a/programs/cmm/browser/TWB/set_style.h b/programs/cmm/browser/TWB/set_style.h index 705bed90cf..4976a3f63d 100644 --- a/programs/cmm/browser/TWB/set_style.h +++ b/programs/cmm/browser/TWB/set_style.h @@ -87,15 +87,15 @@ void TWebBrowser::tag_font() } else { text_colors.pop(); - bg_colors.pop(); + if (bg_colors.count>1) bg_colors.pop(); //never pop the last color } } void TWebBrowser::tag_div() { - if (streq(#tag.prior,"div")) && (tag.opened) return; + //if (streq(#tag.prior,"div")) && (tag.opened) return; if (streq(#tag.prior,"td")) return; - //if (streq(#tag.prior,"div")) return; + if (streq(#tag.prior,"div")) return; if (!tag.opened) && (style.font) text_colors.pop(); NewLine(); } @@ -161,7 +161,7 @@ void TWebBrowser::tag_code() if (style.pre = tag.opened) { bg_colors.add(0xe4ffcb); } else { - bg_colors.pop(); + if (bg_colors.count>1) bg_colors.pop(); //never pop the last color } } @@ -384,7 +384,7 @@ void TWebBrowser::tag_td() } if (left_gap >= list.w - list.font_w - 10) { - notify("left_gap overflow"); + debugln("left_gap overflow"); draw_x = left_gap = BODY_MARGIN; table.cx.drop(); table.count = 999; @@ -392,7 +392,7 @@ void TWebBrowser::tag_td() } if (draw_w < 0) || (draw_w >= list.w) { - notify("draw_w overflow"); + debugln("draw_w overflow"); draw_x = left_gap = BODY_MARGIN; draw_w = list.w - left_gap; NewLine(); diff --git a/programs/cmm/browser/TWB/special.h b/programs/cmm/browser/TWB/special.h index 8d61202d9d..2e23b8f35d 100644 --- a/programs/cmm/browser/TWB/special.h +++ b/programs/cmm/browser/TWB/special.h @@ -6,7 +6,7 @@ char *unicode_symbols[]={ "#183","\31", "middot", "\31", "#149","-", "#151","-", -"#160"," ", "nbsp", " ", "emsp", " ", +"#160"," ", "nbsp", "\t", "emsp", " ", "#169","(c)", "copy", "(c)", "#171","<<", "laquo","<<", "#174","(r)", "reg", "(r)", @@ -19,7 +19,7 @@ char *unicode_symbols[]={ "ndash", "-", "mdash", "-", //-- -"rsquo", "'", +"rsquo", "'", "apos", "'", "sect", "#", "ensp", " ", diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index ad6345005c..1169c39129 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -211,7 +211,10 @@ void main() } if (http.receive_result != 0) break; - if (debug_mode) debugval("HTTP", http.status_code); + if (debug_mode) { + EAX = http.transfer; + debugln(#EAX.http_msg.http_header); + } if (http.status_code >= 300) && (http.status_code < 400) { // Handle redirects @@ -892,17 +895,20 @@ void CheckContentType() char content_type[64]; if (http.header_field("content-type", #content_type, sizeof(content_type))) // application || image - if (strchr(#content_type, '=')) { - WB1.custom_encoding = get_encoding_type_by_name(EAX+1); - } - if (content_type[0] == 'i') { EventDownloadAndOpenImage(http.cur_url); StopLoading(); - }if (content_type[0] == 'a') { + } + else if (content_type[0] == 'a') { EventOpenDownloader(http.cur_url); StopLoading(); } + else { + WB1.custom_encoding = -1; + if (EAX = strchr(#content_type, '=')) { + WB1.custom_encoding = get_encoding_type_by_name(EAX+1); + } + } } void EventDownloadAndOpenImage(dword _url) diff --git a/programs/cmm/browser/const.h b/programs/cmm/browser/const.h index a8ebbf81af..ba4ea2b957 100644 --- a/programs/cmm/browser/const.h +++ b/programs/cmm/browser/const.h @@ -107,4 +107,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw"; #define DEFAULT_URL URL_SERVICE_HOMEPAGE -char version[]="WebView 3.29"; \ No newline at end of file +char version[]="WebView 3.30"; \ No newline at end of file diff --git a/programs/cmm/browser/res/help_en.htm b/programs/cmm/browser/res/help_en.htm index e1b06b7804..8d7a0d27d0 100644 --- a/programs/cmm/browser/res/help_en.htm +++ b/programs/cmm/browser/res/help_en.htm @@ -1,9 +1,4 @@ - -
- -Bookmarks: -1. KolibriOS homepage -2. KolibriN homepage +1. KolibriOS homepage +2. KolibriN homepage 3. Kolibri Stuff By the way, • You can check for browser updates from the main menu. • To run a web search, type a text in the adress box and press Ctrl+Enter. -• You can also use other Hotkeys. +• You can also use other Hotkeys. • Click on a label in the bottom right corner to change the encoding of a page. - - -- -