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 @@ - - - -WebView Help - - +WebView Help

WebView Text-Based Browser

@@ -11,18 +6,14 @@ It is free and open-source. If you have any suggestions or want to help improvin Shortcut keys -[CTRL + N or CTRL + T] New window -[CTRL + R or F5] Refresh the current page -[CTRL + O] Start OpenDialog to open local file -[CTRL + U] View a web page's source code -[CTRL + H] Open browser history -[CTRL + J] Display the file downloader -[CTRL + W] Exit browser -[CTRL + ENTER] Submit a web search -[CTRL + LEFT] Back a page. -[CTRL + RIGHT] Forward a page. -[F6] Moves a text cursor to the omnibox - - - - \ No newline at end of file +[CTRL + N or CTRL + T] New window +[CTRL + R or F5] Refresh the current page +[CTRL + O] Start OpenDialog to open local file +[CTRL + U] View a web page's source code +[CTRL + H] Open browser history +[CTRL + J] Display the file downloader +[CTRL + W] Exit browser +[CTRL + ENTER] Submit a web search +[CTRL + LEFT] Back a page. +[CTRL + RIGHT] Forward a page. +[F6] Moves a text cursor to the omnibox diff --git a/programs/cmm/browser/res/help_ru.htm b/programs/cmm/browser/res/help_ru.htm index 1e10fcb4af..e17e3c346d 100644 --- a/programs/cmm/browser/res/help_ru.htm +++ b/programs/cmm/browser/res/help_ru.htm @@ -7,18 +7,14 @@ Клавиши быстрого вызова -[CTRL + N или CTRL + T] Новое окно -[CTRL + R или F5] Перезагрузить страницу -[CTRL + O] Вызвать диалог выбора файла -[CTRL + U] Смотреть исходный код страницы -[CTRL + H] Смотреть историю посещенных страниц -[CTRL + J] Открыть загрузчик файлов -[CTRL + W] Закрыть браузер -[CTRL + ENTER] Поиск в интернете с помощью Google -[CTRL + ВЛЕВО] Аналогично кнопке "Назад" в браузере -[CTRL + ВПРАВО] Аналогично кнопке "Вперед" -[F6] Перемещает текстовый курсор в омнибокс - - - - \ No newline at end of file +[CTRL + N или CTRL + T] Новое окно +[CTRL + R или F5] Перезагрузить страницу +[CTRL + O] Вызвать диалог выбора файла +[CTRL + U] Смотреть исходный код страницы +[CTRL + H] Смотреть историю посещенных страниц +[CTRL + J] Открыть загрузчик файлов +[CTRL + W] Закрыть браузер +[CTRL + ENTER] Поиск в интернете с помощью Google +[CTRL + ВЛЕВО] Аналогично кнопке "Назад" в браузере +[CTRL + ВПРАВО] Аналогично кнопке "Вперед" +[F6] Перемещает текстовый курсор в омнибокс diff --git a/programs/cmm/browser/res/homepage_en.htm b/programs/cmm/browser/res/homepage_en.htm index c18a41e21a..10570f2255 100644 --- a/programs/cmm/browser/res/homepage_en.htm +++ b/programs/cmm/browser/res/homepage_en.htm @@ -4,18 +4,13 @@ Homepage
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.
 
-
-
-
- - \ No newline at end of file diff --git a/programs/cmm/browser/res/homepage_ru.htm b/programs/cmm/browser/res/homepage_ru.htm index 7237c5366e..f43364dc26 100644 --- a/programs/cmm/browser/res/homepage_ru.htm +++ b/programs/cmm/browser/res/homepage_ru.htm @@ -4,17 +4,13 @@ Домашняя страница
Закладки:
-1. Домашняя страница KolibriOS
-2. KolibriN10
+1. Домашняя страница KolibriOS
+2. KolibriN10
 3. Kolibri Store
 
 Кстати, 
 • Из главного меню можно проверить наличие обновлений
 • Для поиска в Google наберите тест в адресной строке и нажмите Ctrl+Enter
-• Есть также другие Горячие клавиши.
+• Есть также другие Горячие клавиши.
 • Можно изменить кодировку страницы, для этого нажмите на надпись в правом нижнем углу окна.
 
-
-
- - \ No newline at end of file diff --git a/programs/cmm/browser/res/test.htm b/programs/cmm/browser/res/test.htm index 28abcc53de..12fff5693b 100644 --- a/programs/cmm/browser/res/test.htm +++ b/programs/cmm/browser/res/test.htm @@ -2,26 +2,26 @@ WebView Test Page
-KolibriOS 
-KolibriN10
-Kolibri Store
+KolibriOS 
+KolibriN10
+Kolibri Store
 
-os-menuet.narod.ru
+os-menuet.narod.ru
 coolthemes.narod.ru
-fdd5-25.net
-dgmag.in
-http://baravy.by/me/b.html
+fdd5-25.net
+mestack.narod.ru
+dgmag.in
+http://baravy.by/me/b.html
 
-artcon.ru
-acmp.ru
-cnn 1996
-vetusware.com
-old-dos.ru
-nubo.ru
-samlib.ru/b
+artcon.ru
+acmp.ru
+cnn 1996
+vetusware.com
+old-dos.ru
+nubo.ru
+samlib.ru/b
 
-UmVirt Conis
-LOR
-opennet
-bash.im
-Leotag X/O
\ No newline at end of file
+UmVirt Conis
+LOR
+opennet
+bash.im 
\ No newline at end of file