ZealOS/docs/System/DolDoc/DocRecalc.CC.html
2021-12-04 05:03:02 -05:00

1572 lines
166 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.06">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>help_index</span><span class=cF0> </span><span class=cF6>&quot;DolDoc&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocWordWrapDel</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, </span><span class=cF1>Bool</span><span class=cF0> full_refresh, </span><span class=cF1>Bool</span><span class=cF0> same_win, </span><span class=cF9>I64</span><span class=cF0> left_margin, </span><span class=cF9>I64</span><span class=cF0> right_margin,
<a name="l4"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> **_best_doc_e, </span><span class=cF9>I64</span><span class=cF0> *_best_col)
<a name="l5"></a>{
<a name="l6"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e2;
<a name="l7"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l8"></a> </span><span class=cF9>I64</span><span class=cF0> j, k;
<a name="l9"></a>
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_e-&gt;tag)
<a name="l11"></a> k = </span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l12"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l13"></a> k = </span><span class=cFE>0</span><span class=cF0>;
<a name="l14"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l15"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l16"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l17"></a> doc_e2 = doc_e-&gt;next;
<a name="l18"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;type_u8 == </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0> &amp;&amp; !same_win)
<a name="l19"></a> {
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry == doc_e2)
<a name="l21"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l22"></a> doc-&gt;cur_entry = doc_e2-&gt;next;
<a name="l23"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l24"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l25"></a> </span><span class=cF1>if</span><span class=cF0> (*_best_doc_e == doc_e2)
<a name="l26"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l27"></a> *_best_doc_e = doc_e2-&gt;next;
<a name="l28"></a> *_best_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l29"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l30"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_e2);
<a name="l31"></a> }
<a name="l32"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_e</span><span class=cF7>)</span><span class=cF0> &amp;&amp; doc_e-&gt;de_flags == doc_e2-&gt;de_flags &amp;&amp; doc_e-&gt;type == doc_e2-&gt;type)
<a name="l33"></a> {
<a name="l34"></a> j = </span><span class=cF5>StrLen</span><span class=cF0>(doc_e2-&gt;tag);
<a name="l35"></a> ptr = </span><span class=cF5>MAlloc</span><span class=cF0>(k + j + </span><span class=cFE>1</span><span class=cF0>, doc-&gt;mem_task);
<a name="l36"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr, doc_e-&gt;tag, k);
<a name="l37"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(ptr + k, doc_e2-&gt;tag, j + </span><span class=cFE>1</span><span class=cF0>);
<a name="l38"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e-&gt;tag);
<a name="l39"></a> doc_e-&gt;tag = ptr;
<a name="l40"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry == doc_e2)
<a name="l41"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l42"></a> doc-&gt;cur_entry = doc_e;
<a name="l43"></a> doc-&gt;cur_col += k;
<a name="l44"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l45"></a> </span><span class=cF1>if</span><span class=cF0> (*_best_doc_e == doc_e2)
<a name="l46"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l47"></a> *_best_doc_e = doc_e;
<a name="l48"></a> *_best_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l49"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l50"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_e2);
<a name="l51"></a> k += j;
<a name="l52"></a> </span><span class=cF1>if</span><span class=cF0> (k &gt; </span><span class=cF7>(</span><span class=cF0>right_margin - left_margin + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> &lt;&lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l53"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l54"></a> }
<a name="l55"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l56"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l57"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l58"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_SCROLLING_X</span><span class=cF0>)
<a name="l59"></a> k = doc_e-&gt;scroll_len;
<a name="l60"></a>
<a name="l61"></a> </span><span class=cF1>return</span><span class=cF0> k;
<a name="l62"></a>}
<a name="l63"></a>
<a name="l64"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DocRecalcXY</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, </span><span class=cF9>I64</span><span class=cF0> k, </span><span class=cF9>I64</span><span class=cF0> left, </span><span class=cF9>I64</span><span class=cF0> width, </span><span class=cF9>I64</span><span class=cF0> height, </span><span class=cF9>I64</span><span class=cF0> left_margin, </span><span class=cF9>I64</span><span class=cF0> right_margin,
<a name="l65"></a> </span><span class=cF9>I64</span><span class=cF0> x0, </span><span class=cF9>I64</span><span class=cF0> y0, </span><span class=cF9>I64</span><span class=cF0> *_x, </span><span class=cF9>I64</span><span class=cF0> *_y)
<a name="l66"></a>{
<a name="l67"></a> </span><span class=cF9>I64</span><span class=cF0> i, x = *_x, y = *_y;
<a name="l68"></a>
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_MARGIN_REL_X</span><span class=cF0>)
<a name="l70"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_X</span><span class=cF0>)
<a name="l72"></a> x = left_margin - left;
<a name="l73"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_RIGHT_X</span><span class=cF0>)
<a name="l74"></a> x = right_margin - (k - </span><span class=cFE>1</span><span class=cF0>) - left;
<a name="l75"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CENTER_X</span><span class=cF0>)
<a name="l76"></a> x = (right_margin + left_margin) &gt;&gt; </span><span class=cFE>1</span><span class=cF0> - k &gt;&gt; </span><span class=cFE>1</span><span class=cF0> - left;
<a name="l77"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l78"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l79"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_X</span><span class=cF0>)
<a name="l81"></a> x = x0;
<a name="l82"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_RIGHT_X</span><span class=cF0>)
<a name="l83"></a> x = width + x0 - k;
<a name="l84"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CENTER_X</span><span class=cF0>)
<a name="l85"></a> x = (width + x0 - k) &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l87"></a> i = y;
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_PAGE_REL_Y</span><span class=cF0>)
<a name="l89"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l90"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_BWD_MOVEMENT</span><span class=cF0>;
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TOP_Y</span><span class=cF0>)
<a name="l92"></a> y -= doc_e-&gt;page_line_num;
<a name="l93"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BOTTOM_Y</span><span class=cF0>)
<a name="l94"></a> y += doc_e-&gt;settings.page_len - doc_e-&gt;page_line_num;
<a name="l95"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CENTER_Y</span><span class=cF0>)
<a name="l96"></a> y += doc_e-&gt;settings.page_len &gt;&gt; </span><span class=cFE>1</span><span class=cF0> - doc_e-&gt;page_line_num;
<a name="l97"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l98"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l99"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l100"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_BWD_MOVEMENT</span><span class=cF0>;
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TOP_Y</span><span class=cF0>)
<a name="l102"></a> y = y0;
<a name="l103"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BOTTOM_Y</span><span class=cF0>)
<a name="l104"></a> y = height - </span><span class=cFE>1</span><span class=cF0> + y0;
<a name="l105"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CENTER_Y</span><span class=cF0>)
<a name="l106"></a> y = height &gt;&gt; </span><span class=cFE>1</span><span class=cF0> + y0;
<a name="l107"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l108"></a> </span><span class=cF1>if</span><span class=cF0> (y != i)
<a name="l109"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l110"></a> doc-&gt;page_line_num += y - i;
<a name="l111"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l112"></a> doc-&gt;page_line_num = doc_e-&gt;settings.page_len + doc-&gt;page_line_num % doc_e-&gt;settings.page_len;
<a name="l113"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l114"></a> doc-&gt;page_line_num = doc-&gt;page_line_num % doc_e-&gt;settings.page_len;
<a name="l115"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;settings.header != </span><span class=cF3>DOC_DEFAULT</span><span class=cF0> &amp;&amp; doc-&gt;page_line_num &lt; doc_e-&gt;settings.header)
<a name="l116"></a> {
<a name="l117"></a> y += doc_e-&gt;settings.header - doc-&gt;page_line_num;
<a name="l118"></a> doc-&gt;page_line_num = doc_e-&gt;settings.header;
<a name="l119"></a> }
<a name="l120"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;settings.footer == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l121"></a> {
<a name="l122"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &gt;= doc_e-&gt;settings.page_len)
<a name="l123"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;settings.header == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l125"></a> doc-&gt;page_line_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l126"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l127"></a> {
<a name="l128"></a> doc-&gt;page_line_num = doc_e-&gt;settings.header;
<a name="l129"></a> y += doc_e-&gt;settings.header;
<a name="l130"></a> }
<a name="l131"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l132"></a> }
<a name="l133"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l134"></a> {
<a name="l135"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &gt;= doc_e-&gt;settings.page_len - doc_e-&gt;settings.footer)
<a name="l136"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l137"></a> y += doc_e-&gt;settings.footer;
<a name="l138"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;settings.header == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l139"></a> doc-&gt;page_line_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l140"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l141"></a> {
<a name="l142"></a> doc-&gt;page_line_num = doc_e-&gt;settings.header;
<a name="l143"></a> y += doc_e-&gt;settings.header;
<a name="l144"></a> }
<a name="l145"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l146"></a> }
<a name="l147"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l148"></a> *_x = x;
<a name="l149"></a> *_y = y;
<a name="l150"></a>}
<a name="l151"></a>
<a name="l152"></a></span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF5>DocSplitTag</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, </span><span class=cF9>I64</span><span class=cF0> i, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y, </span><span class=cF9>I64</span><span class=cF0> type_u8)
<a name="l153"></a>{</span><span class=cF2>//Split tag at i, insert DOCT_SOFT_NEW_LINE, DOCT_MARKER or DOCT_CURSOR</span><span class=cF0>
<a name="l154"></a> </span><span class=cF1>U8</span><span class=cF0> *ptr;
<a name="l155"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e2;
<a name="l156"></a>
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp; i)
<a name="l158"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l159"></a> </span><span class=cF1>if</span><span class=cF0> (i &lt; </span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;tag</span><span class=cF7>)</span><span class=cF0>)
<a name="l160"></a> {
<a name="l161"></a> doc_e2 = </span><span class=cF5>MAllocIdent</span><span class=cF0>(doc_e, doc-&gt;mem_task);
<a name="l162"></a> doc_e2-&gt;tag = </span><span class=cF5>StrNew</span><span class=cF0>(doc_e-&gt;tag + i, doc-&gt;mem_task);
<a name="l163"></a> doc_e2-&gt;de_flags = doc_e-&gt;de_flags &amp; ~</span><span class=cF3>DOCEG_HAS_ALLOC</span><span class=cF0> | </span><span class=cF3>DOCEF_TAG</span><span class=cF0>;
<a name="l164"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_e2, doc_e);
<a name="l165"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry == doc_e &amp;&amp; doc-&gt;cur_col&gt;=i)
<a name="l166"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l167"></a> doc-&gt;cur_entry = doc_e2;
<a name="l168"></a> doc-&gt;cur_col = doc-&gt;cur_col - i;
<a name="l169"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l170"></a> doc_e-&gt;tag[i] = </span><span class=cFE>0</span><span class=cF0>;
<a name="l171"></a> ptr = </span><span class=cF5>StrNew</span><span class=cF0>(doc_e-&gt;tag, doc-&gt;mem_task);
<a name="l172"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e-&gt;tag);
<a name="l173"></a> doc_e-&gt;tag = ptr;
<a name="l174"></a> }
<a name="l175"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l176"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l177"></a> doc_e = doc_e-&gt;last;
<a name="l178"></a> doc_e2 = </span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc, type_u8 | doc_e-&gt;type &amp; </span><span class=cFE>0xFFFFFF00</span><span class=cF0>, doc_e-&gt;de_flags &amp; ~</span><span class=cF3>DOCEG_HAS_ARG</span><span class=cF0>,
<a name="l179"></a> x, y, doc_e-&gt;page_line_num);
<a name="l180"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;doc_e2-&gt;settings, &amp;doc_e-&gt;settings, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
<a name="l181"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_e2, doc_e);
<a name="l182"></a>
<a name="l183"></a> </span><span class=cF1>return</span><span class=cF0> doc_e2;
<a name="l184"></a>}
<a name="l185"></a>
<a name="l186"></a></span><span class=cF9>CDocEntry</span><span class=cF0> *</span><span class=cF5>DocWordWrapAdd</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, </span><span class=cF9>I64</span><span class=cF0> *_k, </span><span class=cF9>I64</span><span class=cF0> left, </span><span class=cF9>I64</span><span class=cF0> right_margin, </span><span class=cF9>I64</span><span class=cF0> x, </span><span class=cF9>I64</span><span class=cF0> y)
<a name="l187"></a>{
<a name="l188"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e2;
<a name="l189"></a> </span><span class=cF9>I64</span><span class=cF0> j,
<a name="l190"></a> i = right_margin + </span><span class=cFE>1</span><span class=cF0> - (x + left), </span><span class=cF2>//Space left on line</span><span class=cF0>
<a name="l191"></a> ii = x + </span><span class=cFE>1</span><span class=cF0> - doc_e-&gt;settings.left_margin;
<a name="l192"></a>
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_e</span><span class=cF7>)</span><span class=cF0>)
<a name="l194"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry == doc_e-&gt;next)
<a name="l196"></a> {
<a name="l197"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col == doc_e-&gt;next-&gt;min_col)
<a name="l198"></a> i--;
<a name="l199"></a> }
<a name="l200"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l201"></a> {
<a name="l202"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry == doc_e &amp;&amp; doc-&gt;cur_col == i)
<a name="l203"></a> i--;
<a name="l204"></a> }
<a name="l205"></a> </span><span class=cF1>if</span><span class=cF0> (*_k &gt; i)
<a name="l206"></a> {
<a name="l207"></a> </span><span class=cF1>for</span><span class=cF0> (j = i; j &gt; </span><span class=cFE>8</span><span class=cF0> - ii &amp;&amp; j &gt;= </span><span class=cFE>0</span><span class=cF0>; j--)
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;tag[j] == </span><span class=cF3>CH_SPACE</span><span class=cF0>)
<a name="l209"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l210"></a> i = j + </span><span class=cFE>1</span><span class=cF0>;
<a name="l211"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l212"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt; i &lt; *_k)
<a name="l214"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l215"></a> </span><span class=cF5>DocSplitTag</span><span class=cF0>(doc, doc_e, i, x, y, </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0>);
<a name="l216"></a> *_k = </span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l217"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l218"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l219"></a> }
<a name="l220"></a> </span><span class=cF1>if</span><span class=cF0> (*_k == i)
<a name="l221"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l222"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l223"></a> </span><span class=cF1>if</span><span class=cF0> (*_k &gt;= i)
<a name="l224"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l225"></a> doc_e2 = doc_e-&gt;last;
<a name="l226"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;type_u8 != </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0> &amp;&amp;
<a name="l227"></a> doc_e2-&gt;type_u8 != </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> &amp;&amp;
<a name="l228"></a> doc_e2-&gt;type_u8 != </span><span class=cF3>DOCT_CURSOR_MOVEMENT</span><span class=cF0>)
<a name="l229"></a> {
<a name="l230"></a> doc_e2 = </span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc, </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0> | doc_e-&gt;type &amp; </span><span class=cFE>0xFFFFFF00</span><span class=cF0>,
<a name="l231"></a> </span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0> | doc_e-&gt;de_flags &amp; </span><span class=cF7>(</span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0> | </span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0> | </span><span class=cF3>DOCEF_SKIP</span><span class=cF0> | </span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF7>)</span><span class=cF0>,
<a name="l232"></a> x, y, doc_e-&gt;last-&gt;page_line_num);
<a name="l233"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;doc_e2-&gt;settings, &amp;doc_e-&gt;settings, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
<a name="l234"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_e2, doc_e-&gt;last);
<a name="l235"></a> </span><span class=cF1>return</span><span class=cF0> doc_e2;
<a name="l236"></a> }
<a name="l237"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l238"></a>
<a name="l239"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l240"></a>}
<a name="l241"></a>
<a name="l242"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>DocTmpAttr</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e, </span><span class=cF9>I64</span><span class=cF0> cur_u8_attr)
<a name="l243"></a>{
<a name="l244"></a> </span><span class=cF9>I64</span><span class=cF0> tmp_u32_attr;
<a name="l245"></a>
<a name="l246"></a> doc_e-&gt;de_flags = doc-&gt;flags &amp; (</span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0> | </span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0> | </span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0>) |
<a name="l247"></a> doc_e-&gt;de_flags &amp; ~(</span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0> | </span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0> | </span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0>);
<a name="l248"></a>
<a name="l249"></a> tmp_u32_attr = (cur_u8_attr &amp; </span><span class=cFE>0xF0</span><span class=cF0>) &lt;&lt; </span><span class=cFE>8</span><span class=cF0> |
<a name="l250"></a> doc-&gt;flags &amp; </span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0> |
<a name="l251"></a> (doc_e-&gt;settings.shifted_x &amp; </span><span class=cFE>0x1F</span><span class=cF0>) &lt;&lt; </span><span class=cFE>16</span><span class=cF0> |
<a name="l252"></a> (doc_e-&gt;settings.shifted_y &amp; </span><span class=cFE>0x1F</span><span class=cF0>) &lt;&lt; </span><span class=cFE>21</span><span class=cF0>;
<a name="l253"></a>
<a name="l254"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HAS_BIN</span><span class=cF0> &amp;&amp; *doc_e-&gt;tag == </span><span class=cF6>'&lt;'</span><span class=cF0>)
<a name="l255"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_BIN</span><span class=cF0>;
<a name="l256"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l257"></a> </span><span class=cF1>switch</span><span class=cF0> (doc_e-&gt;type_u8)
<a name="l258"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l259"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_SPRITE</span><span class=cF0>:
<a name="l260"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_EXP</span><span class=cF0>)
<a name="l261"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= cur_u8_attr &amp; </span><span class=cFE>15</span><span class=cF0>;
<a name="l262"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LINK</span><span class=cF0>)
<a name="l263"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_LINK</span><span class=cF0>;
<a name="l264"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_MACRO</span><span class=cF0>)
<a name="l265"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_MACRO</span><span class=cF0>;
<a name="l266"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF7>(</span><span class=cF3>DOCEF_TREE</span><span class=cF0> | </span><span class=cF3>DOCEF_LIST</span><span class=cF7>)</span><span class=cF0>)
<a name="l267"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_TREE</span><span class=cF0>;
<a name="l268"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l269"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_BIN</span><span class=cF0>;
<a name="l270"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l271"></a>
<a name="l272"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_HTML_CODE</span><span class=cF0>:
<a name="l273"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_BIN</span><span class=cF0>;
<a name="l274"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l275"></a>
<a name="l276"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_LINK</span><span class=cF0>:
<a name="l277"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_LINK</span><span class=cF0>;
<a name="l278"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l279"></a>
<a name="l280"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_MACRO</span><span class=cF0>:
<a name="l281"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_MACRO</span><span class=cF0>;
<a name="l282"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l283"></a>
<a name="l284"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_ANCHOR</span><span class=cF0>:
<a name="l285"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_ANCHOR</span><span class=cF0>;
<a name="l286"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l287"></a>
<a name="l288"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_TREE</span><span class=cF0>:
<a name="l289"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_LIST</span><span class=cF0>:
<a name="l290"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= </span><span class=cF3>DOC_COLOR_TREE</span><span class=cF0>;
<a name="l291"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l292"></a>
<a name="l293"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l294"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>] |= cur_u8_attr &amp; </span><span class=cFE>15</span><span class=cF0>;
<a name="l295"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l296"></a> doc_e-&gt;type.u8[</span><span class=cFE>1</span><span class=cF0>] = tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>];
<a name="l297"></a> tmp_u32_attr |= doc_e-&gt;type &amp; </span><span class=cFE>0xFFFF0000</span><span class=cF0>;
<a name="l298"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc-&gt;cur_entry &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc-&gt;flags &amp; </span><span class=cF3>DOCF_DONT_HIGHLIGHT_CURSOR</span><span class=cF7>)</span><span class=cF0> &amp;&amp; doc_e-&gt;type_u8 != </span><span class=cF3>DOCT_TEXT</span><span class=cF0>)
<a name="l299"></a> tmp_u32_attr ^= </span><span class=cFE>0xFF00</span><span class=cF0>;
<a name="l300"></a> doc_e-&gt;settings.final_u32_attr = tmp_u32_attr;
<a name="l301"></a>
<a name="l302"></a> </span><span class=cF1>return</span><span class=cF0> tmp_u32_attr;
<a name="l303"></a>}
<a name="l304"></a>
<a name="l305"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DocRecalc</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> recalc_flags=</span><span class=cF3>RECALCt_NORMAL</span><span class=cF0>)
<a name="l306"></a>{</span><span class=cF2>//Recalc and format. Also used by WinMgr to draw on screen.</span><span class=cF0>
<a name="l307"></a> </span><span class=cF9>I64</span><span class=cF0> i, ii, j, k, x, x0, y, y0, D, d2, col, col2, best_col = </span><span class=cFE>0</span><span class=cF0>, best_d = </span><span class=cF3>I64_MAX</span><span class=cF0>, xx, yy, zz,
<a name="l308"></a> num_entries = </span><span class=cFE>0</span><span class=cF0>, i_jif, cur_u8_attr, tmp_u32_attr,
<a name="l309"></a> cursor_y = </span><span class=cF3>I64_MIN</span><span class=cF0>, left_margin, right_margin, y_plot_top, y_plot_bottom,
<a name="l310"></a> top, left, bottom, right, width, height, scroll_x, scroll_y, pix_top, pix_left;
<a name="l311"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> </span><span class=cF1>reg</span><span class=cF0> *doc_e, </span><span class=cF1>reg</span><span class=cF0> *doc_e2, *best_doc_e, *next_clear_found = </span><span class=cF3>NULL</span><span class=cF0>, *added_cursor = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l312"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb;
<a name="l313"></a> </span><span class=cF9>CDocSettings</span><span class=cF0> *s;
<a name="l314"></a> </span><span class=cF1>Bool</span><span class=cF0> del_doc_e, skipped_update, tree_collapsed, same_win, more = </span><span class=cF3>FALSE</span><span class=cF0>,
<a name="l315"></a> find_cursor = </span><span class=cF3>FALSE</span><span class=cF0>, blink_flag, full_refresh = </span><span class=cF3>TRUE</span><span class=cF0>, unlock, clear_holds;
<a name="l316"></a> </span><span class=cF9>CTask</span><span class=cF0> *win_task, *mem_task;
<a name="l317"></a> </span><span class=cF9>CDC</span><span class=cF0> *dc;
<a name="l318"></a> </span><span class=cF1>U8</span><span class=cF0> *bptr, *ptr, buf[</span><span class=cF3>STR_LEN</span><span class=cF0>], ch;
<a name="l319"></a> </span><span class=cF9>U32</span><span class=cF0> *u32_ptr, *hl;
<a name="l320"></a> </span><span class=cF9>I32</span><span class=cF0> *depth_buf = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l321"></a> </span><span class=cF1>F64</span><span class=cF0> cur_time = </span><span class=cF5>tS</span><span class=cF0>;
<a name="l322"></a> </span><span class=cF9>CWinScroll</span><span class=cF0> *vss, *hss;
<a name="l323"></a> </span><span class=cF9>CHashDefineStr</span><span class=cF0> *tmph;
<a name="l324"></a>
<a name="l325"></a> </span><span class=cF1>if</span><span class=cF0> (!doc || doc-&gt;doc_signature != </span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
<a name="l326"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l327"></a>
<a name="l328"></a> </span><span class=cF2>//WinMgr updates all wins (60000.0 / 1001), 33.33333mS</span><span class=cF0>
<a name="l329"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; doc-&gt;owning_task != </span><span class=cF5>Fs</span><span class=cF0>)
<a name="l330"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l331"></a> i_jif = </span><span class=cFB>counts</span><span class=cF0>.jiffies + </span><span class=cF3>JIFFY_FREQ</span><span class=cF0> / </span><span class=cFE>250</span><span class=cF0>; </span><span class=cF2>//4 mouse</span><span class=cF0>
<a name="l332"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;doc-&gt;locked_flags, </span><span class=cF3>DOClf_LOCKED</span><span class=cF7>)</span><span class=cF0>)
<a name="l333"></a> {
<a name="l334"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>counts</span><span class=cF0>.jiffies &gt;= i_jif)
<a name="l335"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>; </span><span class=cF2>//Bail-out if doc locked.</span><span class=cF0>
<a name="l336"></a> </span><span class=cF5>Yield</span><span class=cF0>;
<a name="l337"></a> }
<a name="l338"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l339"></a>
<a name="l340"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l341"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;doc_signature != </span><span class=cF3>DOC_SIGNATURE_VAL</span><span class=cF0>)
<a name="l342"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l343"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l344"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l345"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l346"></a>
<a name="l347"></a> win_task = doc-&gt;win_task;
<a name="l348"></a> mem_task = doc-&gt;mem_task;
<a name="l349"></a> blink_flag = </span><span class=cF5>Blink</span><span class=cF0>;
<a name="l350"></a> dc = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l351"></a> </span><span class=cF1>switch</span><span class=cF0> [recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0>]
<a name="l352"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l353"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>RECALCt_FIND_CURSOR</span><span class=cF0>:
<a name="l354"></a> find_cursor = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l355"></a> </span><span class=cF1>if</span><span class=cF0> (win_task)
<a name="l356"></a> dc = </span><span class=cF5>DCAlias</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc2, win_task); </span><span class=cF2>//Necessary for sprites</span><span class=cF0>
<a name="l357"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l358"></a>
<a name="l359"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0>:
<a name="l360"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;updates_count++ % </span><span class=cF7>(</span><span class=cF5>ToI64</span><span class=cF0>(</span><span class=cFB>winmgr</span><span class=cF0>.fps / </span><span class=cFE>10</span><span class=cF0>) + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l361"></a> !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;doc-&gt;flags, </span><span class=cF3>DOCf_DO_FULL_REFRESH</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l362"></a> !</span><span class=cF7>(</span><span class=cF0>doc-&gt;flags &amp; </span><span class=cF3>DOCF_BWD_MOVEMENT</span><span class=cF7>)</span><span class=cF0>)
<a name="l363"></a> full_refresh = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l364"></a> </span><span class=cF1>if</span><span class=cF0> (win_task)
<a name="l365"></a> dc = </span><span class=cF5>DCAlias</span><span class=cF0>(</span><span class=cFB>gr</span><span class=cF0>.dc2, win_task);
<a name="l366"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l367"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l368"></a>
<a name="l369"></a> </span><span class=cF1>PUSHFD</span><span class=cF0>
<a name="l370"></a> </span><span class=cF1>CLI</span><span class=cF0>
<a name="l371"></a> left = win_task-&gt;win_left;
<a name="l372"></a> right = win_task-&gt;win_right;
<a name="l373"></a> width = win_task-&gt;win_width;
<a name="l374"></a> scroll_x = win_task-&gt;scroll_x;
<a name="l375"></a> scroll_y = win_task-&gt;scroll_y;
<a name="l376"></a> top = win_task-&gt;win_top;
<a name="l377"></a> bottom = win_task-&gt;win_bottom;
<a name="l378"></a> height = win_task-&gt;win_height;
<a name="l379"></a> pix_left = win_task-&gt;pix_left;
<a name="l380"></a> pix_top = win_task-&gt;pix_top;
<a name="l381"></a> left_margin = left;
<a name="l382"></a> right_margin = right;
<a name="l383"></a> </span><span class=cF1>POPFD</span><span class=cF0>
<a name="l384"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_BORDER_DOC</span><span class=cF0>)
<a name="l385"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l386"></a> scroll_x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l387"></a> scroll_y = </span><span class=cFE>0</span><span class=cF0>;
<a name="l388"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l389"></a> best_doc_e = doc-&gt;cur_entry;
<a name="l390"></a>
<a name="l391"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc-&gt;flags &amp; (</span><span class=cF3>DOCF_PLAIN_TEXT</span><span class=cF0> | </span><span class=cF3>DOCF_PLAIN_TEXT_TABS</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &amp;&amp; </span><span class=cF5>FilesFindMatch</span><span class=cF7>(</span><span class=cF0>doc-&gt;filename.name, </span><span class=cF3>FILEMASK_SRC</span><span class=cF7>)</span><span class=cF0>)
<a name="l392"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_HIGHLIGHT</span><span class=cF0>;
<a name="l393"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l394"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_HIGHLIGHT</span><span class=cF0>;
<a name="l395"></a>
<a name="l396"></a> x = y = </span><span class=cFE>0</span><span class=cF0>;
<a name="l397"></a> doc-&gt;page_line_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l398"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh &amp;&amp; !find_cursor)
<a name="l399"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l400"></a> doc-&gt;x = x;
<a name="l401"></a> doc-&gt;y = y;
<a name="l402"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l403"></a>
<a name="l404"></a> hss = &amp;win_task-&gt;horz_scroll;
<a name="l405"></a> vss = &amp;win_task-&gt;vert_scroll;
<a name="l406"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_BORDER_DOC</span><span class=cF0>)
<a name="l407"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l408"></a> doc-&gt;top_line_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l409"></a> doc-&gt;line_start_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l410"></a> recalc_flags &amp;= ~</span><span class=cF3>RECALCF_HAS_CURSOR</span><span class=cF0>;
<a name="l411"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0>)
<a name="l412"></a> doc-&gt;settings_head.cur_text_attr = doc-&gt;settings_head.default_text_attr = win_task-&gt;border_attr;
<a name="l413"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l414"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l415"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l416"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCF_HAS_CURSOR</span><span class=cF0> &amp;&amp; full_refresh)
<a name="l417"></a> {
<a name="l418"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;hss-&gt;flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF7>)</span><span class=cF0> || </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;vss-&gt;flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF7>)</span><span class=cF0>)
<a name="l419"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l420"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc-&gt;flags &amp; </span><span class=cF3>DOCF_NO_SCROLL_BARS</span><span class=cF7>)</span><span class=cF0>)
<a name="l421"></a> {
<a name="l422"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;hss-&gt;flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF7>)</span><span class=cF0>)
<a name="l423"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l424"></a> doc-&gt;line_start_col = hss-&gt;pos;
<a name="l425"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;hss-&gt;flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF0>);
<a name="l426"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l427"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;vss-&gt;flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF7>)</span><span class=cF0>)
<a name="l428"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l429"></a> doc-&gt;top_line_num = vss-&gt;pos;
<a name="l430"></a> </span><span class=cF5>LBtr</span><span class=cF0>(&amp;vss-&gt;flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF0>);
<a name="l431"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l432"></a> }
<a name="l433"></a> doc-&gt;x = doc-&gt;line_start_col + width / </span><span class=cFE>2</span><span class=cF0>;
<a name="l434"></a> doc-&gt;y = doc-&gt;top_line_num + height / </span><span class=cFE>2</span><span class=cF0>;
<a name="l435"></a> find_cursor = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l436"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l437"></a> }
<a name="l438"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0>)
<a name="l439"></a> doc-&gt;settings_head.cur_text_attr = doc-&gt;settings_head.default_text_attr = win_task-&gt;text_attr;
<a name="l440"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l441"></a> x0 = doc-&gt;line_start_col;
<a name="l442"></a> y0 = doc-&gt;top_line_num;
<a name="l443"></a> same_win = top == doc-&gt;old_win_top &amp;&amp;
<a name="l444"></a> bottom == doc-&gt;old_win_bottom &amp;&amp;
<a name="l445"></a> left == doc-&gt;old_win_left &amp;&amp;
<a name="l446"></a> right == doc-&gt;old_win_right &amp;&amp;
<a name="l447"></a> doc-&gt;cur_entry == doc-&gt;old_cur_entry &amp;&amp;
<a name="l448"></a> doc-&gt;cur_col == doc-&gt;old_cur_col;
<a name="l449"></a>
<a name="l450"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0>)
<a name="l451"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l452"></a> y_plot_top = y0 - scroll_y / </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l453"></a> y_plot_bottom = y0 + height - </span><span class=cFE>1</span><span class=cF0> - scroll_y / </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l454"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc-&gt;flags &amp; </span><span class=cF3>DOCF_BORDER_DOC</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;win_task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l455"></a> </span><span class=cF5>DocBorderListDraw</span><span class=cF0>(doc);
<a name="l456"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l457"></a>
<a name="l458"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt;= doc-&gt;cur_entry-&gt;min_col)
<a name="l459"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l460"></a> doc_e = doc-&gt;head.next;
<a name="l461"></a> doc_e-&gt;de_flags &amp;= ~(</span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0> | </span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0> | </span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0>);
<a name="l462"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc-&gt;head.next)
<a name="l463"></a> s = &amp;doc-&gt;settings_head;
<a name="l464"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l465"></a> s = &amp;doc_e-&gt;last-&gt;settings;
<a name="l466"></a> doc-&gt;flags = doc_e-&gt;de_flags &amp; (</span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0> | </span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0>) | doc-&gt;flags &amp; ~(</span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0> | </span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0>);
<a name="l467"></a> cur_u8_attr = s-&gt;cur_text_attr;
<a name="l468"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc-&gt;head.next)
<a name="l469"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l470"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_BWD_MOVEMENT</span><span class=cF0>;
<a name="l471"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; full_refresh)
<a name="l472"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_HAS_SONG</span><span class=cF0>;
<a name="l473"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l474"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l475"></a> doc-&gt;flags = doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0> | doc-&gt;flags &amp; ~</span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0>;
<a name="l476"></a>
<a name="l477"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;head.next == doc)
<a name="l478"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l479"></a> best_doc_e = doc;
<a name="l480"></a> best_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l481"></a> doc-&gt;cur_entry = doc;
<a name="l482"></a> doc-&gt;cur_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l483"></a> doc_e = doc;
<a name="l484"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l485"></a> skipped_update = doc_e == doc &amp;&amp; doc-&gt;head.next != doc;
<a name="l486"></a>
<a name="l487"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l488"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l489"></a> doc-&gt;min_x = </span><span class=cF3>I32_MAX</span><span class=cF0>;
<a name="l490"></a> doc-&gt;min_y = </span><span class=cF3>I32_MAX</span><span class=cF0>;
<a name="l491"></a> doc-&gt;max_x = </span><span class=cF3>I32_MIN</span><span class=cF0>;
<a name="l492"></a> doc-&gt;max_y = </span><span class=cF3>I32_MIN</span><span class=cF0>;
<a name="l493"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l494"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e != doc)
<a name="l495"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l496"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l497"></a> {
<a name="l498"></a> del_doc_e = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l499"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF7>(</span><span class=cF3>DOCEF_SKIP</span><span class=cF0> | </span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF7>)</span><span class=cF0>)
<a name="l500"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l501"></a> doc_e2 = doc_e;
<a name="l502"></a> </span><span class=cF1>goto</span><span class=cF0> rc_skip;
<a name="l503"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l504"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;doc_e-&gt;settings, s, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
<a name="l505"></a> s = &amp;doc_e-&gt;settings;
<a name="l506"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF7>(</span><span class=cF3>DOCEF_TAG_CB</span><span class=cF0> | </span><span class=cF3>DOCEF_DEFINE</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LIST</span><span class=cF7>)</span><span class=cF0>)
<a name="l507"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l508"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e-&gt;tag);
<a name="l509"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TAG_CB</span><span class=cF0>)
<a name="l510"></a> {
<a name="l511"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;tag_cb)
<a name="l512"></a> doc_e-&gt;tag = (*doc_e-&gt;tag_cb)(doc, doc_e, mem_task);
<a name="l513"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l514"></a> doc_e-&gt;tag = </span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>&quot;&quot;</span><span class=cF0>, mem_task);
<a name="l515"></a> }
<a name="l516"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l517"></a> {
<a name="l518"></a> </span><span class=cF1>if</span><span class=cF0> (tmph = </span><span class=cF5>HashFind</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;define_str, win_task-&gt;hash_table, </span><span class=cF3>HTT_DEFINE_STR</span><span class=cF7>)</span><span class=cF0>)
<a name="l519"></a> doc_e-&gt;tag = </span><span class=cF5>StrNew</span><span class=cF0>(tmph-&gt;data, mem_task);
<a name="l520"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l521"></a> doc_e-&gt;tag = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>, mem_task);
<a name="l522"></a> }
<a name="l523"></a> doc_e-&gt;max_col = </span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l524"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry == doc_e &amp;&amp; doc-&gt;cur_col &gt;= doc_e-&gt;max_col)
<a name="l525"></a> {
<a name="l526"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;max_col)
<a name="l527"></a> doc-&gt;cur_col = doc_e-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l528"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l529"></a> doc-&gt;cur_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l530"></a> }
<a name="l531"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l532"></a> k = </span><span class=cF5>DocWordWrapDel</span><span class=cF0>(doc, doc_e, full_refresh, same_win, left_margin, right_margin, &amp;best_doc_e, &amp;best_col);
<a name="l533"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp;
<a name="l534"></a> </span><span class=cF7>(</span><span class=cF3>DOCEF_LEFT_X</span><span class=cF0> | </span><span class=cF3>DOCEF_RIGHT_X</span><span class=cF0> | </span><span class=cF3>DOCEF_CENTER_X</span><span class=cF0> | </span><span class=cF3>DOCEF_TOP_Y</span><span class=cF0> | </span><span class=cF3>DOCEF_BOTTOM_Y</span><span class=cF0> | </span><span class=cF3>DOCEF_CENTER_Y</span><span class=cF7>)</span><span class=cF0>)
<a name="l535"></a> </span><span class=cF5>DocRecalcXY</span><span class=cF0>(doc, doc_e, k, left, width, height, left_margin, right_margin, x0, y0, &amp;x, &amp;y);
<a name="l536"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh &amp;&amp; k &gt; </span><span class=cFE>0</span><span class=cF0> &amp;&amp; doc-&gt;flags &amp; </span><span class=cF3>DOCF_WORD_WRAP</span><span class=cF0> &amp;&amp;
<a name="l537"></a> </span><span class=cF7>(</span><span class=cF0>doc_e2 = </span><span class=cF5>DocWordWrapAdd</span><span class=cF0>(doc, doc_e, &amp;k, left, right_margin, x, y)</span><span class=cF7>)</span><span class=cF0>)
<a name="l538"></a> doc_e = doc_e2;
<a name="l539"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l540"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l541"></a> }
<a name="l542"></a>
<a name="l543"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l544"></a> {
<a name="l545"></a> doc_e-&gt;x = x;
<a name="l546"></a> doc_e-&gt;y = y;
<a name="l547"></a> doc_e-&gt;page_line_num = doc-&gt;page_line_num;
<a name="l548"></a> </span><span class=cF1>if</span><span class=cF0> (x &lt; doc-&gt;min_x)
<a name="l549"></a> doc-&gt;min_x = x;
<a name="l550"></a> </span><span class=cF1>if</span><span class=cF0> (y &lt; doc-&gt;min_y)
<a name="l551"></a> doc-&gt;min_y = y;
<a name="l552"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l553"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l554"></a> D = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l555"></a> col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l556"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l557"></a> }
<a name="l558"></a> col2 = </span><span class=cFE>0</span><span class=cF0>;
<a name="l559"></a>
<a name="l560"></a> tmp_u32_attr = </span><span class=cF5>DocTmpAttr</span><span class=cF0>(doc, doc_e, cur_u8_attr);
<a name="l561"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc-&gt;cur_entry)
<a name="l562"></a> {
<a name="l563"></a> cursor_y = doc_e-&gt;y;
<a name="l564"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCF_ADD_CURSOR</span><span class=cF0> &amp;&amp; !added_cursor)
<a name="l565"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l566"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp; </span><span class=cFE>0</span><span class=cF0> &lt; doc-&gt;cur_col &lt; k &amp;&amp;
<a name="l567"></a> !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp;
<a name="l568"></a> ~(</span><span class=cF3>DOCEF_TAG</span><span class=cF0>|</span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0>|</span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0>|</span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0>|</span><span class=cF3>DOCEF_SKIP</span><span class=cF0>|</span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l569"></a> !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;type &amp; </span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF7>)</span><span class=cF0>)
<a name="l570"></a> {
<a name="l571"></a> added_cursor = </span><span class=cF5>DocSplitTag</span><span class=cF0>(doc, doc_e, doc-&gt;cur_col, x, y, </span><span class=cF3>DOCT_CURSOR</span><span class=cF0>);
<a name="l572"></a> k = </span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l573"></a> }
<a name="l574"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l575"></a> {
<a name="l576"></a> added_cursor = doc_e2 = </span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc, </span><span class=cF3>DOCT_CURSOR</span><span class=cF0> | doc_e-&gt;type &amp; </span><span class=cFE>0xFFFFFF00</span><span class=cF0>,
<a name="l577"></a> doc_e-&gt;de_flags &amp; ~</span><span class=cF3>DOCEG_HAS_ARG</span><span class=cF0>, x, y, doc-&gt;page_line_num);
<a name="l578"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;doc_e2-&gt;settings, &amp;doc_e-&gt;settings, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
<a name="l579"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp; doc-&gt;cur_col &gt;= k)
<a name="l580"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_e2, doc_e);
<a name="l581"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l582"></a> </span><span class=cF5>QueueInsertRev</span><span class=cF0>(doc_e2, doc_e);
<a name="l583"></a> }
<a name="l584"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l585"></a> }
<a name="l586"></a>
<a name="l587"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_REFRESH_DATA</span><span class=cF0> &amp;&amp;
<a name="l588"></a> </span><span class=cF7>(</span><span class=cF0>doc_e-&gt;type_u8 == </span><span class=cF3>DOCT_DATA</span><span class=cF0> || doc_e-&gt;type_u8 == </span><span class=cF3>DOCT_CHECK_BOX</span><span class=cF0> || doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LIST</span><span class=cF7>)</span><span class=cF0>)
<a name="l589"></a> {
<a name="l590"></a> </span><span class=cF5>DocDataFormat</span><span class=cF0>(doc, doc_e);
<a name="l591"></a> k = </span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l592"></a> }
<a name="l593"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TAG</span><span class=cF0>)
<a name="l594"></a> {
<a name="l595"></a> ptr = doc_e-&gt;tag;
<a name="l596"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TREE</span><span class=cF0>)
<a name="l597"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l598"></a> </span><span class=cF1>if</span><span class=cF0> (k &gt;= </span><span class=cFE>2</span><span class=cF0>)
<a name="l599"></a> {
<a name="l600"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CHECKED_COLLAPSED</span><span class=cF0>)
<a name="l601"></a> *ptr++ = </span><span class=cF6>'+'</span><span class=cF0>;
<a name="l602"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l603"></a> *ptr++ = </span><span class=cF6>'-'</span><span class=cF0>;
<a name="l604"></a> *ptr++ = </span><span class=cF6>']'</span><span class=cF0>;
<a name="l605"></a> ptr = doc_e-&gt;tag;
<a name="l606"></a> }
<a name="l607"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l608"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HAS_BIN</span><span class=cF0>)
<a name="l609"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l610"></a> </span><span class=cF1>if</span><span class=cF0> (*ptr == </span><span class=cF6>'&lt;'</span><span class=cF0> &amp;&amp; full_refresh &amp;&amp; </span><span class=cF6>'0'</span><span class=cF0> &lt;= ptr[</span><span class=cFE>1</span><span class=cF0>] &lt;= </span><span class=cF6>'9'</span><span class=cF0>)
<a name="l611"></a> {
<a name="l612"></a> ptr = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;&lt;%d&gt;&quot;</span><span class=cF0>, doc_e-&gt;bin_num);
<a name="l613"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_e-&gt;tag);
<a name="l614"></a> doc_e-&gt;tag = </span><span class=cF5>StrNew</span><span class=cF0>(ptr, mem_task);
<a name="l615"></a> </span><span class=cF5>Free</span><span class=cF0>(ptr);
<a name="l616"></a> ptr = doc_e-&gt;tag;
<a name="l617"></a> k = </span><span class=cF5>StrLen</span><span class=cF0>(ptr);
<a name="l618"></a> }
<a name="l619"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l620"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8 == </span><span class=cF3>DOCT_CHECK_BOX</span><span class=cF0>)
<a name="l621"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l622"></a> </span><span class=cF1>if</span><span class=cF0> (k &gt;= </span><span class=cFE>3</span><span class=cF0>)
<a name="l623"></a> {
<a name="l624"></a> *ptr++ = </span><span class=cF6>'['</span><span class=cF0>;
<a name="l625"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CHECKED_COLLAPSED</span><span class=cF0>)
<a name="l626"></a> *ptr++ = </span><span class=cF6>'X'</span><span class=cF0>;
<a name="l627"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l628"></a> *ptr++ = </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l629"></a> *ptr++ = </span><span class=cF6>']'</span><span class=cF0>;
<a name="l630"></a> ptr = doc_e-&gt;tag;
<a name="l631"></a> }
<a name="l632"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l633"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_SCROLLING_X</span><span class=cF0>)
<a name="l634"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l635"></a> j = </span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l636"></a> </span><span class=cF1>if</span><span class=cF0> (j &amp;&amp; doc_e-&gt;scroll_len)
<a name="l637"></a> {
<a name="l638"></a> i_jif = </span><span class=cF5>ToI64</span><span class=cF0>(cur_time * </span><span class=cF3>FONT_WIDTH</span><span class=cF0> * </span><span class=cF3>DOC_SCROLL_SPEED</span><span class=cF0>) % (j * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>);
<a name="l639"></a> tmp_u32_attr = tmp_u32_attr &amp; </span><span class=cFE>0xFFE0FF00</span><span class=cF0> | (</span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0> - i_jif &amp; </span><span class=cF7>(</span><span class=cF3>FONT_WIDTH</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>) &lt;&lt; </span><span class=cFE>16</span><span class=cF0>;
<a name="l640"></a>#</span><span class=cF1>assert</span><span class=cF0> </span><span class=cF3>FONT_WIDTH</span><span class=cF0> == </span><span class=cFE>8</span><span class=cF0>
<a name="l641"></a> i_jif &gt;&gt;= </span><span class=cFE>3</span><span class=cF0>;
<a name="l642"></a> </span><span class=cF1>for</span><span class=cF0> (k = </span><span class=cFE>0</span><span class=cF0>; k &lt; doc_e-&gt;scroll_len; k++)
<a name="l643"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l644"></a> ch = ptr[(i_jif + k) % j];
<a name="l645"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_displayable</span><span class=cF0>, ch</span><span class=cF7>)</span><span class=cF0>)
<a name="l646"></a> ch = </span><span class=cF6>'.'</span><span class=cF0>;
<a name="l647"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l648"></a> {
<a name="l649"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BORDER_PLOT</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;win_task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l650"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>TRUE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l651"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l652"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>FALSE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l653"></a> }
<a name="l654"></a> x++;
<a name="l655"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l656"></a> }
<a name="l657"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l658"></a> {
<a name="l659"></a> D = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, doc_e-&gt;x, doc_e-&gt;y);
<a name="l660"></a> col = doc_e-&gt;min_col;
<a name="l661"></a> }
<a name="l662"></a> col2 = doc_e-&gt;scroll_len; </span><span class=cF2>//TODO This is flawed</span><span class=cF0>
<a name="l663"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l664"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l665"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l666"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BORDER_PLOT</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;win_task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l667"></a> {
<a name="l668"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *ptr++)
<a name="l669"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l670"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l671"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>TRUE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l672"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l673"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l674"></a> {
<a name="l675"></a> d2 = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l676"></a> </span><span class=cF1>if</span><span class=cF0> (d2 &lt; D)
<a name="l677"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l678"></a> D = d2;
<a name="l679"></a> col = col2;
<a name="l680"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l681"></a> }
<a name="l682"></a> col2++;
<a name="l683"></a> x++;
<a name="l684"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l685"></a> }
<a name="l686"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l687"></a> {
<a name="l688"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp; doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0>)
<a name="l689"></a> hl = </span><span class=cF5>DocHighlight</span><span class=cF0>(doc_e, ptr, k, tmp_u32_attr);
<a name="l690"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l691"></a> hl = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l692"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l693"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l694"></a></span><span class=cF2>//Technically we should do this for scrolling_x, too.</span><span class=cF0>
<a name="l695"></a> </span><span class=cF1>if</span><span class=cF0> (y &gt; y_plot_bottom)
<a name="l696"></a> more = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l697"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (y &gt;= y_plot_top)
<a name="l698"></a> {
<a name="l699"></a> </span><span class=cF1>if</span><span class=cF0> (hl)
<a name="l700"></a> </span><span class=cF5>TextLenAttrStr</span><span class=cF0>(win_task, x - x0, y - y0, k, hl);
<a name="l701"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l702"></a> </span><span class=cF5>TextLenStr</span><span class=cF0>(win_task, x - x0, y - y0, k, tmp_u32_attr, ptr);
<a name="l703"></a> }
<a name="l704"></a> col2 += k;
<a name="l705"></a> x += k;
<a name="l706"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l707"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l708"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l709"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l710"></a> {
<a name="l711"></a> </span><span class=cF1>while</span><span class=cF0> (k--)
<a name="l712"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l713"></a> d2 = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l714"></a> </span><span class=cF1>if</span><span class=cF0> (d2 &lt; D)
<a name="l715"></a> {
<a name="l716"></a> D = d2;
<a name="l717"></a> col = col2;
<a name="l718"></a> }
<a name="l719"></a> col2++;
<a name="l720"></a> x++;
<a name="l721"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l722"></a> }
<a name="l723"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l724"></a> {
<a name="l725"></a> col2 += k;
<a name="l726"></a> x += k;
<a name="l727"></a> }
<a name="l728"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l729"></a> </span><span class=cF5>Free</span><span class=cF0>(hl);
<a name="l730"></a> }
<a name="l731"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l732"></a> }
<a name="l733"></a> </span><span class=cF1>switch</span><span class=cF0> [doc_e-&gt;type_u8]
<a name="l734"></a> {
<a name="l735"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_TEXT</span><span class=cF0>:
<a name="l736"></a> </span><span class=cF1>if</span><span class=cF0> (!col2 &amp;&amp;
<a name="l737"></a> !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp;
<a name="l738"></a> (</span><span class=cF3>DOCEF_TREE</span><span class=cF0> | </span><span class=cF3>DOCEF_LIST</span><span class=cF0> | </span><span class=cF3>DOCEF_TAG_CB</span><span class=cF0> |
<a name="l739"></a> </span><span class=cF3>DOCEF_DEFINE</span><span class=cF0> | </span><span class=cF3>DOCEF_AUX_STR</span><span class=cF0> | </span><span class=cF3>DOCEF_HTML_LINK</span><span class=cF0> | </span><span class=cF3>DOCEF_BIN_PTR_LINK</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
<a name="l740"></a> del_doc_e = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l741"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l742"></a>
<a name="l743"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_HEX_ED</span><span class=cF0>:
<a name="l744"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DEREF_DATA</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_REMALLOC_DATA</span><span class=cF7>)</span><span class=cF0>)
<a name="l745"></a> bptr = doc_e-&gt;data;
<a name="l746"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l747"></a> bptr = &amp;doc_e-&gt;data;
<a name="l748"></a> k = doc_e-&gt;hex_ed_width; </span><span class=cF2>//columns</span><span class=cF0>
<a name="l749"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; doc_e-&gt;len; i += k)
<a name="l750"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l751"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_ZERO_BASED</span><span class=cF0>)
<a name="l752"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;%08tX &quot;</span><span class=cF0>, i);
<a name="l753"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l754"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;%08tX &quot;</span><span class=cF0>, bptr);
<a name="l755"></a> ptr = buf;
<a name="l756"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *ptr++)
<a name="l757"></a> {
<a name="l758"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l759"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l760"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BORDER_PLOT</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;win_task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l761"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>TRUE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l762"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l763"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>FALSE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l764"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l765"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l766"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l767"></a> d2 = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l768"></a> </span><span class=cF1>if</span><span class=cF0> (d2 &lt; D)
<a name="l769"></a> {
<a name="l770"></a> D = d2;
<a name="l771"></a> col = i * </span><span class=cFE>3</span><span class=cF0>;
<a name="l772"></a> }
<a name="l773"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l774"></a> x++;
<a name="l775"></a> }
<a name="l776"></a> </span><span class=cF1>if</span><span class=cF0> (i + k &gt; doc_e-&gt;len)
<a name="l777"></a> k = doc_e-&gt;len - i;
<a name="l778"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; k; j++)
<a name="l779"></a> {
<a name="l780"></a> </span><span class=cF5>StrPrint</span><span class=cF0>(buf, </span><span class=cF6>&quot;%02tX&quot;</span><span class=cF0>, *bptr++);
<a name="l781"></a> ptr = buf;
<a name="l782"></a> </span><span class=cF1>while</span><span class=cF0> (ch = *ptr++)
<a name="l783"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l784"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l785"></a> {
<a name="l786"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BORDER_PLOT</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;win_task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l787"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>TRUE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l788"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l789"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>FALSE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l790"></a> }
<a name="l791"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l792"></a> {
<a name="l793"></a> d2 = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l794"></a> </span><span class=cF1>if</span><span class=cF0> (d2 &lt; D)
<a name="l795"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l796"></a> D = d2;
<a name="l797"></a> col = col2;
<a name="l798"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l799"></a> }
<a name="l800"></a> col2++;
<a name="l801"></a> x++;
<a name="l802"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l803"></a> x++;
<a name="l804"></a> }
<a name="l805"></a> bptr -= j;
<a name="l806"></a> x += (doc_e-&gt;hex_ed_width - k) * </span><span class=cFE>3</span><span class=cF0>;
<a name="l807"></a> </span><span class=cF1>for</span><span class=cF0> (j = </span><span class=cFE>0</span><span class=cF0>; j &lt; k; j++)
<a name="l808"></a> {
<a name="l809"></a> ch = *bptr++;
<a name="l810"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cFB>char_bmp_displayable</span><span class=cF0>, ch</span><span class=cF7>)</span><span class=cF0>)
<a name="l811"></a> ch = </span><span class=cF6>'.'</span><span class=cF0>;
<a name="l812"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l813"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l814"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BORDER_PLOT</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;win_task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l815"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>TRUE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l816"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l817"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>FALSE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + ch);
<a name="l818"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l819"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l820"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l821"></a> d2 = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l822"></a> </span><span class=cF1>if</span><span class=cF0> (d2 &lt; D)
<a name="l823"></a> {
<a name="l824"></a> D = d2;
<a name="l825"></a> col = col2;
<a name="l826"></a> }
<a name="l827"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l828"></a> col2++;
<a name="l829"></a> x++;
<a name="l830"></a> }
<a name="l831"></a> y++;
<a name="l832"></a> x -= doc_e-&gt;hex_ed_width * </span><span class=cFE>3</span><span class=cF0> + k + </span><span class=cFE>9</span><span class=cF0>;
<a name="l833"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l834"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l835"></a>
<a name="l836"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0>:
<a name="l837"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0>:
<a name="l838"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>&amp;&amp;
<a name="l839"></a> y_plot_top &lt;= y &lt;= y_plot_bottom)
<a name="l840"></a> </span><span class=cF5>TextLenAttr</span><span class=cF0>(win_task, x - x0, y - y0, width - </span><span class=cF7>(</span><span class=cF0>x - x0</span><span class=cF7>)</span><span class=cF0>, cur_u8_attr &lt;&lt; </span><span class=cFE>8</span><span class=cF0>);
<a name="l841"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0> &amp;&amp; s-&gt;state == </span><span class=cF3>DOCSS_CPP_Z_COMMENT</span><span class=cF0>)
<a name="l842"></a> s-&gt;state = </span><span class=cF3>DOCSS_NORMAL</span><span class=cF0>;
<a name="l843"></a> y++;
<a name="l844"></a> doc-&gt;page_line_num++;
<a name="l845"></a>rc_start_of_line:
<a name="l846"></a> </span><span class=cF1>if</span><span class=cF0> (s-&gt;left_margin == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l847"></a> x = s-&gt;indent;
<a name="l848"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l849"></a> x = s-&gt;indent + s-&gt;left_margin;
<a name="l850"></a>rc_adjust_xy:
<a name="l851"></a> i = s-&gt;indent + s-&gt;left_margin;
<a name="l852"></a> </span><span class=cF1>if</span><span class=cF0> (x &lt; i)
<a name="l853"></a> x = i;
<a name="l854"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l855"></a> doc-&gt;page_line_num = s-&gt;page_len + doc-&gt;page_line_num % s-&gt;page_len;
<a name="l856"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l857"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l858"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &gt;= s-&gt;page_len)
<a name="l859"></a> {
<a name="l860"></a> doc-&gt;page_line_num -= s-&gt;page_len;
<a name="l861"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &gt;= s-&gt;page_len) </span><span class=cF2>//avoid extra divide</span><span class=cF0>
<a name="l862"></a> doc-&gt;page_line_num = doc-&gt;page_line_num % s-&gt;page_len;
<a name="l863"></a> }
<a name="l864"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l865"></a> </span><span class=cF1>if</span><span class=cF0> (s-&gt;header != </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l866"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l867"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &lt; s-&gt;header)
<a name="l868"></a> {
<a name="l869"></a> y += s-&gt;header - doc-&gt;page_line_num;
<a name="l870"></a> doc-&gt;page_line_num = s-&gt;header;
<a name="l871"></a> </span><span class=cF1>goto</span><span class=cF0> rc_start_of_line;
<a name="l872"></a> }
<a name="l873"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l874"></a> </span><span class=cF1>if</span><span class=cF0> (s-&gt;footer == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l875"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l876"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &gt;= s-&gt;page_len)
<a name="l877"></a> {
<a name="l878"></a> </span><span class=cF1>if</span><span class=cF0> (s-&gt;header == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l879"></a> doc-&gt;page_line_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l880"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l881"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l882"></a> doc-&gt;page_line_num = s-&gt;header;
<a name="l883"></a> y += s-&gt;header;
<a name="l884"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l885"></a> </span><span class=cF1>goto</span><span class=cF0> rc_start_of_line;
<a name="l886"></a> }
<a name="l887"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l888"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l889"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l890"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;page_line_num &gt;= s-&gt;page_len - s-&gt;footer)
<a name="l891"></a> {
<a name="l892"></a> y += s-&gt;footer;
<a name="l893"></a> </span><span class=cF1>if</span><span class=cF0> (s-&gt;header == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l894"></a> doc-&gt;page_line_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l895"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l896"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l897"></a> doc-&gt;page_line_num = s-&gt;header;
<a name="l898"></a> y += s-&gt;header;
<a name="l899"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l900"></a> </span><span class=cF1>goto</span><span class=cF0> rc_start_of_line;
<a name="l901"></a> }
<a name="l902"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l903"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l904"></a>
<a name="l905"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_TAB</span><span class=cF0>:
<a name="l906"></a> k = (x + </span><span class=cFE>4</span><span class=cF0>) &amp; ~</span><span class=cFE>3</span><span class=cF0>;
<a name="l907"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BORDER_PLOT</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;win_task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l908"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l909"></a> </span><span class=cF1>while</span><span class=cF0> (x &lt; k)
<a name="l910"></a> {
<a name="l911"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l912"></a> </span><span class=cF5>TextChar</span><span class=cF0>(win_task, </span><span class=cF3>TRUE</span><span class=cF0>, x - x0, y - y0, tmp_u32_attr + </span><span class=cF3>CH_SPACE</span><span class=cF0>);
<a name="l913"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l914"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l915"></a> d2 = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l916"></a> </span><span class=cF1>if</span><span class=cF0> (d2 &lt; D)
<a name="l917"></a> D = d2;
<a name="l918"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l919"></a> x++;
<a name="l920"></a> }
<a name="l921"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l922"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l923"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l924"></a> k -= x;
<a name="l925"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l926"></a> {
<a name="l927"></a> </span><span class=cF1>if</span><span class=cF0> (y_plot_top &lt;= y &lt;= y_plot_bottom)
<a name="l928"></a> </span><span class=cF5>TextLenStr</span><span class=cF0>(win_task, x - x0, y - y0, k, tmp_u32_attr, </span><span class=cF6>&quot; &quot;</span><span class=cF0>);
<a name="l929"></a> x += k;
<a name="l930"></a> }
<a name="l931"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l932"></a> {
<a name="l933"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l934"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l935"></a> </span><span class=cF1>while</span><span class=cF0> (k--)
<a name="l936"></a> {
<a name="l937"></a> d2 = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l938"></a> </span><span class=cF1>if</span><span class=cF0> (d2 &lt; D)
<a name="l939"></a> D = d2;
<a name="l940"></a> x++;
<a name="l941"></a> }
<a name="l942"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l943"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l944"></a> x += k;
<a name="l945"></a> }
<a name="l946"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l947"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l948"></a>
<a name="l949"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_PAGE_BREAK</span><span class=cF0>:
<a name="l950"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_BWD_MOVEMENT</span><span class=cF0>;
<a name="l951"></a> y += s-&gt;page_len - doc_e-&gt;page_line_num;
<a name="l952"></a> doc-&gt;page_line_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l953"></a> </span><span class=cF1>goto</span><span class=cF0> rc_start_of_line;
<a name="l954"></a>
<a name="l955"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_CURSOR</span><span class=cF0>:
<a name="l956"></a> </span><span class=cF1>if</span><span class=cF0> (!find_cursor &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc-&gt;flags &amp; </span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF7>)</span><span class=cF0>)
<a name="l957"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l958"></a> doc-&gt;cur_entry = doc_e-&gt;next;
<a name="l959"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l960"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l961"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e != added_cursor)
<a name="l962"></a> del_doc_e = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l963"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l964"></a>
<a name="l965"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_PROMPT</span><span class=cF0>:
<a name="l966"></a> cur_u8_attr = cur_u8_attr &amp; </span><span class=cFE>0xF0</span><span class=cF0> | </span><span class=cF3>DOC_COLOR_PROMPT</span><span class=cF0>;
<a name="l967"></a> </span><span class=cF1>if</span><span class=cF0> (y == cursor_y)
<a name="l968"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l969"></a> doc-&gt;cur_entry = doc_e-&gt;next;
<a name="l970"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l971"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l972"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l973"></a>
<a name="l974"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_CLEAR</span><span class=cF0>:
<a name="l975"></a> next_clear_found = doc_e;
<a name="l976"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HOLD</span><span class=cF0>)
<a name="l977"></a> clear_holds = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l978"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l979"></a> clear_holds = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l980"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l981"></a>
<a name="l982"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_PAGE_LEN</span><span class=cF0>:
<a name="l983"></a> s-&gt;page_len = doc_e-&gt;attr;
<a name="l984"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_WIN_REL</span><span class=cF0>)
<a name="l985"></a> s-&gt;page_len += height;
<a name="l986"></a> </span><span class=cF1>goto</span><span class=cF0> rc_adjust_xy;
<a name="l987"></a>
<a name="l988"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_LEFT_MARGIN</span><span class=cF0>:
<a name="l989"></a> i = doc_e-&gt;attr;
<a name="l990"></a> left_margin = left+i;
<a name="l991"></a> s-&gt;left_margin = i;
<a name="l992"></a> </span><span class=cF1>goto</span><span class=cF0> rc_start_of_line;
<a name="l993"></a>
<a name="l994"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_RIGHT_MARGIN</span><span class=cF0>:
<a name="l995"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_WIN_REL</span><span class=cF0>)
<a name="l996"></a> i = width - </span><span class=cFE>1</span><span class=cF0> - doc_e-&gt;attr;
<a name="l997"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l998"></a> i = doc_e-&gt;attr;
<a name="l999"></a> right_margin = left + i;
<a name="l1000"></a> s-&gt;right_margin = i;
<a name="l1001"></a> </span><span class=cF1>goto</span><span class=cF0> rc_adjust_xy;
<a name="l1002"></a>
<a name="l1003"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_HEADER</span><span class=cF0>:
<a name="l1004"></a> s-&gt;header = doc_e-&gt;attr;
<a name="l1005"></a> </span><span class=cF1>goto</span><span class=cF0> rc_adjust_xy;
<a name="l1006"></a>
<a name="l1007"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_FOOTER</span><span class=cF0>:
<a name="l1008"></a> s-&gt;footer = doc_e-&gt;attr;
<a name="l1009"></a> </span><span class=cF1>goto</span><span class=cF0> rc_adjust_xy;
<a name="l1010"></a>
<a name="l1011"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_INDENT</span><span class=cF0>:
<a name="l1012"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_X</span><span class=cF0>)
<a name="l1013"></a> i = doc_e-&gt;attr;
<a name="l1014"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1015"></a> i = s-&gt;indent + doc_e-&gt;attr;
<a name="l1016"></a> s-&gt;indent=i;
<a name="l1017"></a> </span><span class=cF1>goto</span><span class=cF0> rc_start_of_line;
<a name="l1018"></a>
<a name="l1019"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_FOREGROUND</span><span class=cF0>:
<a name="l1020"></a> cur_u8_attr &amp;= </span><span class=cFE>0xF0</span><span class=cF0>;
<a name="l1021"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l1022"></a> cur_u8_attr |= s-&gt;default_text_attr &amp; </span><span class=cFE>0x0F</span><span class=cF0>;
<a name="l1023"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1024"></a> cur_u8_attr |= doc_e-&gt;attr;
<a name="l1025"></a> s-&gt;cur_text_attr = cur_u8_attr;
<a name="l1026"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1027"></a>
<a name="l1028"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_BACKGROUND</span><span class=cF0>:
<a name="l1029"></a> cur_u8_attr &amp;= </span><span class=cFE>0x0F</span><span class=cF0>;
<a name="l1030"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l1031"></a> cur_u8_attr |= s-&gt;default_text_attr &amp; </span><span class=cFE>0xF0</span><span class=cF0>;
<a name="l1032"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1033"></a> cur_u8_attr |= doc_e-&gt;attr &lt;&lt; </span><span class=cFE>4</span><span class=cF0>;
<a name="l1034"></a> s-&gt;cur_text_attr = cur_u8_attr;
<a name="l1035"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1036"></a>
<a name="l1037"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_DEFAULT_FOREGROUND</span><span class=cF0>:
<a name="l1038"></a> cur_u8_attr &amp;= </span><span class=cFE>0xF0</span><span class=cF0>;
<a name="l1039"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l1040"></a> cur_u8_attr |= s-&gt;default_text_attr &amp; </span><span class=cFE>0xF</span><span class=cF0>;
<a name="l1041"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1042"></a> cur_u8_attr |= doc_e-&gt;attr;
<a name="l1043"></a> s-&gt;default_text_attr = s-&gt;default_text_attr &amp; </span><span class=cFE>0xF0</span><span class=cF0> | cur_u8_attr &amp; </span><span class=cFE>0x0F</span><span class=cF0>;
<a name="l1044"></a> s-&gt;cur_text_attr = cur_u8_attr;
<a name="l1045"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1046"></a>
<a name="l1047"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_DEFAULT_BACKGROUND</span><span class=cF0>:
<a name="l1048"></a> cur_u8_attr &amp;= </span><span class=cFE>0x0F</span><span class=cF0>;
<a name="l1049"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr == </span><span class=cF3>DOC_DEFAULT</span><span class=cF0>)
<a name="l1050"></a> cur_u8_attr |= s-&gt;default_text_attr &amp; </span><span class=cFE>0xF0</span><span class=cF0>;
<a name="l1051"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1052"></a> cur_u8_attr |= doc_e-&gt;attr &lt;&lt; </span><span class=cFE>4</span><span class=cF0>;
<a name="l1053"></a> s-&gt;default_text_attr = s-&gt;default_text_attr &amp; </span><span class=cFE>0x0F</span><span class=cF0> | cur_u8_attr &amp; </span><span class=cFE>0xF0</span><span class=cF0>;
<a name="l1054"></a> s-&gt;cur_text_attr = cur_u8_attr;
<a name="l1055"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1056"></a>
<a name="l1057"></a>
<a name="l1058"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_WORD_WRAP</span><span class=cF0>:
<a name="l1059"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr)
<a name="l1060"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_WORD_WRAP</span><span class=cF0>;
<a name="l1061"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1062"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_WORD_WRAP</span><span class=cF0>;
<a name="l1063"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1064"></a>
<a name="l1065"></a>
<a name="l1066"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_HIGHLIGHT</span><span class=cF0>:
<a name="l1067"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr)
<a name="l1068"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_HIGHLIGHT</span><span class=cF0>;
<a name="l1069"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1070"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_HIGHLIGHT</span><span class=cF0>;
<a name="l1071"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1072"></a>
<a name="l1073"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_BLINK</span><span class=cF0>:
<a name="l1074"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr)
<a name="l1075"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_BLINK</span><span class=cF0>;
<a name="l1076"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1077"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_BLINK</span><span class=cF0>;
<a name="l1078"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1079"></a>
<a name="l1080"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_INVERT</span><span class=cF0>:
<a name="l1081"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr)
<a name="l1082"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_INVERT</span><span class=cF0>;
<a name="l1083"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1084"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_INVERT</span><span class=cF0>;
<a name="l1085"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1086"></a>
<a name="l1087"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_UNDERLINE</span><span class=cF0>:
<a name="l1088"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;attr)
<a name="l1089"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_UNDERLINE</span><span class=cF0>;
<a name="l1090"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1091"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_UNDERLINE</span><span class=cF0>;
<a name="l1092"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1093"></a>
<a name="l1094"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_SHIFTED_X</span><span class=cF0>:
<a name="l1095"></a> s-&gt;shifted_x = doc_e-&gt;attr;
<a name="l1096"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1097"></a>
<a name="l1098"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_SHIFTED_Y</span><span class=cF0>:
<a name="l1099"></a> s-&gt;shifted_y = doc_e-&gt;attr;
<a name="l1100"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1101"></a>
<a name="l1102"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_CURSOR_MOVEMENT</span><span class=cF0>:
<a name="l1103"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_BWD_MOVEMENT</span><span class=cF0>;
<a name="l1104"></a> x += doc_e-&gt;cursor_x_offset;
<a name="l1105"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_PAGE_REL_Y</span><span class=cF0>)
<a name="l1106"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1107"></a> i = doc-&gt;page_line_num;
<a name="l1108"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TOP_Y</span><span class=cF0>)
<a name="l1109"></a> doc-&gt;page_line_num = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1110"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_BOTTOM_Y</span><span class=cF0>)
<a name="l1111"></a> doc-&gt;page_line_num = s-&gt;page_len - </span><span class=cFE>1</span><span class=cF0>;
<a name="l1112"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CENTER_Y</span><span class=cF0>)
<a name="l1113"></a> doc-&gt;page_line_num = s-&gt;page_len &gt;&gt; </span><span class=cFE>1</span><span class=cF0>;
<a name="l1114"></a> y += doc-&gt;page_line_num - i;
<a name="l1115"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1116"></a> y += doc_e-&gt;cursor_y_offset;
<a name="l1117"></a> doc-&gt;page_line_num += doc_e-&gt;cursor_y_offset;
<a name="l1118"></a> </span><span class=cF1>goto</span><span class=cF0> rc_adjust_xy;
<a name="l1119"></a>
<a name="l1120"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_SPRITE</span><span class=cF0>:
<a name="l1121"></a> </span><span class=cF1>if</span><span class=cF0> (!doc_e-&gt;bin_data &amp;&amp; doc-&gt;flags &amp; </span><span class=cF3>DOCEF_HAS_BIN</span><span class=cF0>)
<a name="l1122"></a> doc_e-&gt;bin_data = </span><span class=cF5>DocBinFindNum</span><span class=cF0>(doc, doc_e-&gt;bin_num);
<a name="l1123"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>tmpb = doc_e-&gt;bin_data</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !tmpb-&gt;tag &amp;&amp; doc_e-&gt;tag &amp;&amp; *doc_e-&gt;tag)
<a name="l1124"></a> tmpb-&gt;tag = </span><span class=cF5>StrNew</span><span class=cF0>(doc_e-&gt;tag, mem_task);
<a name="l1125"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb &amp;&amp; dc)
<a name="l1126"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1127"></a> </span><span class=cF5>DCReset</span><span class=cF0>(dc);
<a name="l1128"></a> dc-&gt;flags &amp;= ~(</span><span class=cF3>DCF_DONT_DRAW</span><span class=cF0> | </span><span class=cF3>DCF_LOCATE_NEAREST</span><span class=cF0>);
<a name="l1129"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> != </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> || doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF0>)
<a name="l1130"></a> dc-&gt;flags |= </span><span class=cF3>DCF_DONT_DRAW</span><span class=cF0>;
<a name="l1131"></a> bptr = tmpb-&gt;data;
<a name="l1132"></a> ii = </span><span class=cF5>SpriteTypeMask</span><span class=cF0>(bptr);
<a name="l1133"></a> </span><span class=cF1>if</span><span class=cF0> (ii &amp; </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>SPT_TYPES_NUM</span><span class=cF0>)
<a name="l1134"></a> {
<a name="l1135"></a> bptr = </span><span class=cFB>gr</span><span class=cF0>.empty_sprite;
<a name="l1136"></a> ii = </span><span class=cF5>SpriteTypeMask</span><span class=cF0>(bptr);
<a name="l1137"></a> }
<a name="l1138"></a> </span><span class=cF1>if</span><span class=cF0> (ii &amp; </span><span class=cF7>(</span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>SPT_FLOOD_FILL</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>SPT_FLOOD_FILL_NOT</span><span class=cF7>)</span><span class=cF0>)
<a name="l1139"></a> i = cur_u8_attr &gt;&gt; </span><span class=cFE>4</span><span class=cF0> &amp; </span><span class=cFE>0xF</span><span class=cF0> ^ win_task-&gt;text_attr &gt;&gt; </span><span class=cFE>4</span><span class=cF0> &amp; </span><span class=cFE>0xF</span><span class=cF0>;
<a name="l1140"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1141"></a> {
<a name="l1142"></a> i = tmp_u32_attr &gt;&gt; </span><span class=cFE>12</span><span class=cF0> &amp; </span><span class=cFE>0xF</span><span class=cF0> ^ win_task-&gt;text_attr &gt;&gt; </span><span class=cFE>4</span><span class=cF0> &amp; </span><span class=cFE>0xF</span><span class=cF0>;
<a name="l1143"></a> </span><span class=cF1>if</span><span class=cF0> (tmp_u32_attr &amp; </span><span class=cF3>DOCET_SEL</span><span class=cF0>)
<a name="l1144"></a> i ^= </span><span class=cFE>0xF</span><span class=cF0>;
<a name="l1145"></a> </span><span class=cF1>if</span><span class=cF0> (tmp_u32_attr &amp; </span><span class=cF3>DOCET_INVERT</span><span class=cF0>)
<a name="l1146"></a> i ^= </span><span class=cFE>0xF</span><span class=cF0>;
<a name="l1147"></a> </span><span class=cF1>if</span><span class=cF0> (blink_flag &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_e == doc-&gt;cur_entry || tmp_u32_attr &amp; </span><span class=cF3>DOCET_BLINK</span><span class=cF7>)</span><span class=cF0>)
<a name="l1148"></a> i ^= </span><span class=cFE>0xF</span><span class=cF0>;
<a name="l1149"></a> }
<a name="l1150"></a> dc-&gt;color = i;
<a name="l1151"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l1152"></a> dc-&gt;flags |= </span><span class=cF3>DCF_LOCATE_NEAREST</span><span class=cF0>;
<a name="l1153"></a> dc-&gt;cur_x = (doc-&gt;x - x0) * </span><span class=cF3>FONT_WIDTH</span><span class=cF0> + pix_left + scroll_x;
<a name="l1154"></a> dc-&gt;cur_y = (doc-&gt;y - y0) * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0> + pix_top + scroll_y;
<a name="l1155"></a> dc-&gt;cur_z = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1156"></a> dc-&gt;bkcolor = i;
<a name="l1157"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_FROM_START</span><span class=cF0>)
<a name="l1158"></a> {
<a name="l1159"></a> xx = (x -k - x0) * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>; </span><span class=cF2>//TODO: scrolling text is not length k</span><span class=cF0>
<a name="l1160"></a> yy = (y - y0) * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l1161"></a> zz = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1162"></a> }
<a name="l1163"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1164"></a> {
<a name="l1165"></a> xx = (x - x0) * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
<a name="l1166"></a> yy = (y - y0) * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l1167"></a> zz = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1168"></a> }
<a name="l1169"></a> </span><span class=cF1>if</span><span class=cF0> (ii &amp; </span><span class=cF7>(</span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>SPT_MESH</span><span class=cF0> | </span><span class=cFE>1</span><span class=cF0> &lt;&lt; </span><span class=cF3>SPT_SHIFTABLE_MESH</span><span class=cF7>)</span><span class=cF0>)
<a name="l1170"></a> {
<a name="l1171"></a> </span><span class=cF1>if</span><span class=cF0> (!depth_buf)
<a name="l1172"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1173"></a> </span><span class=cF5>DCDepthBufAlloc</span><span class=cF0>(dc);
<a name="l1174"></a> depth_buf = dc-&gt;depth_buf;
<a name="l1175"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1176"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1177"></a> dc-&gt;depth_buf = depth_buf;
<a name="l1178"></a> </span><span class=cF5>Mat4x4IdentEqu</span><span class=cF0>(dc-&gt;r);
<a name="l1179"></a> </span><span class=cF5>Mat4x4RotZ</span><span class=cF0>(dc-&gt;r, cur_time * </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>1</span><span class=cF0>);
<a name="l1180"></a> </span><span class=cF5>Mat4x4RotY</span><span class=cF0>(dc-&gt;r, cur_time * </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>9</span><span class=cF0>);
<a name="l1181"></a> </span><span class=cF5>Mat4x4RotX</span><span class=cF0>(dc-&gt;r, cur_time);
<a name="l1182"></a> dc-&gt;flags |= </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>;
<a name="l1183"></a> dc-&gt;x = xx;
<a name="l1184"></a> dc-&gt;y = yy;
<a name="l1185"></a> dc-&gt;z = </span><span class=cF3>GR_Z_ALL</span><span class=cF0>;
<a name="l1186"></a> xx = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1187"></a> yy = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1188"></a> zz = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1189"></a> }
<a name="l1190"></a> </span><span class=cF5>Sprite3</span><span class=cF0>(dc, xx, yy, zz, bptr);
<a name="l1191"></a> dc-&gt;depth_buf = </span><span class=cF3>NULL</span><span class=cF0>;
<a name="l1192"></a> dc-&gt;flags &amp;= ~(</span><span class=cF3>DCF_LOCATE_NEAREST</span><span class=cF0> | </span><span class=cF3>DCF_DONT_DRAW</span><span class=cF0> | </span><span class=cF3>DCF_TRANSFORMATION</span><span class=cF0>);
<a name="l1193"></a> </span><span class=cF1>if</span><span class=cF0> (dc-&gt;nearest_dist &lt;= D)
<a name="l1194"></a> {
<a name="l1195"></a> D = dc-&gt;nearest_dist;
<a name="l1196"></a> col = doc_e-&gt;min_col;
<a name="l1197"></a> }
<a name="l1198"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1199"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1200"></a>
<a name="l1201"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_SONG</span><span class=cF0>:
<a name="l1202"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFB>sys_focus_task</span><span class=cF0> == win_task &amp;&amp; recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp;
<a name="l1203"></a> !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_DONT_DRAW</span><span class=cF7>)</span><span class=cF0>)
<a name="l1204"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1205"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;aux_str &amp;&amp; </span><span class=cF7>(</span><span class=cF0>!</span><span class=cFB>music</span><span class=cF0>.cur_song || </span><span class=cF5>StrCompare</span><span class=cF0>(</span><span class=cFB>music</span><span class=cF0>.cur_song, doc_e-&gt;aux_str)</span><span class=cF7>)</span><span class=cF0>)
<a name="l1206"></a> {
<a name="l1207"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFB>music</span><span class=cF0>.cur_song);
<a name="l1208"></a> </span><span class=cF5>MusicSettingsReset</span><span class=cF0>;
<a name="l1209"></a> </span><span class=cFB>music</span><span class=cF0>.cur_song = </span><span class=cF5>SysStrNew</span><span class=cF0>(doc_e-&gt;aux_str);
<a name="l1210"></a> }
<a name="l1211"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1212"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_HAS_SONG</span><span class=cF0>;
<a name="l1213"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1214"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_HTML_CODE</span><span class=cF0>:
<a name="l1215"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCF_TO_HTML</span><span class=cF0> &amp;&amp; doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TAG</span><span class=cF0> &amp;&amp; doc_e-&gt;tag)
<a name="l1216"></a> x -= </span><span class=cF5>StrLen</span><span class=cF0>(doc_e-&gt;tag);
<a name="l1217"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1218"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_TYPES_NUM</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>: </span><span class=cF2>//nobound switch</span><span class=cF0>
<a name="l1219"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l1220"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1221"></a> }
<a name="l1222"></a>
<a name="l1223"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HAS_BORDER</span><span class=cF0>)
<a name="l1224"></a> </span><span class=cF5>TextBorder</span><span class=cF0>(win_task, doc_e-&gt;x - x0, x - x0 - </span><span class=cFE>1</span><span class=cF0>, doc_e-&gt;y - y0, y - y0,
<a name="l1225"></a> tmp_u32_attr.u8[</span><span class=cFE>1</span><span class=cF0>], </span><span class=cF5>ToBool</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_SOLID_BORDER</span><span class=cF7>)</span><span class=cF0>);
<a name="l1226"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l1227"></a> {
<a name="l1228"></a> </span><span class=cF1>switch</span><span class=cF0> (doc_e-&gt;type_u8)
<a name="l1229"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1230"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_CHECK_BOX</span><span class=cF0>:
<a name="l1231"></a> doc_e-&gt;max_col = </span><span class=cFE>2</span><span class=cF0>;
<a name="l1232"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1233"></a>
<a name="l1234"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_LIST</span><span class=cF0>:
<a name="l1235"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_TREE</span><span class=cF0>:
<a name="l1236"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_BTTN</span><span class=cF0>:
<a name="l1237"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_LINK</span><span class=cF0>:
<a name="l1238"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_MENU_VAL</span><span class=cF0>:
<a name="l1239"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>DOCT_MACRO</span><span class=cF0>:
<a name="l1240"></a> doc_e-&gt;max_col = </span><span class=cFE>1</span><span class=cF0>;
<a name="l1241"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1242"></a>
<a name="l1243"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l1244"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF7>(</span><span class=cF3>DOCEF_TREE</span><span class=cF0> | </span><span class=cF3>DOCEF_LIST</span><span class=cF7>)</span><span class=cF0>)
<a name="l1245"></a> doc_e-&gt;max_col = </span><span class=cFE>1</span><span class=cF0>;
<a name="l1246"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1247"></a> doc_e-&gt;max_col = col2;
<a name="l1248"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1249"></a>
<a name="l1250"></a> </span><span class=cF1>if</span><span class=cF0> (x &gt; doc-&gt;max_x)
<a name="l1251"></a> doc-&gt;max_x = x;
<a name="l1252"></a> </span><span class=cF1>if</span><span class=cF0> (y &gt; doc-&gt;max_y)
<a name="l1253"></a> doc-&gt;max_y = y;
<a name="l1254"></a> </span><span class=cF1>if</span><span class=cF0> (D &lt;= best_d &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_NO_CLICK_ON</span><span class=cF7>)</span><span class=cF0>)
<a name="l1255"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1256"></a> best_d = D;
<a name="l1257"></a> best_doc_e = doc_e;
<a name="l1258"></a> best_col = col;
<a name="l1259"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1260"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TREE</span><span class=cF0>)
<a name="l1261"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1262"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_CHECKED_COLLAPSED</span><span class=cF0>)
<a name="l1263"></a> tree_collapsed = </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1264"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1265"></a> tree_collapsed = </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l1266"></a> doc_e2 = doc_e-&gt;next;
<a name="l1267"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e2 != doc &amp;&amp; doc_e2-&gt;type_u8 != </span><span class=cF3>DOCT_INDENT</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e2-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TREE</span><span class=cF7>)</span><span class=cF0>)
<a name="l1268"></a> doc_e2 = doc_e2-&gt;next;
<a name="l1269"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;type_u8 == </span><span class=cF3>DOCT_INDENT</span><span class=cF0>)
<a name="l1270"></a> {
<a name="l1271"></a> j = i = s-&gt;indent;
<a name="l1272"></a> </span><span class=cF1>do</span><span class=cF0>
<a name="l1273"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1274"></a> </span><span class=cF1>if</span><span class=cF0> (tree_collapsed)
<a name="l1275"></a> doc_e2-&gt;de_flags |= </span><span class=cF3>DOCEF_SKIP</span><span class=cF0>;
<a name="l1276"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1277"></a> doc_e2-&gt;de_flags &amp;= ~</span><span class=cF3>DOCEF_SKIP</span><span class=cF0>;
<a name="l1278"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;type_u8 == </span><span class=cF3>DOCT_INDENT</span><span class=cF0>)
<a name="l1279"></a> {
<a name="l1280"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LEFT_X</span><span class=cF0>)
<a name="l1281"></a> j = doc_e2-&gt;attr;
<a name="l1282"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1283"></a> j += doc_e2-&gt;attr;
<a name="l1284"></a> }
<a name="l1285"></a> doc_e2 = doc_e2-&gt;next;
<a name="l1286"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1287"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e2 != doc &amp;&amp; j &gt; i);
<a name="l1288"></a> }
<a name="l1289"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1290"></a> }
<a name="l1291"></a>
<a name="l1292"></a> doc_e2 = doc_e-&gt;next;
<a name="l1293"></a>rc_skip:
<a name="l1294"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e2 != doc &amp;&amp; doc_e2-&gt;de_flags &amp; </span><span class=cF7>(</span><span class=cF3>DOCEF_SKIP</span><span class=cF0> | </span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF7>)</span><span class=cF0>)
<a name="l1295"></a> {
<a name="l1296"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e2 == doc-&gt;cur_entry)
<a name="l1297"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1298"></a> doc-&gt;cur_entry = doc_e2-&gt;next;
<a name="l1299"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l1300"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1301"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l1302"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1303"></a> doc_e2-&gt;x = x;
<a name="l1304"></a> doc_e2-&gt;y = y;
<a name="l1305"></a> doc_e2-&gt;page_line_num = doc-&gt;page_line_num;
<a name="l1306"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;doc_e2-&gt;settings, s, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
<a name="l1307"></a> doc_e2-&gt;type.u8[</span><span class=cFE>1</span><span class=cF0>] = cur_u8_attr;
<a name="l1308"></a> doc_e2-&gt;de_flags = doc-&gt;flags &amp;
<a name="l1309"></a> (</span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0>|</span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0> | </span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0>) |
<a name="l1310"></a> doc_e2-&gt;de_flags &amp; ~(</span><span class=cF3>DOCG_BL_IV_UL</span><span class=cF0> | </span><span class=cF3>DOCEF_WORD_WRAP</span><span class=cF0> | </span><span class=cF3>DOCEF_HIGHLIGHT</span><span class=cF0>);
<a name="l1311"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1312"></a> doc_e2 = doc_e2-&gt;next;
<a name="l1313"></a> }
<a name="l1314"></a>
<a name="l1315"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l1316"></a> {
<a name="l1317"></a> </span><span class=cF1>if</span><span class=cF0> (del_doc_e)
<a name="l1318"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1319"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; (</span><span class=cF3>DOCEF_HOLD</span><span class=cF0> | </span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
<a name="l1320"></a> {
<a name="l1321"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e == doc-&gt;cur_entry)
<a name="l1322"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1323"></a> doc-&gt;cur_entry = doc_e2;
<a name="l1324"></a> doc-&gt;cur_col = doc_e2-&gt;min_col;
<a name="l1325"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1326"></a> </span><span class=cF1>if</span><span class=cF0> (best_doc_e == doc_e)
<a name="l1327"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1328"></a> best_doc_e = doc_e2;
<a name="l1329"></a> best_col = doc_e2-&gt;min_col; </span><span class=cF2>//TODO: might be bug</span><span class=cF0>
<a name="l1330"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1331"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_e);
<a name="l1332"></a> }
<a name="l1333"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1334"></a> }
<a name="l1335"></a> num_entries++;
<a name="l1336"></a> </span><span class=cF1>if</span><span class=cF0> (!full_refresh &amp;&amp; doc_e-&gt;y &gt; y_plot_bottom)
<a name="l1337"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l1338"></a> doc_e = doc_e2;
<a name="l1339"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1340"></a>
<a name="l1341"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l1342"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1343"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry == doc &amp;&amp; recalc_flags &amp; </span><span class=cF3>RECALCF_ADD_CURSOR</span><span class=cF0>)
<a name="l1344"></a> {
<a name="l1345"></a> doc_e2 = </span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc, </span><span class=cF3>DOCT_CURSOR</span><span class=cF0>,, x, y, doc-&gt;page_line_num);
<a name="l1346"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;doc_e2-&gt;settings, s, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
<a name="l1347"></a> </span><span class=cF5>QueueInsertRev</span><span class=cF0>(doc_e2, doc);
<a name="l1348"></a> }
<a name="l1349"></a>
<a name="l1350"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;min_x &gt; doc-&gt;max_x)
<a name="l1351"></a> {
<a name="l1352"></a> doc-&gt;max_x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1353"></a> doc-&gt;min_x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1354"></a> }
<a name="l1355"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;min_y &gt; doc-&gt;max_y)
<a name="l1356"></a> {
<a name="l1357"></a> doc-&gt;max_y = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1358"></a> doc-&gt;min_y = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1359"></a> }
<a name="l1360"></a>
<a name="l1361"></a> </span><span class=cF2>//Update header</span><span class=cF0>
<a name="l1362"></a> </span><span class=cF1>if</span><span class=cF0> (!skipped_update)
<a name="l1363"></a> {
<a name="l1364"></a> doc_e-&gt;x = x;
<a name="l1365"></a> doc_e-&gt;y = y;
<a name="l1366"></a> doc_e-&gt;page_line_num = doc-&gt;page_line_num;
<a name="l1367"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&amp;doc_e-&gt;settings, s, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocSettings</span><span class=cF7>)</span><span class=cF0>);
<a name="l1368"></a> doc_e-&gt;type.u8[</span><span class=cFE>1</span><span class=cF0>] = cur_u8_attr;
<a name="l1369"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l1370"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1371"></a> D = </span><span class=cF5>DocCharDist</span><span class=cF0>(doc, x, y);
<a name="l1372"></a> </span><span class=cF1>if</span><span class=cF0> (D &lt; best_d &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc_e-&gt;de_flags &amp; </span><span class=cF3>DOCEF_NO_CLICK_ON</span><span class=cF7>)</span><span class=cF0>)
<a name="l1373"></a> {
<a name="l1374"></a> best_d = D;
<a name="l1375"></a> best_doc_e = doc_e;
<a name="l1376"></a> best_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1377"></a> }
<a name="l1378"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1379"></a> }
<a name="l1380"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_SIZE_MIN</span><span class=cF0>)
<a name="l1381"></a> {
<a name="l1382"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;win_task-&gt;display_flags, </span><span class=cF3>DISPLAYf_NO_BORDER</span><span class=cF7>)</span><span class=cF0>)
<a name="l1383"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1384"></a> </span><span class=cF1>if</span><span class=cF0> (left &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l1385"></a> left = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1386"></a> i = left + doc-&gt;max_x - doc-&gt;min_x;
<a name="l1387"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt; </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>)
<a name="l1388"></a> i = </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
<a name="l1389"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(left, i, win_task);
<a name="l1390"></a> </span><span class=cF1>if</span><span class=cF0> (top &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l1391"></a> top = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1392"></a> i = top + doc-&gt;max_y - doc-&gt;min_y;
<a name="l1393"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt; </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>)
<a name="l1394"></a> i = </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>;
<a name="l1395"></a> </span><span class=cF5>WinVert</span><span class=cF0>(top, i, win_task);
<a name="l1396"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1397"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1398"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1399"></a> </span><span class=cF1>if</span><span class=cF0> (left &lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l1400"></a> left = </span><span class=cFE>1</span><span class=cF0>;
<a name="l1401"></a> i = left + doc-&gt;max_x - doc-&gt;min_x;
<a name="l1402"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt; </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>)
<a name="l1403"></a> i = </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>;
<a name="l1404"></a> </span><span class=cF5>WinHorz</span><span class=cF0>(left, i, win_task);
<a name="l1405"></a> </span><span class=cF1>if</span><span class=cF0> (top &lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l1406"></a> top = </span><span class=cFE>1</span><span class=cF0>;
<a name="l1407"></a> i = top + doc-&gt;max_y - doc-&gt;min_y;
<a name="l1408"></a> </span><span class=cF1>if</span><span class=cF0> (i &gt; </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>)
<a name="l1409"></a> i = </span><span class=cF3>TEXT_ROWS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0>;
<a name="l1410"></a> </span><span class=cF5>WinVert</span><span class=cF0>(top, i, win_task);
<a name="l1411"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1412"></a> }
<a name="l1413"></a> </span><span class=cF1>if</span><span class=cF0> (find_cursor)
<a name="l1414"></a> {
<a name="l1415"></a> doc-&gt;cur_entry = best_doc_e;
<a name="l1416"></a> doc-&gt;cur_col = best_col;
<a name="l1417"></a> </span><span class=cF5>DocFormBwd</span><span class=cF0>(doc);
<a name="l1418"></a></span><span class=cF2>//We need this because text coordinates are used</span><span class=cF0>
<a name="l1419"></a> </span><span class=cF1>if</span><span class=cF0> (best_d &lt; </span><span class=cF3>FONT_WIDTH</span><span class=cF0>)
<a name="l1420"></a> best_d = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1421"></a> doc-&gt;best_d = best_d;
<a name="l1422"></a> }
<a name="l1423"></a>
<a name="l1424"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry-&gt;type_u8 != </span><span class=cF3>DOCT_HEX_ED</span><span class=cF0>)
<a name="l1425"></a> {
<a name="l1426"></a> doc-&gt;y = doc-&gt;cur_entry-&gt;y;
<a name="l1427"></a> doc-&gt;x = doc-&gt;cur_entry-&gt;x + doc-&gt;cur_col;
<a name="l1428"></a> }
<a name="l1429"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1430"></a> {
<a name="l1431"></a> doc-&gt;y = doc-&gt;cur_entry-&gt;y + doc-&gt;cur_col / </span><span class=cFE>3</span><span class=cF0> / doc-&gt;cur_entry-&gt;hex_ed_width;
<a name="l1432"></a> x = doc-&gt;cur_col % (doc-&gt;cur_entry-&gt;hex_ed_width * </span><span class=cFE>3</span><span class=cF0>);
<a name="l1433"></a> i = x / doc-&gt;cur_entry-&gt;hex_ed_width;
<a name="l1434"></a> doc-&gt;x = doc-&gt;cur_entry-&gt;x + </span><span class=cFE>9</span><span class=cF0>;
<a name="l1435"></a> </span><span class=cF1>if</span><span class=cF0> (i &lt; </span><span class=cFE>2</span><span class=cF0>)
<a name="l1436"></a> doc-&gt;x += x &gt;&gt; </span><span class=cFE>1</span><span class=cF0> * </span><span class=cFE>3</span><span class=cF0> + x &amp; </span><span class=cFE>1</span><span class=cF0>;
<a name="l1437"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1438"></a> doc-&gt;x += doc-&gt;cur_entry-&gt;hex_ed_width * </span><span class=cFE>3</span><span class=cF0> + (x - doc-&gt;cur_entry-&gt;hex_ed_width &lt;&lt; </span><span class=cFE>1</span><span class=cF0>);
<a name="l1439"></a> }
<a name="l1440"></a> doc-&gt;line = doc-&gt;y + </span><span class=cFE>1</span><span class=cF0>;
<a name="l1441"></a> doc-&gt;col = doc-&gt;x + </span><span class=cFE>1</span><span class=cF0>;
<a name="l1442"></a>
<a name="l1443"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCF_HAS_CURSOR</span><span class=cF0>)
<a name="l1444"></a> {
<a name="l1445"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0>)
<a name="l1446"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1447"></a> x = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1448"></a> y = </span><span class=cFE>0</span><span class=cF0>;
<a name="l1449"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1450"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1451"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1452"></a> x = scroll_x / </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
<a name="l1453"></a> y = scroll_y / </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l1454"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1455"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;top_line_num - y + height - </span><span class=cFE>1</span><span class=cF0> &gt; doc-&gt;max_y)
<a name="l1456"></a> doc-&gt;top_line_num = doc-&gt;max_y - (height - </span><span class=cFE>1</span><span class=cF0>) + y;
<a name="l1457"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;top_line_num - y &lt; doc-&gt;min_y)
<a name="l1458"></a> doc-&gt;top_line_num = doc-&gt;min_y + y;
<a name="l1459"></a>
<a name="l1460"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;y - doc-&gt;top_line_num + y &gt; height - </span><span class=cFE>1</span><span class=cF0>)
<a name="l1461"></a> doc-&gt;top_line_num = doc-&gt;y - (height - </span><span class=cFE>1</span><span class=cF0>) + y;
<a name="l1462"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;y - doc-&gt;top_line_num + y &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l1463"></a> doc-&gt;top_line_num = doc-&gt;y + y;
<a name="l1464"></a>
<a name="l1465"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;line_start_col - x + width - </span><span class=cFE>1</span><span class=cF0> &gt; doc-&gt;max_x)
<a name="l1466"></a> doc-&gt;line_start_col = doc-&gt;max_x - (width - </span><span class=cFE>1</span><span class=cF0>) + x;
<a name="l1467"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;line_start_col - x &lt; doc-&gt;min_x)
<a name="l1468"></a> doc-&gt;line_start_col = doc-&gt;min_x + x;
<a name="l1469"></a>
<a name="l1470"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;x - doc-&gt;line_start_col + x &gt; width - </span><span class=cFE>1</span><span class=cF0>)
<a name="l1471"></a> doc-&gt;line_start_col = doc-&gt;x-(width - </span><span class=cFE>1</span><span class=cF0>) + x;
<a name="l1472"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;x - doc-&gt;line_start_col + x &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l1473"></a> doc-&gt;line_start_col = doc-&gt;x + x;
<a name="l1474"></a> }
<a name="l1475"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1476"></a> </span><span class=cF1>if</span><span class=cF0> (recalc_flags &amp; </span><span class=cF3>RECALCG_MASK</span><span class=cF0> == </span><span class=cF3>RECALCt_TO_SCREEN</span><span class=cF0> &amp;&amp; recalc_flags &amp; </span><span class=cF3>RECALCF_HAS_CURSOR</span><span class=cF0>)
<a name="l1477"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1478"></a> x = doc-&gt;x - doc-&gt;line_start_col + left + scroll_x / </span><span class=cF3>FONT_WIDTH</span><span class=cF0>;
<a name="l1479"></a> y = doc-&gt;y - doc-&gt;top_line_num + top + scroll_y / </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>;
<a name="l1480"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cFE>0</span><span class=cF0> &lt;= x &lt;= right &amp;&amp; </span><span class=cFE>0</span><span class=cF0> &lt;= y &lt;= bottom &amp;&amp; x &lt; </span><span class=cF3>TEXT_COLS</span><span class=cF0> &amp;&amp; y &lt; </span><span class=cF3>TEXT_ROWS</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>doc-&gt;flags &amp; </span><span class=cF3>DOCF_HIDE_CURSOR</span><span class=cF7>)</span><span class=cF0>)
<a name="l1481"></a> {
<a name="l1482"></a> u32_ptr = </span><span class=cFB>gr</span><span class=cF0>.text_base + y * </span><span class=cF3>TEXT_COLS</span><span class=cF0> + x;
<a name="l1483"></a> *u32_ptr |= </span><span class=cF3>DOCET_BLINK</span><span class=cF0>;
<a name="l1484"></a> *u32_ptr ^= </span><span class=cFE>0xFF00</span><span class=cF0>;
<a name="l1485"></a> }
<a name="l1486"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l1487"></a> {
<a name="l1488"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc-&gt;flags &amp; </span><span class=cF3>DOCF_NO_SCROLL_BARS</span><span class=cF7>)</span><span class=cF0>)
<a name="l1489"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1490"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;hss-&gt;flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF7>)</span><span class=cF0>)
<a name="l1491"></a> {
<a name="l1492"></a> hss-&gt;min = doc-&gt;min_x;
<a name="l1493"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;max_x - width + </span><span class=cFE>1</span><span class=cF0> &lt; hss-&gt;min)
<a name="l1494"></a> hss-&gt;max = hss-&gt;min;
<a name="l1495"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1496"></a> hss-&gt;max = doc-&gt;max_x - width + </span><span class=cFE>1</span><span class=cF0>;
<a name="l1497"></a> hss-&gt;pos = doc-&gt;line_start_col;
<a name="l1498"></a> }
<a name="l1499"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&amp;vss-&gt;flags, </span><span class=cF3>WSSf_SET_TO_POS</span><span class=cF7>)</span><span class=cF0>)
<a name="l1500"></a> {
<a name="l1501"></a> vss-&gt;min = doc-&gt;min_y;
<a name="l1502"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;max_y - height + </span><span class=cFE>1</span><span class=cF0> &lt; vss-&gt;min)
<a name="l1503"></a> vss-&gt;max = vss-&gt;min;
<a name="l1504"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l1505"></a> vss-&gt;max = doc-&gt;max_y - height + </span><span class=cFE>1</span><span class=cF0>;
<a name="l1506"></a> vss-&gt;pos = doc-&gt;top_line_num;
<a name="l1507"></a> }
<a name="l1508"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1509"></a> </span><span class=cF5>LBEqual</span><span class=cF0>(&amp;doc-&gt;flags, </span><span class=cF3>DOCf_MORE</span><span class=cF0>, more);
<a name="l1510"></a> }
<a name="l1511"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1512"></a> </span><span class=cF1>if</span><span class=cF0> (!same_win)
<a name="l1513"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1514"></a> doc-&gt;old_win_top = top;
<a name="l1515"></a> doc-&gt;old_win_bottom = bottom;
<a name="l1516"></a> doc-&gt;old_win_left = left;
<a name="l1517"></a> doc-&gt;old_win_right = right;
<a name="l1518"></a> doc-&gt;old_cur_entry = doc-&gt;cur_entry;
<a name="l1519"></a> doc-&gt;old_cur_col = doc-&gt;old_cur_col;
<a name="l1520"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1521"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_HAS_SONG</span><span class=cF0>)
<a name="l1522"></a> </span><span class=cF5>LBts</span><span class=cF0>(&amp;win_task-&gt;task_flags, </span><span class=cF3>TASKf_HAS_SONG</span><span class=cF0>);
<a name="l1523"></a> </span><span class=cF1>if</span><span class=cF0> (full_refresh)
<a name="l1524"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l1525"></a> i = num_entries - doc-&gt;max_entries;
<a name="l1526"></a> </span><span class=cF1>if</span><span class=cF0> (next_clear_found)
<a name="l1527"></a> {
<a name="l1528"></a> </span><span class=cF5>DocDelToEntry</span><span class=cF0>(doc, next_clear_found, clear_holds);
<a name="l1529"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc, recalc_flags);
<a name="l1530"></a> }
<a name="l1531"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i &gt; </span><span class=cFE>1024</span><span class=cF0>)
<a name="l1532"></a> {
<a name="l1533"></a> </span><span class=cF5>DocDelToNum</span><span class=cF0>(doc, i);
<a name="l1534"></a> </span><span class=cF5>DocRecalc</span><span class=cF0>(doc, recalc_flags);
<a name="l1535"></a> }
<a name="l1536"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l1537"></a> </span><span class=cF5>DCDel</span><span class=cF0>(dc);
<a name="l1538"></a> </span><span class=cF5>Free</span><span class=cF0>(depth_buf);
<a name="l1539"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l1540"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l1541"></a>
<a name="l1542"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l1543"></a>}
</span></pre></body>
</html>