WebView 3.30: just fixes

git-svn-id: svn://kolibrios.org@8499 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-12-31 02:03:58 +00:00
parent 14e3174c8c
commit 941fdfeadc
11 changed files with 94 additions and 96 deletions

View File

@ -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()

View File

@ -54,14 +54,15 @@ void TWebBrowser::RenderLine()
}
draw_x += pw;
if (debug_mode) debugln(#linebuf);
}
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);
if (break_pos) {
strlcpy(#next_line, #linebuf + break_pos, sizeof(next_line));
linebuf[break_pos] = 0x00;
RenderLine();
strcpy(#linebuf, #next_line);
strlcpy(#linebuf, #next_line, sizeof(TWebBrowser.linebuf));
NewLine();
} else {
NewLine();
RenderLine();
}
}
RenderLine();
}

View File

@ -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();

View File

@ -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", " ",

View File

@ -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)

View File

@ -107,4 +107,4 @@ char editbox_icons[] = FROM "res/editbox_icons.raw";
#define DEFAULT_URL URL_SERVICE_HOMEPAGE
char version[]="WebView 3.29";
char version[]="WebView 3.30";

View File

@ -1,9 +1,4 @@
<html>
<head>
<meta charset="uft">
<title>WebView Help</title>
</head>
<body>
<html><head><title>WebView Help</title></head><body>
<h1>WebView Text-Based Browser</h1>
@ -11,18 +6,14 @@ It is free and open-source. If you have any suggestions or want to help improvin
<b>Shortcut keys</b>
<font bg="#C7CEE4">[CTRL + N or CTRL + T]</font> New window
<font bg="#C7CEE4">[CTRL + R or F5]</font> Refresh the current page
<font bg="#C7CEE4">[CTRL + O]</font> Start OpenDialog to open local file
<font bg="#C7CEE4">[CTRL + U]</font> View a web page's source code
<font bg="#C7CEE4">[CTRL + H]</font> Open browser history
<font bg="#C7CEE4">[CTRL + J]</font> Display the file downloader
<font bg="#C7CEE4">[CTRL + W]</font> Exit browser
<font bg="#C7CEE4">[CTRL + ENTER]</font> Submit a web search
<font bg="#C7CEE4">[CTRL + LEFT]</font> Back a page.
<font bg="#C7CEE4">[CTRL + RIGHT]</font> Forward a page.
<font bg="#C7CEE4">[F6]</font> Moves a text cursor to the omnibox
</pre>
</body>
</html>
<font bg=C7CEE4>[CTRL + N or CTRL + T]</font> New window
<font bg=C7CEE4>[CTRL + R or F5]</font> Refresh the current page
<font bg=C7CEE4>[CTRL + O]</font> Start OpenDialog to open local file
<font bg=C7CEE4>[CTRL + U]</font> View a web page's source code
<font bg=C7CEE4>[CTRL + H]</font> Open browser history
<font bg=C7CEE4>[CTRL + J]</font> Display the file downloader
<font bg=C7CEE4>[CTRL + W]</font> Exit browser
<font bg=C7CEE4>[CTRL + ENTER]</font> Submit a web search
<font bg=C7CEE4>[CTRL + LEFT]</font> Back a page.
<font bg=C7CEE4>[CTRL + RIGHT]</font> Forward a page.
<font bg=C7CEE4>[F6]</font> Moves a text cursor to the omnibox

View File

@ -7,18 +7,14 @@
<b>┼╚═╒╗Х╗ ║КАБЮ╝ё╝ ╒К╖╝╒═</b>
<font bg="#C7CEE4">[CTRL + N ¨«¨ CTRL + T]</font> <20>®¢®¥ ®ª­®
<font bg="#C7CEE4">[CTRL + R ¨«¨ F5]</font> <20>¥à¥§ £à㧨âì áâà ­¨æã
<font bg="#C7CEE4">[CTRL + O]</font> ‚맢 âì ¤¨ «®£ ¢ë¡®à  ä ©« 
<font bg="#C7CEE4">[CTRL + U]</font> ‘¬®âà¥âì ¨á室­ë© ª®¤ áâà ­¨æë
<font bg="#C7CEE4">[CTRL + H]</font> ‘¬®âà¥âì ¨áâ®à¨î ¯®á¥é¥­­ëå áâà ­¨æ
<font bg="#C7CEE4">[CTRL + J]</font> Žâªàëâì § £àã§ç¨ª ä ©«®¢
<font bg="#C7CEE4">[CTRL + W]</font> ‡ ªàëâì ¡à ã§¥à
<font bg="#C7CEE4">[CTRL + ENTER]</font> <20>®¨áª ¢ ¨­â¥à­¥â¥ á ¯®¬®éìî Google
<font bg="#C7CEE4">[CTRL + ‚‹…‚Ž]</font> €­ «®£¨ç­® ª­®¯ª¥ "<22> § ¤" ¢ ¡à ã§¥à¥
<font bg="#C7CEE4">[CTRL + <><E2809A>Ž]</font> €­ «®£¨ç­® ª­®¯ª¥ "‚¯¥à¥¤"
<font bg="#C7CEE4">[F6]</font> <20>¥à¥¬¥é ¥â ⥪áâ®¢ë© ªãàá®à ¢ ®¬­¨¡®ªá
</pre>
</body>
</html>
<font bg=C7CEE4>[CTRL + N ¨«¨ CTRL + T]</font> <20>®¢®¥ ®ª­®
<font bg=C7CEE4>[CTRL + R ¨«¨ F5]</font> <20>¥à¥§ £à㧨âì áâà ­¨æã
<font bg=C7CEE4>[CTRL + O]</font> ‚맢 âì ¤¨ «®£ ¢ë¡®à  ä ©« 
<font bg=C7CEE4>[CTRL + U]</font> ‘¬®âà¥âì ¨á室­ë© ª®¤ áâà ­¨æë
<font bg=C7CEE4>[CTRL + H]</font> ‘¬®âà¥âì ¨áâ®à¨î ¯®á¥é¥­­ëå áâà ­¨æ
<font bg=C7CEE4>[CTRL + J]</font> Žâªàëâì § £àã§ç¨ª ä ©«®¢
<font bg=C7CEE4>[CTRL + W]</font> ‡ ªàëâì ¡à ã§¥à
<font bg=C7CEE4>[CTRL + ENTER]</font> <20>®¨áª ¢ ¨­â¥à­¥â¥ á ¯®¬®éìî Google
<font bg=C7CEE4>[CTRL + ‚‹…‚Ž]</font> €­ «®£¨ç­® ª­®¯ª¥ "<22> § ¤" ¢ ¡à ã§¥à¥
<font bg=C7CEE4>[CTRL + <><E2809A>Ž]</font> €­ «®£¨ç­® ª­®¯ª¥ "‚¯¥à¥¤"
<font bg=C7CEE4>[F6]</font> <20>¥à¥¬¥é ¥â ⥪áâ®¢ë© ªãàá®à ¢ ®¬­¨¡®ªá

View File

@ -4,18 +4,13 @@
<title>Homepage</title>
</head>
<body><pre>Bookmarks:
1. <a href="http://kolibrios.org" id="valera">KolibriOS homepage</a>
2. <a href="http://kolibri-n.org" id="hodor">KolibriN homepage</a>
1. <a href=http://kolibrios.org>KolibriOS homepage</a>
2. <a href=http://kolibri-n.org>KolibriN homepage</a>
3. <a href="http://store.kolibri-n.org">Kolibri Stuff</a>
<font bg=#F8F15B>By the way,</font>
<font color="#555555">&bull; You can check for browser updates from the main menu.
&bull; To run a web search, type a text in the adress box and press Ctrl+Enter.
&bull; You can also use other <a href="WebView:help"><font color="#555555">Hotkeys</font></a>.
&bull; You can also use other <a href=WebView:help><font color=555555>Hotkeys</font></a>.
&bull; Click on a label in the bottom right corner to change the encoding of a page.
</font>
</pre>
</body>
</html>

View File

@ -4,17 +4,13 @@
<title>„®¬ è­ïï áâà ­¨æ </title>
</head>
<body><pre>‡ ª« ¤ª¨:
1. <a href="http://kolibrios.org">„®¬ è­ïï áâà ­¨æ  KolibriOS</a>
2. <a href="http://kolibri-n.org">KolibriN10</a>
1. <a href=http://kolibrios.org>„®¬ è­ïï áâà ­¨æ  KolibriOS</a>
2. <a href=http://kolibri-n.org>KolibriN10</a>
3. <a href="http://store.kolibri-n.org">Kolibri Store</a>
<font bg=#F8F15B>Šáâ â¨,</font>
<font color="#555555">&bull; ˆ§ £« ¢­®£® ¬¥­î ¬®¦­® ¯à®¢¥à¨âì ­ «¨ç¨¥ ®¡­®¢«¥­¨©
&bull; „«ï ¯®¨áª  ¢ Google ­ ¡¥à¨â¥ â¥áâ ¢  ¤à¥á­®© áâப¥ ¨ ­ ¦¬¨â¥ Ctrl+Enter
&bull; …áâì â ª¦¥ ¤à㣨¥ <a href="WebView:help"><font color="#555555">ƒ®àï稥 ª« ¢¨è¨</font></a>.
&bull; …áâì â ª¦¥ ¤à㣨¥ <a href=WebView:help><font color=555555>ƒ®àï稥 ª« ¢¨è¨</font></a>.
&bull; Œ®¦­® ¨§¬¥­¨âì ª®¤¨à®¢ªã áâà ­¨æë, ¤«ï í⮣® ­ ¦¬¨â¥ ­  ­ ¤¯¨áì ¢ ¯à ¢®¬ ­¨¦­¥¬ 㣫㠮ª­ .
</font>
</pre>
</body>
</html>

View File

@ -2,26 +2,26 @@
<head><title>WebView Test Page</title></head>
<body>
<pre>
<a href="http://kolibrios.org">KolibriOS</a>
<a href="http://kolibri-n.org">KolibriN10</a>
<a href="http://store.kolibri-n.org">Kolibri Store</a>
<a href=http://kolibrios.org>KolibriOS</a>
<a href=http://kolibri-n.org>KolibriN10</a>
<a href=http://store.kolibri-n.org>Kolibri Store</a>
<a href=http://os-menuet.narod.ru/>os-menuet.narod.ru</a>
<a href=http://os-menuet.narod.ru>os-menuet.narod.ru</a>
<a href=http://coolthemes.narod.ru/indexold.html>coolthemes.narod.ru</a>
<a href="http://www.fdd5-25.net/index.htm">fdd5-25.net</a>
<a href="http://dgmag.in">dgmag.in</a>
<a href="http://baravy.by/me/b.html">http://baravy.by/me/b.html</a>
<a href=http://www.fdd5-25.net/index.htm>fdd5-25.net</a>
<a href=http://www.mestack.narod.ru/index.html>mestack.narod.ru</a>
<a href=http://dgmag.in>dgmag.in</a>
<a href=http://baravy.by/me/b.html>http://baravy.by/me/b.html</a>
<a href="http://www.artcon.ru">artcon.ru</a>
<a href="https://acmp.ru/index.asp?main=tasks">acmp.ru</a>
<a href="http://edition.cnn.com/EVENTS/1996/year.in.review/">cnn 1996</a>
<a href="https://vetusware.com/">vetusware.com</a>
<a href="http://old-dos.ru/">old-dos.ru</a>
<a href="http://nubo.ru">nubo.ru</a>
<a href="http://samlib.ru/b/">samlib.ru/b</a>
<a href=http://www.artcon.ru>artcon.ru</a>
<a href=https://acmp.ru/index.asp?main=tasks>acmp.ru</a>
<a href=http://edition.cnn.com/EVENTS/1996/year.in.review>cnn 1996</a>
<a href=https://vetusware.com>vetusware.com</a>
<a href=http://old-dos.ru>old-dos.ru</a>
<a href=http://nubo.ru>nubo.ru</a>
<a href=http://samlib.ru/b>samlib.ru/b</a>
<a href="http://umvirt.com/coins/">UmVirt Conis</a>
<a href="http://linux.org.ru">LOR</a>
<a href="http://opennet.ru">opennet</a>
<a href="https://bash.im">bash.im</a>
<a href="https://leotag.com/game/">Leotag X/O</a>
<a href=http://umvirt.com/coins>UmVirt Conis</a>
<a href=http://linux.org.ru>LOR</a>
<a href=http://opennet.ru>opennet</a>
<a href=https://bash.im>bash.im</a>