HTMLv: fixed problem with very long lines w/o spaces

git-svn-id: svn://kolibrios.org@3059 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2012-11-18 23:43:03 +00:00
parent 29de2e5854
commit 66f8ed5fc2
3 changed files with 13 additions and 8 deletions

View File

@ -99,7 +99,8 @@ void main()
if (load_dll2(libtruetype, #truetype,0)!=0) {debug("Íå óäàëîñü ïîäêëþ÷èòü áèáëèîòåêó TrueType"w); use_truetype = 2; } if (load_dll2(libtruetype, #truetype,0)!=0) {debug("Íå óäàëîñü ïîäêëþ÷èòü áèáëèîòåêó TrueType"w); use_truetype = 2; }
else init_font(#fontlol); else init_font(#fontlol);
if (!URL) strcpy(#URL, "/sys/home.htm"); // if (!URL) strcpy(#URL, "/sys/home.htm");
if (!URL) strcpy(#URL, "/sys/ololo.txt");
strcpy(#editURL, #URL); strcpy(#editURL, #URL);
Form.width=WIN_W; Form.width=WIN_W;

View File

@ -377,7 +377,6 @@ void TWebBrowser::ParseHTML(dword bword){
break; break;
} }
case 0x0d: case 0x0d:
debug("0x0d");
bukva = ' '; bukva = ' ';
goto DEFAULT_MARK; goto DEFAULT_MARK;
case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7 case '=': //ïîääåðæêà øàéòàíñêîé êîäèðîâêè ñòðàíèö, ñîõðàí¸ííûõ ÷åðåç ÈÅ7
@ -473,24 +472,29 @@ void TWebBrowser::ParseHTML(dword bword){
break; break;
default: default:
DEFAULT_MARK: DEFAULT_MARK:
if (!pre_text) && (bukva == ' ') && (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä if (!pre_text) && (bukva == ' ')
// {
if (line[strlen(#line)-1]==' ') break; //óáðàòü 2 ïðîáåëà ïîäðÿä
if (!stolbec) && (!line) break; //ñòðîêà íå ìîæåò íà÷èíàòüñÿ ñ ïðîáåëà
}
if (strlen(#line)<sizeof(line)) strcat(#line, #bukva);
if (stolbec + strlen(#line) > lines.column_max) if (stolbec + strlen(#line) > lines.column_max)
{ {
NEXT_MARK:
perenos_num = strrchr(#line, ' '); perenos_num = strrchr(#line, ' ');
if (!perenos_num) && (strlen(#line)>lines.column_max) perenos_num=lines.column_max;
strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì strcpy(#temp, #line + perenos_num); //ïåðåíîñ ïî ñëîâàì
line[perenos_num] = 0x00; line[perenos_num] = 0x00;
NEXT_MARK:
if (stroka >= lines.visible) && (lines.first <>0) break 1; //óõîäèì... if (stroka >= lines.visible) && (lines.first <>0) break 1; //óõîäèì...
DrawPage(); DrawPage();
TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó TextGoDown(left + 5, stroka * 10 + top + 5, width - 20); //çàêðàøèâàåì ñëåäóùóþ ñòðîêó
strcpy(#line, #temp); strcpy(#line, #temp);
} }
if (!pre_text) && (bukva == ' ') && (!stolbec) && (!line) break;
if (strlen(#line)<sizeof(line)) strcat(#line, #bukva);
} }
} }
DrawPage(); //ðèñóåò ïîñëåäíþþ ñòðîêó, ïîòîì ýòî íàäî óáðàòü, îïòèìèçèðîâàâ êîä
if (lines.visible * 10 + 25 <= height) if (lines.visible * 10 + 25 <= height)
DrawBar(left, lines.visible * 10 + top + 25, width - 15, -lines.visible * 10 + height - 25, bg_color); DrawBar(left, lines.visible * 10 + top + 25, width - 15, -lines.visible * 10 + height - 25, bg_color);
if (stroka * 10 + 15 <= height) if (stroka * 10 + 15 <= height)

View File

@ -1,4 +1,4 @@
..\C--\c-- HTMLv.c ..\C--\c-- HTMLv.c /lst
del HTMLv del HTMLv
rename HTMLv.com HTMLv rename HTMLv.com HTMLv
rem ..\C--\kpack HTMLv rem ..\C--\kpack HTMLv