ZealOS/docs/System/DolDoc/DocChar.CC

804 lines
82 KiB
HolyC
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V0.05">
<style type="text/css">
body {background-color:#000000;}
.cF0{color:#ffffff;background-color:#000000;}
.cF1{color:#3465a4;background-color:#000000;}
.cF2{color:#4e9a06;background-color:#000000;}
.cF3{color:#06989a;background-color:#000000;}
.cF4{color:#a24444;background-color:#000000;}
.cF5{color:#75507b;background-color:#000000;}
.cF6{color:#ce982f;background-color:#000000;}
.cF7{color:#bcc0b9;background-color:#000000;}
.cF8{color:#555753;background-color:#000000;}
.cF9{color:#729fcf;background-color:#000000;}
.cFA{color:#82bc49;background-color:#000000;}
.cFB{color:#34e2e2;background-color:#000000;}
.cFC{color:#ac3535;background-color:#000000;}
.cFD{color:#ad7fa8;background-color:#000000;}
.cFE{color:#fce94f;background-color:#000000;}
.cFF{color:#000000;background-color:#000000;}
</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/Editor&quot;</span><span class=cF0>
<a name="l2"></a>
<a name="l3"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>EdCurU8</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l4"></a>{</span><span class=cF2>//Return cur U8. See </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocCodeTools.html#l454"><span class=cF4>EdRenumAsm</span></a><span class=cF2> for an example.</span><span class=cF0>
<a name="l5"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l6"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry;
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> res = -</span><span class=cFE>1</span><span class=cF0>;
<a name="l8"></a>
<a name="l9"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_TEXT</span><span class=cF0> &amp;&amp; doc_ce-&gt;min_col &lt;= doc-&gt;cur_col &lt; doc_ce-&gt;max_col)
<a name="l10"></a> res = doc_ce-&gt;tag[doc-&gt;cur_col];
<a name="l11"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_TAB</span><span class=cF0>)
<a name="l12"></a> res = </span><span class=cF6>'\t'</span><span class=cF0>;
<a name="l13"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> || doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0>)
<a name="l14"></a> res = </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l15"></a>
<a name="l16"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l17"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l18"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l19"></a>}
<a name="l20"></a>
<a name="l21"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdCursorLeft</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> sc=</span><span class=cF3>I64_MIN</span><span class=cF0>)
<a name="l22"></a>{</span><span class=cF2>//Move cursor left. Might need a call to </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocRecalc.html#l305"><span class=cF4>DocRecalc</span></a><span class=cF2>().</span><span class=cF0>
<a name="l23"></a></span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocCodeTools.html#l454"><span class=cF4>EdRenumAsm</span></a><span class=cF2> for an example.</span><span class=cF0>
<a name="l24"></a> </span><span class=cF1>U8</span><span class=cF0> *dst;
<a name="l25"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l26"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry, *original_ce = doc_ce, *doc_ne;
<a name="l27"></a> </span><span class=cF9>I64</span><span class=cF0> cc = doc-&gt;cur_col, y = doc_ce-&gt;y;
<a name="l28"></a>
<a name="l29"></a> </span><span class=cF1>if</span><span class=cF0> (sc != </span><span class=cF3>I64_MIN</span><span class=cF0>)
<a name="l30"></a> sc = sc.u32[</span><span class=cFE>0</span><span class=cF0>];
<a name="l31"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0> &amp;&amp; sc &amp; </span><span class=cF3>SCF_CTRL</span><span class=cF0>)
<a name="l32"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l33"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce-&gt;last != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;last-&gt;y == y || doc_ce-&gt;de_flags &amp; (</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>)
<a name="l34"></a> doc_ce = doc_ce-&gt;last; </span><span class=cF2>//TODO: sel? recurse?</span><span class=cF0>
<a name="l35"></a> cc = doc_ce-&gt;min_col;
<a name="l36"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l37"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l38"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (cc &gt; doc_ce-&gt;min_col)
<a name="l40"></a> {
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0> &amp;&amp; cc &lt; doc_ce-&gt;max_col)
<a name="l42"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l43"></a> dst = doc_ce-&gt;tag + cc;
<a name="l44"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l45"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l46"></a> doc_ce-&gt;max_col = cc;
<a name="l47"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l48"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l49"></a> cc--;
<a name="l50"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0> &amp;&amp; cc &gt; doc_ce-&gt;min_col)
<a name="l51"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l52"></a> dst = doc_ce-&gt;tag + cc;
<a name="l53"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l54"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l55"></a> doc_ce-&gt;max_col = cc;
<a name="l56"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l57"></a> doc_ce = doc_ne;
<a name="l58"></a> cc = doc_ce-&gt;min_col;
<a name="l59"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l60"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l61"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l62"></a> }
<a name="l63"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l64"></a> {
<a name="l65"></a> cc = doc_ce-&gt;min_col;
<a name="l66"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce-&gt;last != doc &amp;&amp;
<a name="l67"></a> </span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;last-&gt;type_u8 == </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0> ||
<a name="l68"></a> doc_ce-&gt;last-&gt;type_u8 == </span><span class=cF3>DOCT_INDENT</span><span class=cF0> ||
<a name="l69"></a> doc_ce-&gt;last-&gt;de_flags &amp; (</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>)
<a name="l70"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l71"></a> doc_ce = doc_ce-&gt;last;
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l73"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;last != doc)
<a name="l76"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l77"></a> doc_ce = doc_ce-&gt;last;
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;max_col &gt; doc_ce-&gt;min_col)
<a name="l79"></a> {
<a name="l80"></a> cc = doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0> &amp;&amp; cc &gt; doc_ce-&gt;min_col)
<a name="l82"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l83"></a> dst = doc_ce-&gt;tag + cc;
<a name="l84"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l85"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l86"></a> doc_ce-&gt;max_col = cc;
<a name="l87"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l88"></a> doc_ce = doc_ne;
<a name="l89"></a> cc = doc_ce-&gt;min_col;
<a name="l90"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l91"></a> }
<a name="l92"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l93"></a> cc = doc_ce-&gt;max_col;
<a name="l94"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l95"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l96"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l97"></a> }
<a name="l98"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l99"></a> doc-&gt;cur_col = cc;
<a name="l100"></a> doc-&gt;cur_entry = doc_ce;
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce != original_ce)
<a name="l102"></a> </span><span class=cF5>DocFormBwd</span><span class=cF0>(doc);
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l104"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l105"></a>}
<a name="l106"></a>
<a name="l107"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdCursorRight</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> sc=</span><span class=cF3>I64_MIN</span><span class=cF0>)
<a name="l108"></a>{</span><span class=cF2>//Move cursor right. Might need a call to </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocRecalc.html#l305"><span class=cF4>DocRecalc</span></a><span class=cF2>().</span><span class=cF0>
<a name="l109"></a></span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocCodeTools.html#l454"><span class=cF4>EdRenumAsm</span></a><span class=cF2> for an example.</span><span class=cF0>
<a name="l110"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l111"></a> </span><span class=cF1>U8</span><span class=cF0> *dst;
<a name="l112"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry, *original_ce = doc_ce, *doc_ne;
<a name="l113"></a> </span><span class=cF9>I64</span><span class=cF0> cc = doc-&gt;cur_col, y = doc_ce-&gt;y, old_de_flags, old_color;
<a name="l114"></a>
<a name="l115"></a> </span><span class=cF1>if</span><span class=cF0> (sc != </span><span class=cF3>I64_MIN</span><span class=cF0>)
<a name="l116"></a> sc = sc.u32[</span><span class=cFE>0</span><span class=cF0>];
<a name="l117"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0> &amp;&amp; sc &amp; </span><span class=cF3>SCF_CTRL</span><span class=cF0>)
<a name="l118"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l119"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc &amp;&amp; doc_ce-&gt;next-&gt;y == y &amp;&amp;
<a name="l120"></a> doc_ce-&gt;next-&gt;type_u8 != </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0> &amp;&amp; doc_ce-&gt;next != doc &amp;&amp;
<a name="l121"></a> </span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;next-&gt;type_u8 != </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> || !(doc-&gt;flags &amp; </span><span class=cF3>DOCF_FORM</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> ||
<a name="l122"></a> doc_ce-&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="l123"></a> doc_ce = doc_ce-&gt;next;
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;max_col &gt; doc_ce-&gt;min_col)
<a name="l125"></a> cc = doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l126"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l127"></a> cc = doc_ce-&gt;min_col;
<a name="l128"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l129"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l130"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (cc &lt; doc_ce-&gt;max_col)
<a name="l132"></a> {
<a name="l133"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0> &amp;&amp; cc &gt; doc_ce-&gt;min_col)
<a name="l134"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l135"></a> dst = doc_ce-&gt;tag + cc;
<a name="l136"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l137"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l138"></a> doc_ce-&gt;max_col = cc;
<a name="l139"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l140"></a> doc_ce = doc_ne;
<a name="l141"></a> cc = doc_ce-&gt;min_col;
<a name="l142"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l143"></a> cc++;
<a name="l144"></a> old_de_flags = doc_ce-&gt;de_flags;
<a name="l145"></a> old_color = doc_ce-&gt;type;
<a name="l146"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l147"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l148"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0> &amp;&amp; cc &lt; doc_ce-&gt;max_col)
<a name="l149"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l150"></a> dst = doc_ce-&gt;tag+cc;
<a name="l151"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l152"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l153"></a> doc_ne-&gt;type = </span><span class=cF3>DOCT_TEXT</span><span class=cF0> | old_color &amp; -</span><span class=cFE>0x100</span><span class=cF0>;
<a name="l154"></a> doc_ne-&gt;de_flags = old_de_flags | </span><span class=cFB>doldoc</span><span class=cF0>.default_de_flags[</span><span class=cF3>DOCT_TEXT</span><span class=cF0>];
<a name="l155"></a> doc_ce-&gt;max_col = cc;
<a name="l156"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l157"></a> doc_ce = doc_ne;
<a name="l158"></a> cc = doc_ce-&gt;min_col;
<a name="l159"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l160"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (cc &gt;= doc_ce-&gt;max_col)
<a name="l161"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l162"></a> doc_ce = doc_ce-&gt;next;
<a name="l163"></a> cc = doc_ce-&gt;min_col;
<a name="l164"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l165"></a> }
<a name="l166"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l167"></a> {
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce != doc)
<a name="l169"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (cc &lt;= doc_ce-&gt;min_col &amp;&amp; sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l171"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l172"></a> doc_ce = doc_ce-&gt;next;
<a name="l173"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc &amp;&amp; doc_ce-&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="l174"></a> {
<a name="l175"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l176"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l177"></a> doc_ce = doc_ce-&gt;next;
<a name="l178"></a> }
<a name="l179"></a> cc = doc_ce-&gt;min_col;
<a name="l180"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0>)
<a name="l181"></a> {
<a name="l182"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l183"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l184"></a> doc_ce = doc_ce-&gt;next;
<a name="l185"></a> cc = doc_ce-&gt;min_col;
<a name="l186"></a> }
<a name="l187"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l188"></a> }
<a name="l189"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l190"></a> doc-&gt;cur_col = cc;
<a name="l191"></a> doc-&gt;cur_entry = doc_ce;
<a name="l192"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce != original_ce)
<a name="l193"></a> </span><span class=cF5>DocFormFwd</span><span class=cF0>(doc);
<a name="l194"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l195"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l196"></a>}
<a name="l197"></a>
<a name="l198"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdLineUp</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> sc=</span><span class=cF3>I64_MIN</span><span class=cF0>)
<a name="l199"></a>{</span><span class=cF2>//Move cursor up. Might need a call to </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocRecalc.html#l305"><span class=cF4>DocRecalc</span></a><span class=cF2>().</span><span class=cF0>
<a name="l200"></a></span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocCodeTools.html#l454"><span class=cF4>EdRenumAsm</span></a><span class=cF2> for an example.</span><span class=cF0>
<a name="l201"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l202"></a> </span><span class=cF1>U8</span><span class=cF0> *dst;
<a name="l203"></a> </span><span class=cF9>I64</span><span class=cF0> y, x;
<a name="l204"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry, *doc_ne;
<a name="l205"></a>
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (sc != </span><span class=cF3>I64_MIN</span><span class=cF0>)
<a name="l207"></a> sc = sc.u32[</span><span class=cFE>0</span><span class=cF0>];
<a name="l208"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_HEX_ED</span><span class=cF0>)
<a name="l209"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l210"></a> doc-&gt;cur_col = doc-&gt;cur_col - doc_ce-&gt;hex_ed_width * </span><span class=cFE>3</span><span class=cF0>;
<a name="l211"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l212"></a> {
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l214"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l215"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l216"></a> }
<a name="l217"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l218"></a> doc-&gt;cur_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l219"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l220"></a> x = doc-&gt;x;
<a name="l221"></a> y = doc-&gt;y;
<a name="l222"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0>)
<a name="l223"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l224"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;min_col &lt; doc-&gt;cur_col &lt; doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>)
<a name="l225"></a> {
<a name="l226"></a> dst = doc_ce-&gt;tag + doc-&gt;cur_col;
<a name="l227"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l228"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l229"></a> doc_ne-&gt;x = doc_ce-&gt;x + doc-&gt;cur_col;
<a name="l230"></a> doc_ce-&gt;max_col = doc-&gt;cur_col;
<a name="l231"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l232"></a> }
<a name="l233"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col == doc_ce-&gt;min_col &amp;&amp; doc_ce-&gt;last != doc)
<a name="l234"></a> doc_ce = doc_ce-&gt;last;
<a name="l235"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l236"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;last != doc)
<a name="l237"></a> doc_ce = doc_ce-&gt;last;
<a name="l238"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l239"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l240"></a> doc-&gt;cur_entry = doc_ce;
<a name="l241"></a> </span><span class=cF5>DocFormBwd</span><span class=cF0>(doc);
<a name="l242"></a> doc_ce = doc-&gt;cur_entry;
<a name="l243"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce-&gt;last != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;y &gt;= y || doc_ce-&gt;de_flags &amp; (</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>)
<a name="l244"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l245"></a> doc_ce = doc_ce-&gt;last;
<a name="l246"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l247"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l248"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l249"></a> y = doc_ce-&gt;y;
<a name="l250"></a> doc-&gt;y = y;
<a name="l251"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;y &gt;= y &amp;&amp; doc_ce-&gt;x &gt;= x || doc_ce-&gt;de_flags &amp; (</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>)
<a name="l252"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l253"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l254"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l255"></a> doc_ce= doc_ce-&gt;last;
<a name="l256"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l257"></a>
<a name="l258"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce == doc || doc_ce-&gt;y &lt; y)
<a name="l259"></a> doc_ce = doc_ce-&gt;next;
<a name="l260"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l261"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l262"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0>)
<a name="l263"></a> {
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l265"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l266"></a> }
<a name="l267"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l268"></a> {
<a name="l269"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;next-&gt;x == x)
<a name="l270"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l271"></a> doc_ce = doc_ce-&gt;next;
<a name="l272"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_FORM</span><span class=cF0>)
<a name="l273"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce-&gt;next-&gt;x == x &amp;&amp;
<a name="l274"></a> </span><span class=cF7>(</span><span class=cF0>!</span><span class=cF5>Bt</span><span class=cF0>(</span><span class=cFB>doldoc</span><span class=cF0>.type_flags_form, doc_ce-&gt;type_u8) &amp;&amp;
<a name="l275"></a> !(doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LINK</span><span class=cF0>) ||
<a name="l276"></a> doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_SKIP_IN_FORM</span><span class=cF7>)</span><span class=cF0>)
<a name="l277"></a> doc_ce = doc_ce-&gt;next;
<a name="l278"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l279"></a> }
<a name="l280"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l281"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TAG</span><span class=cF0>)
<a name="l282"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l283"></a> doc-&gt;cur_col = x-doc_ce-&gt;x;
<a name="l284"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0>)
<a name="l285"></a> {
<a name="l286"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt; doc_ce-&gt;max_col)
<a name="l287"></a> doc-&gt;cur_col = doc_ce-&gt;max_col;
<a name="l288"></a> }
<a name="l289"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt;= doc_ce-&gt;max_col)
<a name="l290"></a> doc-&gt;cur_col = doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l291"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt; doc_ce-&gt;min_col)
<a name="l292"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l293"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l294"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l295"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l296"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_HEX_ED</span><span class=cF0>)
<a name="l297"></a> {
<a name="l298"></a> doc-&gt;cur_col = </span><span class=cF5>RoundI64</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;len - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * </span><span class=cFE>3</span><span class=cF0>, doc_ce-&gt;hex_ed_width * </span><span class=cFE>3</span><span class=cF0>);
<a name="l299"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l300"></a> doc-&gt;cur_col = </span><span class=cFE>0</span><span class=cF0>;
<a name="l301"></a> }
<a name="l302"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l303"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l304"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l305"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0> &amp;&amp; doc_ce-&gt;x &lt; x)
<a name="l306"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l307"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt; doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>)
<a name="l308"></a> {
<a name="l309"></a> dst = doc_ce-&gt;tag + doc-&gt;cur_col;
<a name="l310"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l311"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l313"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l314"></a> </span><span class=cF1>if</span><span class=cF0> (sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l315"></a> doc_ne-&gt;type = doc_ce-&gt;type | </span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l316"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l317"></a> doc_ne-&gt;type = doc_ce-&gt;type &amp; ~</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l318"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l319"></a> doc_ne-&gt;x = doc_ce-&gt;x + doc-&gt;cur_col;
<a name="l320"></a> doc_ce-&gt;max_col = doc-&gt;cur_col;
<a name="l321"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l322"></a> doc_ce = doc_ne;
<a name="l323"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l324"></a> }
<a name="l325"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l326"></a> doc-&gt;cur_entry = doc_ce;
<a name="l327"></a> </span><span class=cF5>DocFormFwd</span><span class=cF0>(doc);
<a name="l328"></a> doc-&gt;x = doc-&gt;cur_entry-&gt;x + doc-&gt;cur_col;
<a name="l329"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l330"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l331"></a>}
<a name="l332"></a>
<a name="l333"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdLineDown</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc, </span><span class=cF9>I64</span><span class=cF0> sc=</span><span class=cF3>I64_MIN</span><span class=cF0>)
<a name="l334"></a>{</span><span class=cF2>//Move cursor down. Might need a call to </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocRecalc.html#l305"><span class=cF4>DocRecalc</span></a><span class=cF2>().</span><span class=cF0>
<a name="l335"></a></span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocCodeTools.html#l454"><span class=cF4>EdRenumAsm</span></a><span class=cF2> for an example.</span><span class=cF0>
<a name="l336"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l337"></a> </span><span class=cF1>U8</span><span class=cF0> *dst;
<a name="l338"></a> </span><span class=cF9>I64</span><span class=cF0> y, x, old_de_flags = </span><span class=cFE>0</span><span class=cF0>, old_color;
<a name="l339"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry, *doc_ne, *doc_ce2;
<a name="l340"></a>
<a name="l341"></a> </span><span class=cF1>if</span><span class=cF0> (sc != </span><span class=cF3>I64_MIN</span><span class=cF0>)
<a name="l342"></a> sc = sc.u32[</span><span class=cFE>0</span><span class=cF0>];
<a name="l343"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_HEX_ED</span><span class=cF0>)
<a name="l344"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l345"></a> doc-&gt;cur_col = doc-&gt;cur_col + doc_ce-&gt;hex_ed_width * </span><span class=cFE>3</span><span class=cF0>;
<a name="l346"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt;= doc_ce-&gt;len * </span><span class=cFE>3</span><span class=cF0>)
<a name="l347"></a> {
<a name="l348"></a> doc-&gt;cur_entry = doc_ce = doc_ce-&gt;next;
<a name="l349"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l350"></a> doc-&gt;x = doc_ce-&gt;x + doc-&gt;cur_col;
<a name="l351"></a> doc-&gt;y = doc_ce-&gt;y;
<a name="l352"></a> }
<a name="l353"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l354"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l355"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l356"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l357"></a> x = doc-&gt;x;
<a name="l358"></a> y = doc-&gt;y;
<a name="l359"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0>)
<a name="l360"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l361"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt; doc_ce-&gt;min_col &amp;&amp; doc-&gt;cur_col &lt; doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>)
<a name="l362"></a> {
<a name="l363"></a> dst = doc_ce-&gt;tag + doc-&gt;cur_col;
<a name="l364"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l365"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l366"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l367"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l368"></a> </span><span class=cF1>if</span><span class=cF0> (sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)
<a name="l369"></a> doc_ne-&gt;type = doc_ce-&gt;type | </span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l370"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l371"></a> doc_ne-&gt;type = doc_ce-&gt;type &amp; ~</span><span class=cF3>DOCET_SEL</span><span class=cF0>;
<a name="l372"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l373"></a> doc_ne-&gt;x = doc_ce-&gt;x + doc-&gt;cur_col;
<a name="l374"></a> doc_ce-&gt;max_col = doc-&gt;cur_col;
<a name="l375"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l376"></a> doc_ce = doc_ne;
<a name="l377"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l378"></a> }
<a name="l379"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l380"></a> doc_ce2 = doc_ce;
<a name="l381"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;y &lt;= y || doc_ce-&gt;de_flags &amp; (</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>)
<a name="l382"></a> doc_ce = doc_ce-&gt;next;
<a name="l383"></a> y = doc_ce-&gt;y;
<a name="l384"></a> doc-&gt;y = y;
<a name="l385"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;y &lt;= y &amp;&amp; doc_ce-&gt;x &lt;= x || doc_ce-&gt;de_flags &amp; (</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>)
<a name="l386"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l387"></a> old_de_flags = doc_ce-&gt;de_flags;
<a name="l388"></a> old_color = doc_ce-&gt;type;
<a name="l389"></a> doc_ce = doc_ce-&gt;next;
<a name="l390"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l391"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;last != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;x &gt; x &amp;&amp; doc_ce-&gt;last-&gt;y &gt;= y || doc_ce-&gt;y &gt; y</span><span class=cF7>)</span><span class=cF0>)
<a name="l392"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l393"></a> doc_ce = doc_ce-&gt;last;
<a name="l394"></a> doc-&gt;cur_entry = doc_ce;
<a name="l395"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>(doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> ||
<a name="l396"></a> doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0> ||
<a name="l397"></a> doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_INDENT</span><span class=cF0>) &amp;&amp;
<a name="l398"></a> (doc_ce-&gt;last-&gt;type_u8 == </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> ||
<a name="l399"></a> doc_ce-&gt;last-&gt;type_u8 == </span><span class=cF3>DOCT_SOFT_NEW_LINE</span><span class=cF0> ||
<a name="l400"></a> doc_ce-&gt;last-&gt;type_u8 == </span><span class=cF3>DOCT_INDENT</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
<a name="l401"></a> </span><span class=cF5>DocFormBwd</span><span class=cF0>(doc);
<a name="l402"></a> doc_ce = doc-&gt;cur_entry;
<a name="l403"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l404"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce2 != doc &amp;&amp; </span><span class=cF7>(</span><span class=cF0>doc_ce2 != doc_ce || </span><span class=cF5>IsEditableText</span><span class=cF0>(doc_ce)</span><span class=cF7>)</span><span class=cF0>)
<a name="l405"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l406"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>doc_ce2-&gt;y &lt; y || doc_ce2-&gt;x &lt; x ||
<a name="l407"></a> doc_ce2-&gt;de_flags &amp; (</span><span class=cF3>DOCEF_SKIP</span><span class=cF0> | </span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF0>) ||
<a name="l408"></a> doc_ce2-&gt;x == x &amp;&amp; !doc_ce2-&gt;max_col &amp;&amp;
<a name="l409"></a> </span><span class=cF5>Bt</span><span class=cF0>(</span><span class=cFB>doldoc</span><span class=cF0>.type_flags_nontag_invis, doc_ce2-&gt;type_u8)</span><span class=cF7>)</span><span class=cF0>
<a name="l410"></a> &amp;&amp; sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l411"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce2-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l412"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce2 == doc_ce)
<a name="l413"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l414"></a> doc_ce2 = doc_ce2-&gt;next;
<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> (doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_TAG</span><span class=cF0>)
<a name="l417"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l418"></a> doc-&gt;cur_col = x - doc_ce-&gt;x;
<a name="l419"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0>)
<a name="l420"></a> {
<a name="l421"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt; doc_ce-&gt;max_col)
<a name="l422"></a> doc-&gt;cur_col = doc_ce-&gt;max_col;
<a name="l423"></a> }
<a name="l424"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt;= doc_ce-&gt;max_col)
<a name="l425"></a> doc-&gt;cur_col = doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>;
<a name="l426"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt; doc_ce-&gt;min_col)
<a name="l427"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l428"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l429"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l430"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l431"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0> &amp;&amp; doc_ce-&gt;min_col &lt; doc-&gt;cur_col &lt; doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>)
<a name="l432"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l433"></a> dst = doc_ce-&gt;tag + doc-&gt;cur_col;
<a name="l434"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, dst);
<a name="l435"></a> *dst = </span><span class=cFE>0</span><span class=cF0>;
<a name="l436"></a> doc_ne-&gt;type = </span><span class=cF3>DOCT_TEXT</span><span class=cF0> | old_color &amp; -</span><span class=cFE>0x100</span><span class=cF0>;
<a name="l437"></a> doc_ne-&gt;de_flags = old_de_flags | </span><span class=cFB>doldoc</span><span class=cF0>.default_de_flags[</span><span class=cF3>DOCT_TEXT</span><span class=cF0>];
<a name="l438"></a> doc_ce-&gt;max_col = doc-&gt;cur_col;
<a name="l439"></a> doc_ne-&gt;x = doc_ce-&gt;x + doc-&gt;cur_col;
<a name="l440"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce);
<a name="l441"></a> doc_ce = doc_ne;
<a name="l442"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l443"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l444"></a> doc-&gt;cur_entry = doc_ce;
<a name="l445"></a> </span><span class=cF5>DocFormFwd</span><span class=cF0>(doc);
<a name="l446"></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_FORM</span><span class=cF7>)</span><span class=cF0>)
<a name="l447"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc &amp;&amp; doc_ce != doc-&gt;cur_entry)
<a name="l448"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l449"></a> </span><span class=cF1>if</span><span class=cF0> (sc &gt;= </span><span class=cFE>0</span><span class=cF0>)
<a name="l450"></a> </span><span class=cF5>BEqual</span><span class=cF0>(&amp;doc_ce-&gt;type, </span><span class=cF3>DOCEt_SEL</span><span class=cF0>, sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF0>);
<a name="l451"></a> doc_ce = doc_ce-&gt;next;
<a name="l452"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l453"></a> doc-&gt;x = doc-&gt;cur_entry-&gt;x + doc-&gt;cur_col;
<a name="l454"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l455"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l456"></a>}
<a name="l457"></a>
<a name="l458"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdCharDel</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l459"></a>{
<a name="l460"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l461"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry;
<a name="l462"></a>
<a name="l463"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce == doc)
<a name="l464"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l465"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l466"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l467"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l468"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l469"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;max_col != </span><span class=cFE>0</span><span class=cF0> &amp;&amp; </span><span class=cF7>(</span><span class=cF5>IsEditableText</span><span class=cF0>(doc_ce) || doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_DATA</span><span class=cF7>)</span><span class=cF0>)
<a name="l470"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l471"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_DATA</span><span class=cF0> &amp;&amp; doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HAS_TERMINATOR</span><span class=cF0> &amp;&amp; doc-&gt;cur_col == doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>)
<a name="l472"></a> {
<a name="l473"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l474"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l475"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l476"></a> }
<a name="l477"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt; doc_ce-&gt;max_col)
<a name="l478"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(doc_ce-&gt;tag + doc-&gt;cur_col, doc_ce-&gt;tag + doc-&gt;cur_col + </span><span class=cFE>1</span><span class=cF0>);
<a name="l479"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &gt;= doc_ce-&gt;max_col - </span><span class=cFE>1</span><span class=cF0>)
<a name="l480"></a> {
<a name="l481"></a> doc-&gt;cur_entry = doc_ce-&gt;next;
<a name="l482"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l483"></a> }
<a name="l484"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc, doc-&gt;cur_entry);
<a name="l485"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l486"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l487"></a> </span><span class=cF1>return</span><span class=cF0>;
<a name="l488"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l489"></a> doc-&gt;cur_entry = doc_ce-&gt;next;
<a name="l490"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l491"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF7>)</span><span class=cF0>)
<a name="l492"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_ce);
<a name="l493"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc, doc-&gt;cur_entry);
<a name="l494"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l495"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l496"></a>}
<a name="l497"></a>
<a name="l498"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>CheckDollarBufSize</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l499"></a>{
<a name="l500"></a> </span><span class=cF1>U8</span><span class=cF0> *b;
<a name="l501"></a>
<a name="l502"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;dollar_buf_ptr &gt;= doc-&gt;dollar_buf_size - </span><span class=cFE>2</span><span class=cF0>)
<a name="l503"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l504"></a> doc-&gt;dollar_buf_size &lt;&lt;= </span><span class=cFE>1</span><span class=cF0>;
<a name="l505"></a> b = </span><span class=cF5>MAlloc</span><span class=cF0>(doc-&gt;dollar_buf_size, doc-&gt;mem_task);
<a name="l506"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(b, doc-&gt;dollar_buf, doc-&gt;dollar_buf_ptr);
<a name="l507"></a> </span><span class=cF5>Free</span><span class=cF0>(doc-&gt;dollar_buf);
<a name="l508"></a> doc-&gt;dollar_buf = b;
<a name="l509"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l510"></a>}
<a name="l511"></a>
<a name="l512"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdCharIns</span><span class=cF0>(</span><span class=cF9>I64</span><span class=cF0> ch, </span><span class=cF9>I64</span><span class=cF0> sc, </span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l513"></a>{
<a name="l514"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l515"></a> </span><span class=cF1>U8</span><span class=cF0> *st, *src, *dst;
<a name="l516"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry, *doc_ne;
<a name="l517"></a> </span><span class=cF9>I64</span><span class=cF0> i, j, m, y = doc_ce-&gt;y;
<a name="l518"></a>
<a name="l519"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_IN_DOLLAR</span><span class=cF0>)
<a name="l520"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l521"></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_printable</span><span class=cF0>, ch</span><span class=cF7>)</span><span class=cF0>)
<a name="l522"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l523"></a> </span><span class=cF5>CheckDollarBufSize</span><span class=cF0>(doc);
<a name="l524"></a> doc-&gt;dollar_buf[doc-&gt;dollar_buf_ptr++] = ch;
<a name="l525"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'$'</span><span class=cF0>)
<a name="l526"></a> {
<a name="l527"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;dollar_buf_ptr == </span><span class=cFE>2</span><span class=cF0>)
<a name="l528"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l529"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_IN_DOLLAR</span><span class=cF0>;
<a name="l530"></a> doc-&gt;dollar_buf_ptr = </span><span class=cFE>0</span><span class=cF0>;
<a name="l531"></a> </span><span class=cF1>goto</span><span class=cF0> ic_cont;
<a name="l532"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l533"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l534"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l535"></a> doc-&gt;dollar_buf[doc-&gt;dollar_buf_ptr] = </span><span class=cFE>0</span><span class=cF0>;
<a name="l536"></a> doc-&gt;flags &amp;= ~</span><span class=cF3>DOCF_IN_DOLLAR</span><span class=cF0>;
<a name="l537"></a> </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>&quot;%s&quot;</span><span class=cF0>, doc-&gt;dollar_buf);
<a name="l538"></a> doc-&gt;dollar_buf_ptr = </span><span class=cFE>0</span><span class=cF0>;
<a name="l539"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l540"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l541"></a> }
<a name="l542"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l543"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l544"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l545"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'$'</span><span class=cF0> &amp;&amp; !</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>)
<a name="l546"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l547"></a> doc-&gt;flags |= </span><span class=cF3>DOCF_IN_DOLLAR</span><span class=cF0>;
<a name="l548"></a> doc-&gt;dollar_buf_ptr = </span><span class=cFE>0</span><span class=cF0>;
<a name="l549"></a> doc-&gt;dollar_buf[doc-&gt;dollar_buf_ptr++] = ch;
<a name="l550"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l551"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l552"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\r'</span><span class=cF0>) </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l553"></a>
<a name="l554"></a> ic_cont:
<a name="l555"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF7>(</span><span class=cF0>ch == </span><span class=cF3>CH_SPACE</span><span class=cF0> || ch == </span><span class=cF6>'\n'</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l556"></a> !</span><span class=cF7>(</span><span class=cF0>sc &amp; (</span><span class=cF3>SCF_CTRL</span><span class=cF0> | </span><span class=cF3>SCF_SHIFT</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l557"></a> doc_ce-&gt;de_flags &amp;
<a name="l558"></a> </span><span class=cF7>(</span><span class=cF3>DOCEF_LINK</span><span class=cF0> | </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_CHECK_COLLAPSABLE</span><span class=cF0> |
<a name="l559"></a> </span><span class=cF3>DOCEF_LEFT_MACRO</span><span class=cF0> | </span><span class=cF3>DOCEF_LEFT_EXP</span><span class=cF0> | </span><span class=cF3>DOCEF_LEFT_CB</span><span class=cF0> | </span><span class=cF3>DOCEF_LEFT_IN_STR</span><span class=cF0> |
<a name="l560"></a> </span><span class=cF3>DOCEF_RIGHT_MACRO</span><span class=cF0> | </span><span class=cF3>DOCEF_RIGHT_EXP</span><span class=cF0> | </span><span class=cF3>DOCEF_RIGHT_CB</span><span class=cF0> | </span><span class=cF3>DOCEF_RIGHT_IN_STR</span><span class=cF7>)</span><span class=cF0>)
<a name="l561"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l562"></a> doc-&gt;cmd_U8 = ch;
<a name="l563"></a> </span><span class=cF5>DocEntryRun</span><span class=cF0>(doc, doc_ce, </span><span class=cF3>FALSE</span><span class=cF0>);
<a name="l564"></a> </span><span class=cF5>DocLock</span><span class=cF0>(doc);
<a name="l565"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l566"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l567"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_HEX_ED</span><span class=cF0>)
<a name="l568"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l569"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&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_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_REMALLOC_DATA</span><span class=cF7>)</span><span class=cF0>)
<a name="l570"></a> st = doc_ce-&gt;data;
<a name="l571"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l572"></a> st = &amp;doc_ce-&gt;data;
<a name="l573"></a> i = doc-&gt;cur_col;
<a name="l574"></a> j = i % (doc_ce-&gt;hex_ed_width * </span><span class=cFE>3</span><span class=cF0>);
<a name="l575"></a> m = i / (doc_ce-&gt;hex_ed_width * </span><span class=cFE>3</span><span class=cF0>) * doc_ce-&gt;hex_ed_width;
<a name="l576"></a> </span><span class=cF1>if</span><span class=cF0> (j &gt;= doc_ce-&gt;hex_ed_width &lt;&lt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l577"></a> st[j - doc_ce-&gt;hex_ed_width &lt;&lt; </span><span class=cFE>1</span><span class=cF0> + m] = ch;
<a name="l578"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l579"></a> {
<a name="l580"></a> ch = </span><span class=cF5>ToUpper</span><span class=cF0>(ch) - </span><span class=cF6>'0'</span><span class=cF0>;
<a name="l581"></a> </span><span class=cF1>if</span><span class=cF0> (ch &gt; </span><span class=cFE>9</span><span class=cF0>)
<a name="l582"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l583"></a> ch += </span><span class=cF6>'0'</span><span class=cF0> - </span><span class=cF6>'A'</span><span class=cF0> + </span><span class=cFE>10</span><span class=cF0>;
<a name="l584"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cFE>10</span><span class=cF0> &lt;= ch &lt;= </span><span class=cFE>15</span><span class=cF7>)</span><span class=cF0>)
<a name="l585"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l586"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l587"></a> m = j &gt;&gt; </span><span class=cFE>1</span><span class=cF0> + m;
<a name="l588"></a> </span><span class=cF1>if</span><span class=cF0> (j &amp; </span><span class=cFE>1</span><span class=cF0>)
<a name="l589"></a> st[m] = st[m] &amp; </span><span class=cFE>0xF0</span><span class=cF0> | ch;
<a name="l590"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l591"></a> st[m] = st[m] &amp; </span><span class=cFE>0xF</span><span class=cF0> | ch &lt;&lt; </span><span class=cFE>4</span><span class=cF0>;
<a name="l592"></a> }
<a name="l593"></a> doc-&gt;cur_col++;
<a name="l594"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l595"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l596"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_OVERSTRIKE</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> (</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="l599"></a> {
<a name="l600"></a>ic_overstrike:
<a name="l601"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>IsEditableText</span><span class=cF7>(</span><span class=cF0>doc_ce</span><span class=cF7>)</span><span class=cF0>)
<a name="l602"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l603"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_col &lt; doc_ce-&gt;max_col)
<a name="l604"></a> {
<a name="l605"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;tag[doc-&gt;cur_col])
<a name="l606"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l607"></a> doc_ce-&gt;tag[doc-&gt;cur_col++] = ch;
<a name="l608"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l609"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l610"></a> }
<a name="l611"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l612"></a> {
<a name="l613"></a> doc_ce = doc_ce-&gt;next;
<a name="l614"></a> doc-&gt;cur_entry = doc_ce;
<a name="l615"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l616"></a> </span><span class=cF1>goto</span><span class=cF0> ic_overstrike;
<a name="l617"></a> }
<a name="l618"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l619"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_DATA</span><span class=cF0>)
<a name="l620"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l621"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HAS_TERMINATOR</span><span class=cF0>)
<a name="l622"></a> {
<a name="l623"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;tag[doc-&gt;cur_col] &amp;&amp; doc-&gt;cur_col &lt; doc_ce-&gt;min_col + doc_ce-&gt;len)
<a name="l624"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l625"></a> doc_ce-&gt;tag[doc-&gt;cur_col++] = ch;
<a name="l626"></a> </span><span class=cF1>if</span><span class=cF0> (!doc_ce-&gt;tag[doc-&gt;cur_col])
<a name="l627"></a> {
<a name="l628"></a> doc_ce-&gt;tag[doc-&gt;cur_col] = </span><span class=cF6>'_'</span><span class=cF0>;
<a name="l629"></a> doc_ce-&gt;tag[doc-&gt;cur_col + </span><span class=cFE>1</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
<a name="l630"></a> }
<a name="l631"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l632"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_REMALLOC_DATA</span><span class=cF0>)
<a name="l633"></a> </span><span class=cF1>goto</span><span class=cF0> ic_not_overstrike;
<a name="l634"></a> }
<a name="l635"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;tag[doc-&gt;cur_col])
<a name="l636"></a> doc_ce-&gt;tag[doc-&gt;cur_col++] = ch;
<a name="l637"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l638"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l639"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, &amp;ch);
<a name="l640"></a> doc_ne-&gt;type = </span><span class=cF3>DOCT_TEXT</span><span class=cF0> | doc-&gt;settings_head.default_text_attr &lt;&lt; </span><span class=cFE>8</span><span class=cF0>;
<a name="l641"></a> doc_ne-&gt;de_flags = </span><span class=cFB>doldoc</span><span class=cF0>.default_de_flags[</span><span class=cF3>DOCT_TEXT</span><span class=cF0>];
<a name="l642"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce-&gt;last);
<a name="l643"></a> }
<a name="l644"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\n'</span><span class=cF0>)
<a name="l645"></a> {
<a name="l646"></a> </span><span class=cF1>while</span><span class=cF0> (doc-&gt;cur_entry-&gt;next != doc &amp;&amp; doc-&gt;cur_entry-&gt;y == y)
<a name="l647"></a> doc-&gt;cur_entry = doc-&gt;cur_entry-&gt;next;
<a name="l648"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l649"></a> }
<a name="l650"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\t'</span><span class=cF0>)
<a name="l651"></a> {
<a name="l652"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_FORM</span><span class=cF0>)
<a name="l653"></a> </span><span class=cF1>goto</span><span class=cF0> ic_form_tab;
<a name="l654"></a> }
<a name="l655"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l656"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l657"></a>ic_not_overstrike:
<a name="l658"></a> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\n'</span><span class=cF0>)
<a name="l659"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l660"></a> </span><span class=cF1>if</span><span class=cF0> (sc &amp; </span><span class=cF3>SCF_CTRL</span><span class=cF0> &amp;&amp; !</span><span class=cF7>(</span><span class=cF0>sc &amp; </span><span class=cF3>SCF_SHIFT</span><span class=cF7>)</span><span class=cF0>)
<a name="l661"></a> {
<a name="l662"></a> doc_ne = </span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc, </span><span class=cF3>DOCT_PAGE_BREAK</span><span class=cF0> | doc-&gt;settings_head.default_text_attr &lt;&lt; </span><span class=cFE>8</span><span class=cF0>);
<a name="l663"></a> }
<a name="l664"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l665"></a> {
<a name="l666"></a> doc_ne = </span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc, </span><span class=cF3>DOCT_NEW_LINE</span><span class=cF0> | doc-&gt;settings_head.default_text_attr &lt;&lt; </span><span class=cFE>8</span><span class=cF0>);
<a name="l667"></a> }
<a name="l668"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc, doc_ne);
<a name="l669"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l670"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (ch == </span><span class=cF6>'\t'</span><span class=cF0>)
<a name="l671"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l672"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;flags &amp; </span><span class=cF3>DOCF_FORM</span><span class=cF0> &amp;&amp;
<a name="l673"></a> </span><span class=cF7>(</span><span class=cF5>Bt</span><span class=cF0>(</span><span class=cFB>doldoc</span><span class=cF0>.type_flags_form, doc-&gt;cur_entry-&gt;type_u8) ||
<a name="l674"></a> doc-&gt;cur_entry-&gt;de_flags &amp; </span><span class=cF3>DOCEF_LINK</span><span class=cF7>)</span><span class=cF0> &amp;&amp;
<a name="l675"></a> !</span><span class=cF7>(</span><span class=cF0>doc-&gt;cur_entry-&gt;de_flags &amp; </span><span class=cF3>DOCEF_SKIP_IN_FORM</span><span class=cF7>)</span><span class=cF0>)
<a name="l676"></a> {
<a name="l677"></a>ic_form_tab:
<a name="l678"></a> doc-&gt;cur_entry = doc-&gt;cur_entry-&gt;next;
<a name="l679"></a> doc-&gt;cur_col = doc-&gt;cur_entry-&gt;min_col;
<a name="l680"></a> </span><span class=cF5>DocFormFwd</span><span class=cF0>(doc);
<a name="l681"></a> </span><span class=cF1>goto</span><span class=cF0> ic_done;
<a name="l682"></a> }
<a name="l683"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l684"></a> {
<a name="l685"></a> doc_ne = </span><span class=cF5>DocEntryNewBase</span><span class=cF0>(doc, </span><span class=cF3>DOCT_TAB</span><span class=cF0> | doc-&gt;settings_head.default_text_attr &lt;&lt; </span><span class=cFE>8</span><span class=cF0>);
<a name="l686"></a> </span><span class=cF5>DocInsEntry</span><span class=cF0>(doc, doc_ne);
<a name="l687"></a> }
<a name="l688"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l689"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l690"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l691"></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="l692"></a> {
<a name="l693"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;type_u8 == </span><span class=cF3>DOCT_DATA</span><span class=cF0>)
<a name="l694"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l695"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cF3>TRUE</span><span class=cF0>)
<a name="l696"></a> {
<a name="l697"></a> i = doc_ce-&gt;len + doc_ce-&gt;min_col;
<a name="l698"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_HAS_TERMINATOR</span><span class=cF0>)
<a name="l699"></a> i++;
<a name="l700"></a> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;max_col &lt; i)
<a name="l701"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l702"></a> st = doc_ce-&gt;tag;
<a name="l703"></a> doc_ce-&gt;max_col++;
<a name="l704"></a> </span><span class=cF1>for</span><span class=cF0> (i = doc_ce-&gt;max_col; i &gt; doc-&gt;cur_col; i--)
<a name="l705"></a> st[i] = st[i - </span><span class=cFE>1</span><span class=cF0>];
<a name="l706"></a> st[doc-&gt;cur_col++] = ch;
<a name="l707"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l708"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l709"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_REMALLOC_DATA</span><span class=cF0>)
<a name="l710"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l711"></a> st = </span><span class=cF5>MAlloc</span><span class=cF0>(doc_ce-&gt;max_col + </span><span class=cFE>8</span><span class=cF0>, doc-&gt;mem_task);
<a name="l712"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(st, doc_ce-&gt;tag, doc_ce-&gt;max_col + </span><span class=cFE>1</span><span class=cF0>);
<a name="l713"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_ce-&gt;tag);
<a name="l714"></a> doc_ce-&gt;tag = st;
<a name="l715"></a> doc_ce-&gt;len = </span><span class=cF5>MSize</span><span class=cF0>(st) - doc_ce-&gt;min_col - </span><span class=cFE>2</span><span class=cF0>; </span><span class=cF2>//See </span><a href="https://tomawezome.github.io/ZealOS/System/DolDoc/DocPlain.html#l435"><span class=cF4>DataTagWidth</span></a><span class=cF0>
<a name="l716"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_ce-&gt;data);
<a name="l717"></a> doc_ce-&gt;data = </span><span class=cF5>MAlloc</span><span class=cF0>(doc_ce-&gt;len + </span><span class=cFE>2</span><span class=cF0>, doc-&gt;mem_task);
<a name="l718"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l719"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l720"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l721"></a> }
<a name="l722"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l723"></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_ce</span><span class=cF7>)</span><span class=cF0>)
<a name="l724"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l725"></a> dst = st = </span><span class=cF5>MAlloc</span><span class=cF0>(doc_ce-&gt;max_col + </span><span class=cFE>2</span><span class=cF0>, doc-&gt;mem_task);
<a name="l726"></a> src = doc_ce-&gt;tag;
<a name="l727"></a> i = doc-&gt;cur_col;
<a name="l728"></a> </span><span class=cF1>while</span><span class=cF0> (i-- &gt; </span><span class=cFE>0</span><span class=cF0>)
<a name="l729"></a> *dst++ = *src++;
<a name="l730"></a> *dst++ = ch;
<a name="l731"></a> </span><span class=cF1>while</span><span class=cF0> (*dst++ = *src++);
<a name="l732"></a> </span><span class=cF5>Free</span><span class=cF0>(doc_ce-&gt;tag);
<a name="l733"></a> doc_ce-&gt;tag = st;
<a name="l734"></a> doc_ce-&gt;max_col++;
<a name="l735"></a> doc-&gt;cur_col++;
<a name="l736"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l737"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l738"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l739"></a> doc_ne = </span><span class=cF5>DocEntryNewTag</span><span class=cF0>(doc, doc_ce, &amp;ch);
<a name="l740"></a> doc_ne-&gt;type = </span><span class=cF3>DOCT_TEXT</span><span class=cF0> | doc-&gt;settings_head.default_text_attr &lt;&lt; </span><span class=cFE>8</span><span class=cF0>;
<a name="l741"></a> doc_ne-&gt;de_flags = </span><span class=cFB>doldoc</span><span class=cF0>.default_de_flags[</span><span class=cF3>DOCT_TEXT</span><span class=cF0>];
<a name="l742"></a> doc_ne-&gt;x = doc_ce-&gt;x + </span><span class=cFE>1</span><span class=cF0>;
<a name="l743"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(doc_ne, doc_ce-&gt;last);
<a name="l744"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l745"></a> }
<a name="l746"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l747"></a>ic_done:
<a name="l748"></a> </span><span class=cF5>DocRemSoftNewLines</span><span class=cF0>(doc, doc-&gt;cur_entry);
<a name="l749"></a> </span><span class=cF1>if</span><span class=cF0> (doc-&gt;cur_entry-&gt;de_flags &amp; </span><span class=cF3>DOCEF_UPDATE_DATA</span><span class=cF0> &amp;&amp;
<a name="l750"></a> </span><span class=cF7>(</span><span class=cF0>doc-&gt;cur_entry-&gt;type_u8 == </span><span class=cF3>DOCT_DATA</span><span class=cF0> ||
<a name="l751"></a> doc-&gt;cur_entry-&gt;type_u8 == </span><span class=cF3>DOCT_CHECK_BOX</span><span class=cF7>)</span><span class=cF0>)
<a name="l752"></a> </span><span class=cF5>DocDataScan</span><span class=cF0>(doc, doc-&gt;cur_entry);
<a name="l753"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
<a name="l754"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
<a name="l755"></a>}
<a name="l756"></a>
<a name="l757"></a></span><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>EdLineDel</span><span class=cF0>(</span><span class=cF9>CDoc</span><span class=cF0> *doc)
<a name="l758"></a>{
<a name="l759"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_ce = doc-&gt;cur_entry, *doc_ce2;
<a name="l760"></a> </span><span class=cF9>I64</span><span class=cF0> y;
<a name="l761"></a>
<a name="l762"></a> y = doc-&gt;y;
<a name="l763"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc &amp;&amp; doc_ce-&gt;y == y)
<a name="l764"></a> doc_ce = doc_ce-&gt;next;
<a name="l765"></a> doc-&gt;cur_entry = doc_ce;
<a name="l766"></a> doc-&gt;cur_col = doc_ce-&gt;min_col;
<a name="l767"></a> doc_ce = doc_ce-&gt;last;
<a name="l768"></a> </span><span class=cF1>while</span><span class=cF0> (doc_ce != doc &amp;&amp; doc_ce-&gt;y == y)
<a name="l769"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l770"></a> doc_ce2 = doc_ce-&gt;last;
<a name="l771"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>doc_ce-&gt;de_flags &amp; </span><span class=cF3>DOCEF_FILTER_SKIP</span><span class=cF7>)</span><span class=cF0>)
<a name="l772"></a> </span><span class=cF5>DocEntryDel</span><span class=cF0>(doc, doc_ce);
<a name="l773"></a> doc_ce = doc_ce2;
<a name="l774"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l775"></a>}
</span></pre></body>
</html>