summary refs log blame commit diff stats
path: root/doc/pydoc/ranger.gui.widgets.statusbar.html
blob: 1a97d532d227e422ebc791d352a09f03b390447c (plain) (tree)
1
2
3
4
5
6
7
8
9
10
138
139
140
141
142
143
144
145
146
147
148
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# The top-level data structure for the Mu shell.
#
# vim:textwidth&
# It would be nice for tests to use a narrower screen than the standard 0x80 of
# 1024 pixels with 8px-wide graphemes. But it complicates rendering logic to
# make width configurable, so we just use longer lines than usual.

type environment {
  globals: global-table
  sandbox: sandbox
  # some state for a modal dialog for navigating between globals
  partial-global-name: (handle gap-buffer)
  go-modal-error: (handle array byte)
  #
  cursor-in-globals?: boolean
  cursor-in-go-modal?:pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module ranger.gui.widgets.statusbar</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="ranger.html"><font color="#ffffff">ranger</font></a>.<a href="ranger.gui.html"><font color="#ffffff">gui</font></a>.<a href="ranger.gui.widgets.html"><font color="#ffffff">widgets</font></a>.statusbar</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/hut/ranger/ranger/gui/widgets/statusbar.py">/home/hut/ranger/ranger/gui/widgets/statusbar.py</a></font></td></tr></table>
    <p><tt>The&nbsp;statusbar&nbsp;displays&nbsp;information&nbsp;about&nbsp;the&nbsp;current&nbsp;file&nbsp;and&nbsp;directory.<br>
&nbsp;<br>
On&nbsp;the&nbsp;left&nbsp;side,&nbsp;there&nbsp;is&nbsp;a&nbsp;display&nbsp;similar&nbsp;to&nbsp;what&nbsp;"ls&nbsp;-l"&nbsp;would<br>
print&nbsp;for&nbsp;the&nbsp;current&nbsp;file.&nbsp;&nbsp;The&nbsp;right&nbsp;side&nbsp;shows&nbsp;directory&nbsp;information<br>
such&nbsp;as&nbsp;the&nbsp;space&nbsp;used&nbsp;by&nbsp;all&nbsp;the&nbsp;files&nbsp;in&nbsp;this&nbsp;directory.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="ranger.gui.widgets.statusbar.html#Message">Message</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="ranger.gui.widgets.html#Widget">ranger.gui.widgets.Widget</a>(<a href="ranger.gui.displayable.html#Displayable">ranger.gui.displayable.Displayable</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="ranger.gui.widgets.statusbar.html#StatusBar">StatusBar</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Message">class <strong>Message</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Message-__init__"><strong>__init__</strong></a>(self, text, duration, bad)</dt></dl>

<dl><dt><a name="Message-is_alive"><strong>is_alive</strong></a>(self)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>bad</strong> = False</dl>

<dl><dt><strong>elapse</strong> = None</dl>

<dl><dt><strong>text</strong> = None</dl>

</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="StatusBar">class <strong>StatusBar</strong></a>(<a href="ranger.gui.widgets.html#Widget">ranger.gui.widgets.Widget</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>The&nbsp;statusbar&nbsp;displays&nbsp;information&nbsp;about&nbsp;the&nbsp;current&nbsp;file&nbsp;and&nbsp;directory.<br>
&nbsp;<br>
On&nbsp;the&nbsp;left&nbsp;side,&nbsp;there&nbsp;is&nbsp;a&nbsp;display&nbsp;similar&nbsp;to&nbsp;what&nbsp;"ls&nbsp;-l"&nbsp;would<br>
print&nbsp;for&nbsp;the&nbsp;current&nbsp;file.&nbsp;&nbsp;The&nbsp;right&nbsp;side&nbsp;shows&nbsp;directory&nbsp;information<br>
such&nbsp;as&nbsp;the&nbsp;space&nbsp;used&nbsp;by&nbsp;all&nbsp;the&nbsp;files&nbsp;in&nbsp;this&nbsp;directory.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="ranger.gui.widgets.statusbar.html#StatusBar">StatusBar</a></dd>
<dd><a href="ranger.gui.widgets.html#Widget">ranger.gui.widgets.Widget</a></dd>
<dd><a href="ranger.gui.displayable.html#Displayable">ranger.gui.displayable.Displayable</a></dd>
<dd><a href="ranger.shared.html#EnvironmentAware">ranger.shared.EnvironmentAware</a></dd>
<dd><a href="ranger.shared.html#FileManagerAware">ranger.shared.FileManagerAware</a></dd>
<dd><a href="ranger.shared.html#Awareness">ranger.shared.Awareness</a></dd>
<dd><a href="ranger.gui.curses_shortcuts.html#CursesShortcuts">ranger.gui.curses_shortcuts.CursesShortcuts</a></dd>
<dd><a href="ranger.shared.settings.html#SettingsAware">ranger.shared.settings.SettingsAware</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="StatusBar-__init__"><strong>__init__</strong></a>(self, win, column<font color="#909090">=None</font>)</dt></dl>

<dl><dt><a name="StatusBar-draw"><strong>draw</strong></a>(self)</dt><dd><tt>Draw&nbsp;the&nbsp;statusbar</tt></dd></dl>

<dl><dt><a name="StatusBar-notify"><strong>notify</strong></a>(self, text, duration<font color="#909090">=4</font>, bad<font color="#909090">=False</font>)</dt></dl>

<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>groups</strong> = {}</dl>

<dl><dt><strong>hint</strong> = None</dl>

<dl><dt><strong>msg</strong> = None</dl>

<dl><dt><strong>old_cf</strong> = None</dl>

<dl><dt><strong>old_du</strong> = None</dl>

<dl><dt><strong>old_hint</strong> = None</dl>

<dl><dt><strong>old_mtime</strong> = None</dl>

<dl><dt><strong>owners</strong> = {}</dl>

<dl><dt><strong>result</strong> = None</dl>

<dl><dt><strong>timeformat</strong> = '%Y-%m-%d %H:%M'</dl>

<hr>
Methods inherited from <a href="ranger.gui.displayable.html#Displayable">ranger.gui.displayable.Displayable</a>:<br>
<dl><dt><a name="StatusBar-__bool__"><strong>__bool__</strong></a> = __nonzero__(self)</dt><dd><tt>Always&nbsp;True</tt></dd></dl>

<dl><dt><a name="StatusBar-__contains__"><strong>__contains__</strong></a>(self, item)</dt><dd><tt>Is&nbsp;item&nbsp;inside&nbsp;the&nbsp;boundaries?<br>
item&nbsp;can&nbsp;be&nbsp;an&nbsp;iterable&nbsp;like&nbsp;[y,&nbsp;x]&nbsp;or&nbsp;an&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;with&nbsp;x&nbsp;and&nbsp;y&nbsp;methods.</tt></dd></dl>

<dl><dt><a name="StatusBar-__nonzero__"><strong>__nonzero__</strong></a>(self)</dt><dd><tt>Always&nbsp;True</tt></dd></dl>

<dl><dt><a name="StatusBar-__str__"><strong>__str__</strong></a>(self)</dt></dl>

<dl><dt><a name="StatusBar-click"><strong>click</strong></a>(self, event)</dt><dd><tt>Called&nbsp;when&nbsp;a&nbsp;mouse&nbsp;key&nbsp;is&nbsp;pressed&nbsp;and&nbsp;self.<strong>focused</strong>&nbsp;is&nbsp;True.<br>
Override&nbsp;this!</tt></dd></dl>

<dl><dt><a name="StatusBar-contains_point"><strong>contains_point</strong></a>(self, y, x)</dt><dd><tt>Test&nbsp;whether&nbsp;the&nbsp;point&nbsp;(with&nbsp;absolute&nbsp;coordinates)&nbsp;lies<br>
within&nbsp;the&nbsp;boundaries&nbsp;of&nbsp;this&nbsp;<a href="__builtin__.html#object">object</a>.</tt></dd></dl>

<dl><dt><a name="StatusBar-destroy"><strong>destroy</strong></a>(self)</dt><dd><tt>Called&nbsp;when&nbsp;the&nbsp;<a href="__builtin__.html#object">object</a>&nbsp;is&nbsp;destroyed.<br>
Override&nbsp;this!</tt></dd></dl>

<dl><dt><a name="StatusBar-finalize"><strong>finalize</strong></a>(self)</dt><dd><tt>Called&nbsp;after&nbsp;every&nbsp;displayable&nbsp;is&nbsp;done&nbsp;drawing.<br>
Override&nbsp;this!</tt></dd></dl>

<dl><dt><a name="StatusBar-poke"><strong>poke</strong></a>(self)</dt><dd><tt>Called&nbsp;before&nbsp;drawing,&nbsp;even&nbsp;if&nbsp;invisible</tt></dd></dl>

<dl><dt><a name="StatusBar-press"><strong>press</strong></a>(self, key)</dt><dd><tt>Called&nbsp;when&nbsp;a&nbsp;key&nbsp;is&nbsp;pressed&nbsp;and&nbsp;self.<strong>focused</strong>&nbsp;is&nbsp;True.<br>
Override&nbsp;this!</tt></dd></dl>

<dl><dt><a name="StatusBar-resize"><strong>resize</strong></a>(self, y, x, hei<font color="#909090">=None</font>, wid<font color="#909090">=None</font>)</dt><dd><tt>Resize&nbsp;the&nbsp;widget</tt></dd></dl>

<hr>
Data and other attributes inherited from <a href="ranger.shared.html#EnvironmentAware">ranger.shared.EnvironmentAware</a>:<br>
<dl><dt><strong>env</strong> = None</dl>

<hr>
Data and other attributes inherited from <a href="ranger.shared.html#FileManagerAware">ranger.shared.FileManagerAware</a>:<br>
<dl><dt><strong>fm</strong> = None</dl>

<hr>
Data descriptors inherited from <a href="ranger.shared.html#Awareness">ranger.shared.Awareness</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<hr>
Methods inherited from <a href="ranger.gui.curses_shortcuts.html#CursesShortcuts">ranger.gui.curses_shortcuts.CursesShortcuts</a>:<br>
<dl><dt><a name="StatusBar-addnstr"><strong>addnstr</strong></a>(self, *args)</dt></dl>

<dl><dt><a name="StatusBar-addstr"><strong>addstr</strong></a>(self, *args)</dt></dl>

<dl><dt><a name="StatusBar-color"><strong>color</strong></a>(self, *keys)</dt><dd><tt>Change&nbsp;the&nbsp;colors&nbsp;from&nbsp;now&nbsp;on.</tt></dd></dl>

<dl><dt><a name="StatusBar-color_at"><strong>color_at</strong></a>(self, y, x, wid, *keys)</dt><dd><tt>Change&nbsp;the&nbsp;colors&nbsp;at&nbsp;the&nbsp;specified&nbsp;position</tt></dd></dl>

<dl><dt><a name="StatusBar-color_reset"><strong>color_reset</strong></a>(self)</dt><dd><tt>Change&nbsp;the&nbsp;colors&nbsp;to&nbsp;the&nbsp;default&nbsp;colors</tt></dd></dl>

<hr>
Data and other attributes inherited from <a href="ranger.shared.settings.html#SettingsAware">ranger.shared.settings.SettingsAware</a>:<br>
<dl><dt><strong>settings</strong> = {}</dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-getgrgid"><strong>getgrgid</strong></a>(...)</dt><dd><tt><a href="#-getgrgid">getgrgid</a>(id)&nbsp;-&gt;&nbsp;tuple<br>
Return&nbsp;the&nbsp;group&nbsp;database&nbsp;entry&nbsp;for&nbsp;the&nbsp;given&nbsp;numeric&nbsp;group&nbsp;ID.&nbsp;&nbsp;If<br>
id&nbsp;is&nbsp;not&nbsp;valid,&nbsp;raise&nbsp;KeyError.</tt></dd></dl>
 <dl><dt><a name="-getpwuid"><strong>getpwuid</strong></a>(...)</dt><dd><tt><a href="#-getpwuid">getpwuid</a>(uid)&nbsp;-&gt;&nbsp;(pw_name,pw_passwd,pw_uid,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pw_gid,pw_gecos,pw_dir,pw_shell)<br>
Return&nbsp;the&nbsp;password&nbsp;database&nbsp;entry&nbsp;for&nbsp;the&nbsp;given&nbsp;numeric&nbsp;user&nbsp;ID.<br>
See&nbsp;pwd.__doc__&nbsp;for&nbsp;more&nbsp;on&nbsp;password&nbsp;database&nbsp;entries.</tt></dd></dl>
 <dl><dt><a name="-getuid"><strong>getuid</strong></a>(...)</dt><dd><tt><a href="#-getuid">getuid</a>()&nbsp;-&gt;&nbsp;uid<br>
&nbsp;<br>
Return&nbsp;the&nbsp;current&nbsp;process's&nbsp;user&nbsp;id.</tt></dd></dl>
 <dl><dt><a name="-localtime"><strong>localtime</strong></a>(...)</dt><dd><tt><a href="#-localtime">localtime</a>([seconds])&nbsp;-&gt;&nbsp;(tm_year,tm_mon,tm_mday,tm_hour,tm_min,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tm_sec,tm_wday,tm_yday,tm_isdst)<br>
&nbsp;<br>
Convert&nbsp;seconds&nbsp;since&nbsp;the&nbsp;Epoch&nbsp;to&nbsp;a&nbsp;time&nbsp;tuple&nbsp;expressing&nbsp;local&nbsp;time.<br>
When&nbsp;'seconds'&nbsp;is&nbsp;not&nbsp;passed&nbsp;in,&nbsp;convert&nbsp;the&nbsp;current&nbsp;time&nbsp;instead.</tt></dd></dl>
 <dl><dt><a name="-strftime"><strong>strftime</strong></a>(...)</dt><dd><tt><a href="#-strftime">strftime</a>(format[,&nbsp;tuple])&nbsp;-&gt;&nbsp;string<br>
&nbsp;<br>
Convert&nbsp;a&nbsp;time&nbsp;tuple&nbsp;to&nbsp;a&nbsp;string&nbsp;according&nbsp;to&nbsp;a&nbsp;format&nbsp;specification.<br>
See&nbsp;the&nbsp;library&nbsp;reference&nbsp;manual&nbsp;for&nbsp;formatting&nbsp;codes.&nbsp;When&nbsp;the&nbsp;time&nbsp;tuple<br>
is&nbsp;not&nbsp;present,&nbsp;current&nbsp;time&nbsp;as&nbsp;returned&nbsp;by&nbsp;<a href="#-localtime">localtime</a>()&nbsp;is&nbsp;used.</tt></dd></dl>
 <dl><dt><a name="-time"><strong>time</strong></a>(...)</dt><dd><tt><a href="#-time">time</a>()&nbsp;-&gt;&nbsp;floating&nbsp;point&nbsp;number<br>
&nbsp;<br>
Return&nbsp;the&nbsp;current&nbsp;time&nbsp;in&nbsp;seconds&nbsp;since&nbsp;the&nbsp;Epoch.<br>
Fractions&nbsp;of&nbsp;a&nbsp;second&nbsp;may&nbsp;be&nbsp;present&nbsp;if&nbsp;the&nbsp;system&nbsp;clock&nbsp;provides&nbsp;them.</tt></dd></dl>
</td></tr></table>
</body></html>
n><- get self, cursor-in-go-modal? copy-to *cursor-in-go-modal-a, 0/false var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error clear-object go-modal-error-ah return } # enter = switch to global name and exit modal dialog { compare key, 0xa/newline break-if-!= # if no global name typed in, switch to sandbox var partial-global-name-ah/eax: (addr handle gap-buffer) <- get self, partial-global-name var partial-global-name/eax: (addr gap-buffer) <- lookup *partial-global-name-ah { var empty?/eax: boolean <- gap-buffer-empty? partial-global-name compare empty?, 0/false break-if-= var cursor-in-globals-a/eax: (addr boolean) <- get self, cursor-in-globals? copy-to *cursor-in-globals-a, 0/false # reset error state var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error clear-object go-modal-error-ah # done with go modal var cursor-in-go-modal-a/eax: (addr boolean) <- get self, cursor-in-go-modal? copy-to *cursor-in-go-modal-a, 0/false return } # turn global name into a stream var name-storage: (stream byte 0x40) var name/ecx: (addr stream byte) <- address name-storage emit-gap-buffer partial-global-name, name # compute global index var curr-index/ecx: int <- find-symbol-in-globals globals, name # if global not found, set error and return { compare curr-index, 0 break-if->= var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error copy-array-object "no such global", go-modal-error-ah return } # if global is a primitive, set error and return { var global-data-ah/eax: (addr handle array global) <- get globals, data var global-data/eax: (addr array global) <- lookup *global-data-ah var curr-offset/ebx: (offset global) <- compute-offset global-data, curr-index var curr/ebx: (addr global) <- index global-data, curr-offset var primitive?/eax: boolean <- primitive-global? curr compare primitive?, 0/false break-if-= var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error copy-array-object "sorry, primitives can't be edited yet", go-modal-error-ah return } # otherwise clear modal state clear-gap-buffer partial-global-name var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error clear-object go-modal-error-ah var cursor-in-go-modal-a/eax: (addr boolean) <- get self, cursor-in-go-modal? copy-to *cursor-in-go-modal-a, 0/false # switch focus to global at index #? set-cursor-position 0/screen, 0x20/x 0x20/y #? draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, curr-index, 7/fg 0/bg bump-global globals, curr-index #? var curr-index2/ecx: int <- cursor-global globals #? draw-int32-decimal-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, curr-index2, 4/fg 0/bg #? abort "a" var cursor-in-globals-a/ecx: (addr boolean) <- get self, cursor-in-globals? copy-to *cursor-in-globals-a, 1/true return } # ctrl-m = create given global name and exit modal dialog { compare key, 0xd/ctrl-m break-if-!= # if no global name typed in, set error and return var partial-global-name-ah/eax: (addr handle gap-buffer) <- get self, partial-global-name var partial-global-name/eax: (addr gap-buffer) <- lookup *partial-global-name-ah { var empty?/eax: boolean <- gap-buffer-empty? partial-global-name compare empty?, 0/false break-if-= var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error copy-array-object "create what?", go-modal-error-ah return } # turn global name into a stream var name-storage: (stream byte 0x40) var name/edx: (addr stream byte) <- address name-storage emit-gap-buffer partial-global-name, name # compute global curr-index var curr-index/ecx: int <- find-symbol-in-globals globals, name # if global found, set error and return { compare curr-index, 0 break-if-< var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error copy-array-object "already exists", go-modal-error-ah return } # otherwise clear modal state clear-gap-buffer partial-global-name var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error clear-object go-modal-error-ah var cursor-in-go-modal-a/eax: (addr boolean) <- get self, cursor-in-go-modal? copy-to *cursor-in-go-modal-a, 0/false # create new global create-empty-global globals, name, 0x2000/default-gap-buffer-size=8KB var globals-final-index/eax: (addr int) <- get globals, final-index var new-index/ecx: int <- copy *globals-final-index bump-global globals, new-index var cursor-in-globals-a/ecx: (addr boolean) <- get self, cursor-in-globals? copy-to *cursor-in-globals-a, 1/true return } # otherwise process like a regular gap-buffer var partial-global-name-ah/eax: (addr handle gap-buffer) <- get self, partial-global-name var partial-global-name/eax: (addr gap-buffer) <- lookup *partial-global-name-ah edit-gap-buffer partial-global-name, key return } # ctrl-g: go to a global (or the repl) { compare key, 7/ctrl-g break-if-!= # look for a word to prepopulate the modal var current-word-storage: (stream byte 0x40) var current-word/edi: (addr stream byte) <- address current-word-storage word-at-cursor self, current-word var partial-global-name-ah/eax: (addr handle gap-buffer) <- get self, partial-global-name var partial-global-name/eax: (addr gap-buffer) <- lookup *partial-global-name-ah clear-gap-buffer partial-global-name load-gap-buffer-from-stream partial-global-name, current-word # enable the modal var cursor-in-go-modal-a/eax: (addr boolean) <- get self, cursor-in-go-modal? copy-to *cursor-in-go-modal-a, 1/true return } # dispatch the key to either sandbox or globals { var cursor-in-globals-a/eax: (addr boolean) <- get self, cursor-in-globals? compare *cursor-in-globals-a, 0/false break-if-= edit-globals globals, key return } edit-sandbox sandbox, key, globals, data-disk } fn read-and-evaluate-and-save-gap-buffer-to-globals _in-ah: (addr handle gap-buffer), result-ah: (addr handle cell), globals: (addr global-table), definitions-created: (addr stream int), trace: (addr trace), inner-screen-var: (addr handle cell), inner-keyboard-var: (addr handle cell) { var in-ah/eax: (addr handle gap-buffer) <- copy _in-ah var in/eax: (addr gap-buffer) <- lookup *in-ah var read-result-h: (handle cell) var read-result-ah/esi: (addr handle cell) <- address read-result-h read-cell in, read-result-ah, trace var error?/eax: boolean <- has-errors? trace { compare error?, 0/false break-if-= return } macroexpand read-result-ah, globals, trace var error?/eax: boolean <- has-errors? trace { compare error?, 0/false break-if-= return } var nil-h: (handle cell) var nil-ah/eax: (addr handle cell) <- address nil-h allocate-pair nil-ah #? set-cursor-position 0/screen, 0 0 #? turn-on-debug-print var call-number-storage: int var call-number/edi: (addr int) <- address call-number-storage debug-print "^", 4/fg, 0/bg evaluate read-result-ah, result-ah, *nil-ah, globals, trace, inner-screen-var, inner-keyboard-var, definitions-created, call-number debug-print "$", 4/fg, 0/bg var error?/eax: boolean <- has-errors? trace { compare error?, 0/false break-if-= return } # refresh various rendering caches mark-lines-dirty trace # If any definitions were created or modified in the process, link this gap # buffer to them. # TODO: detect and create UI for conflicts. stash-gap-buffer-to-globals globals, definitions-created, _in-ah } fn test-go-modal { var env-storage: environment var env/esi: (addr environment) <- address env-storage initialize-environment env, 8/fake-screen-width, 3/fake-screen-height # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # hit ctrl-g edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-go-modal/0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-go-modal/1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-go-modal/2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-go-modal/3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-go-modal/4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-go-modal/5" check-screen-row screen, 6/y, " go to global (or leave blank to go to REPL) ", "F - test-go-modal/6-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ................................................................ ", "F - test-go-modal/6" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ................................................................ ", "F - test-go-modal/7" # cursor is in the modal check-background-color-in-screen-row screen, 0/bg=cursor, 8/y, " | ", "F - test-go-modal/8-cursor" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " ............................................................... ", "F - test-go-modal/8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-go-modal/9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-go-modal/10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-go-modal/11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-go-modal/12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-go-modal/13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-go-modal/14" # menu at bottom is correct in context check-screen-row screen, 0xf/y, " ^r run main enter go ^m create esc cancel ^a << ^b <word ^f word> ^e >> ", "F - test-go-modal/15-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-go-modal/15" } fn test-leave-go-modal { var env-storage: environment var env/esi: (addr environment) <- address env-storage initialize-environment env, 8/fake-screen-width, 3/fake-screen-height # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # hit ctrl-g edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # cancel edit-environment env, 0x1b/escape, 0/no-disk render-environment screen, env # no modal check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-leave-go-modal/0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-leave-go-modal/1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-leave-go-modal/2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-leave-go-modal/3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-leave-go-modal/4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-leave-go-modal/5" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ", "F - test-leave-go-modal/6" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ", "F - test-leave-go-modal/7" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " ", "F - test-leave-go-modal/8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-leave-go-modal/9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-leave-go-modal/10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-leave-go-modal/11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-leave-go-modal/12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-leave-go-modal/13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-leave-go-modal/14" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-leave-go-modal/15" } fn test-jump-to-global { var env-storage: environment var env/esi: (addr environment) <- address env-storage initialize-environment env, 8/fake-screen-width, 3/fake-screen-height # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 0x80/width, 0x30/height, 0/no-pixel-graphics # define a global type-in env, screen, "(define f 42)" edit-environment env, 0x13/ctrl-s, 0/no-disk render-environment screen, env # hit ctrl-g edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # type global name type-in env, screen, "f" # submit edit-environment env, 0xa/newline, 0/no-disk render-environment screen, env # | global definitions | sandbox # cursor now in global definition check-screen-row screen, 1/y, " (define f 42) screen: ", "F - test-jump-to-global/1" check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " | ", "F - test-jump-to-global/1-cursor" # no modal check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-jump-to-global/bg0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-jump-to-global/bg1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-jump-to-global/bg2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-jump-to-global/bg3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-jump-to-global/bg4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-jump-to-global/bg5" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ", "F - test-jump-to-global/bg6" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ", "F - test-jump-to-global/bg7" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " ", "F - test-jump-to-global/bg8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-jump-to-global/bg9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-jump-to-global/bg10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-jump-to-global/bg11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-jump-to-global/bg12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-jump-to-global/bg13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-jump-to-global/bg14" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-jump-to-global/bg15" } fn test-go-modal-prepopulates-word-at-cursor { var env-storage: environment var env/esi: (addr environment) <- address env-storage initialize-environment env, 8/fake-screen-width, 3/fake-screen-height # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # type a word at the cursor type-in env, screen, "fn1" # hit ctrl-g edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # modal prepopulates word at cursor check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/5" check-screen-row screen, 6/y, " go to global (or leave blank to go to REPL) ", "F - test-go-modal-prepopulates-word-at-cursor/6-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ................................................................ ", "F - test-go-modal-prepopulates-word-at-cursor/6" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ................................................................ ", "F - test-go-modal-prepopulates-word-at-cursor/7" # word at cursor check-screen-row screen, 8/y, " fn1 ", "F - test-go-modal-prepopulates-word-at-cursor/8-text" # new cursor position check-background-color-in-screen-row screen, 0/bg=cursor, 8/y, " | ", "F - test-go-modal-prepopulates-word-at-cursor/8-cursor" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " ... ............................................................ ", "F - test-go-modal-prepopulates-word-at-cursor/8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/14" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/15" # cancel edit-environment env, 0x1b/escape, 0/no-disk render-environment screen, env # type one more space edit-environment env, 0x20/space, 0/no-disk render-environment screen, env # hit ctrl-g again edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # no word prepopulated since cursor is not on the word check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-5" check-screen-row screen, 6/y, " go to global (or leave blank to go to REPL) ", "F - test-go-modal-prepopulates-word-at-cursor/test2-6-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ................................................................ ", "F - test-go-modal-prepopulates-word-at-cursor/test2-6" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ................................................................ ", "F - test-go-modal-prepopulates-word-at-cursor/test2-7" # no word at cursor check-screen-row screen, 8/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-8-text" # new cursor position check-background-color-in-screen-row screen, 0/bg=cursor, 8/y, " | ", "F - test-go-modal-prepopulates-word-at-cursor/test2-8-cursor" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " ............................................................... ", "F - test-go-modal-prepopulates-word-at-cursor/test2-8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-14" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test2-15" # cancel edit-environment env, 0x1b/escape, 0/no-disk render-environment screen, env # move cursor to the left until it's on the word again edit-environment env, 0x80/left-arrow, 0/no-disk render-environment screen, env edit-environment env, 0x80/left-arrow, 0/no-disk render-environment screen, env # hit ctrl-g again edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # word prepopulated like before check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-5" check-screen-row screen, 6/y, " go to global (or leave blank to go to REPL) ", "F - test-go-modal-prepopulates-word-at-cursor/test3-6-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ................................................................ ", "F - test-go-modal-prepopulates-word-at-cursor/test3-6" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ................................................................ ", "F - test-go-modal-prepopulates-word-at-cursor/test3-7" # word at cursor check-screen-row screen, 8/y, " fn1 ", "F - test-go-modal-prepopulates-word-at-cursor/test3-8-text" # new cursor position check-background-color-in-screen-row screen, 0/bg=cursor, 8/y, " | ", "F - test-go-modal-prepopulates-word-at-cursor/test3-8-cursor" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " ... ............................................................ ", "F - test-go-modal-prepopulates-word-at-cursor/test3-8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-14" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-go-modal-prepopulates-word-at-cursor/test3-15" } fn test-jump-to-nonexistent-global { var env-storage: environment var env/esi: (addr environment) <- address env-storage initialize-environment env, 8/fake-screen-width, 3/fake-screen-height # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # type in any (nonexistent) global name type-in env, screen, "f" # hit ctrl-g edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # submit edit-environment env, 0xa/newline, 0/no-disk render-environment screen, env # modal now shows an error # | global definitions | sandbox check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-jump-to-nonexistent-global/0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-jump-to-nonexistent-global/1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-jump-to-nonexistent-global/2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-jump-to-nonexistent-global/3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-jump-to-nonexistent-global/4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-jump-to-nonexistent-global/5" check-screen-row screen, 6/y, " go to global (or leave blank to go to REPL) ", "F - test-jump-to-nonexistent-global/6-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ................................................................ ", "F - test-jump-to-nonexistent-global/6" check-screen-row-in-color screen, 4/fg=error, 7/y, " no such global ", "F - test-jump-to-nonexistent-global/7-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ................................................................ ", "F - test-jump-to-nonexistent-global/7" check-screen-row screen, 8/y, " f ", "F - test-jump-to-nonexistent-global/8-text" check-background-color-in-screen-row screen, 0/bg=cursor, 8/y, " | ", "F - test-jump-to-nonexistent-global/8-cursor" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " . .............................................................. ", "F - test-jump-to-nonexistent-global/8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-jump-to-nonexistent-global/9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-jump-to-nonexistent-global/10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-jump-to-nonexistent-global/11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-jump-to-nonexistent-global/12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-jump-to-nonexistent-global/13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-jump-to-nonexistent-global/14" # menu at bottom is correct in context check-screen-row screen, 0xf/y, " ^r run main enter go ^m create esc cancel ^a << ^b <word ^f word> ^e >> ", "F - test-jump-to-nonexistent-global/15-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-jump-to-nonexistent-global/15" # cancel edit-environment env, 0x1b/escape, 0/no-disk render-environment screen, env # hit ctrl-g again edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # word prepopulated like before, but no error check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-jump-to-nonexistent-global/test2-0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-jump-to-nonexistent-global/test2-1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-jump-to-nonexistent-global/test2-2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-jump-to-nonexistent-global/test2-3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-jump-to-nonexistent-global/test2-4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-jump-to-nonexistent-global/test2-5" check-screen-row screen, 6/y, " go to global (or leave blank to go to REPL) ", "F - test-jump-to-nonexistent-global/test2-6-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ................................................................ ", "F - test-jump-to-nonexistent-global/test2-6" check-screen-row-in-color screen, 4/fg=error, 7/y, " ", "F - test-jump-to-nonexistent-global/test2-7-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ................................................................ ", "F - test-jump-to-nonexistent-global/test2-7" # same word at cursor check-screen-row screen, 8/y, " f ", "F - test-jump-to-nonexistent-global/test2-8-text" # new cursor position check-background-color-in-screen-row screen, 0/bg=cursor, 8/y, " | ", "F - test-jump-to-nonexistent-global/test2-8-cursor" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " . .............................................................. ", "F - test-jump-to-nonexistent-global/test2-8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-jump-to-nonexistent-global/test2-9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-jump-to-nonexistent-global/test2-10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-jump-to-nonexistent-global/test2-11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-jump-to-nonexistent-global/test2-12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-jump-to-nonexistent-global/test2-13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-jump-to-nonexistent-global/test2-14" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-jump-to-nonexistent-global/test2-15" } fn test-create-global { var env-storage: environment var env/esi: (addr environment) <- address env-storage initialize-environment env, 8/fake-screen-width, 3/fake-screen-height # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 0x80/width, 0x30/height, 0/no-pixel-graphics # hit ctrl-g edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # type global name type-in env, screen, "fn1" # create edit-environment env, 0xd/ctrl-m, 0/no-disk render-environment screen, env # | global definitions | sandbox # cursor now on global side check-background-color-in-screen-row screen, 7/bg=cursor, 1/y, " | ", "F - test-create-global/1-cursor" # no modal check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-create-global/bg0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-create-global/bg1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-create-global/bg2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-create-global/bg3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-create-global/bg4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-create-global/bg5" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ", "F - test-create-global/bg6" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ", "F - test-create-global/bg7" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " ", "F - test-create-global/bg8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-create-global/bg9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-create-global/bg10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-create-global/bg11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-create-global/bg12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-create-global/bg13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-create-global/bg14" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-create-global/bg15" } fn test-create-nonexistent-global { var env-storage: environment var env/esi: (addr environment) <- address env-storage initialize-environment env, 8/fake-screen-width, 3/fake-screen-height # setup: screen var screen-on-stack: screen var screen/edi: (addr screen) <- address screen-on-stack initialize-screen screen, 0x80/width, 0x10/height, 0/no-pixel-graphics # define a global type-in env, screen, "(define f 42)" edit-environment env, 0x13/ctrl-s, 0/no-disk render-environment screen, env # type in its name type-in env, screen, "f" # hit ctrl-g edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # submit edit-environment env, 0xd/ctrl-m, 0/no-disk render-environment screen, env # modal now shows an error # | global definitions | sandbox check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-create-nonexistent-global/0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-create-nonexistent-global/1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-create-nonexistent-global/2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-create-nonexistent-global/3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-create-nonexistent-global/4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-create-nonexistent-global/5" check-screen-row screen, 6/y, " go to global (or leave blank to go to REPL) ", "F - test-create-nonexistent-global/6-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ................................................................ ", "F - test-create-nonexistent-global/6" check-screen-row-in-color screen, 4/fg=error, 7/y, " already exists ", "F - test-create-nonexistent-global/7-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ................................................................ ", "F - test-create-nonexistent-global/7" check-screen-row-in-color screen, 0/fg, 8/y, " f ", "F - test-create-nonexistent-global/8-text" check-background-color-in-screen-row screen, 0/bg=cursor, 8/y, " | ", "F - test-create-nonexistent-global/8-cursor" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " . .............................................................. ", "F - test-create-nonexistent-global/8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-create-nonexistent-global/9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-create-nonexistent-global/10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-create-nonexistent-global/11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-create-nonexistent-global/12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-create-nonexistent-global/13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-create-nonexistent-global/14" # menu at bottom is correct in context check-screen-row screen, 0xf/y, " ^r run main enter go ^m create esc cancel ^a << ^b <word ^f word> ^e >> ", "F - test-create-nonexistent-global/15-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-create-nonexistent-global/15" # cancel edit-environment env, 0x1b/escape, 0/no-disk render-environment screen, env # hit ctrl-g again edit-environment env, 7/ctrl-g, 0/no-disk render-environment screen, env # word prepopulated like before, but no error check-background-color-in-screen-row screen, 0xf/bg=modal, 0/y, " ", "F - test-create-nonexistent-global/test2-0" check-background-color-in-screen-row screen, 0xf/bg=modal, 1/y, " ", "F - test-create-nonexistent-global/test2-1" check-background-color-in-screen-row screen, 0xf/bg=modal, 2/y, " ", "F - test-create-nonexistent-global/test2-2" check-background-color-in-screen-row screen, 0xf/bg=modal, 3/y, " ", "F - test-create-nonexistent-global/test2-3" check-background-color-in-screen-row screen, 0xf/bg=modal, 4/y, " ", "F - test-create-nonexistent-global/test2-4" check-background-color-in-screen-row screen, 0xf/bg=modal, 5/y, " ", "F - test-create-nonexistent-global/test2-5" check-screen-row screen, 6/y, " go to global (or leave blank to go to REPL) ", "F - test-create-nonexistent-global/test2-6-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 6/y, " ................................................................ ", "F - test-create-nonexistent-global/test2-6" check-screen-row-in-color screen, 4/fg=error, 7/y, " ", "F - test-create-nonexistent-global/test2-7-text" check-background-color-in-screen-row screen, 0xf/bg=modal, 7/y, " ................................................................ ", "F - test-create-nonexistent-global/test2-7" # same word at cursor check-screen-row-in-color screen, 0/fg, 8/y, " f ", "F - test-create-nonexistent-global/test2-8-text" # new cursor position check-background-color-in-screen-row screen, 0/bg=cursor, 8/y, " | ", "F - test-create-nonexistent-global/test2-8-cursor" check-background-color-in-screen-row screen, 0xf/bg=modal, 8/y, " . .............................................................. ", "F - test-create-nonexistent-global/test2-8" check-background-color-in-screen-row screen, 0xf/bg=modal, 9/y, " ", "F - test-create-nonexistent-global/test2-9" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xa/y, " ", "F - test-create-nonexistent-global/test2-10" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xb/y, " ", "F - test-create-nonexistent-global/test2-11" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xc/y, " ", "F - test-create-nonexistent-global/test2-12" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xd/y, " ", "F - test-create-nonexistent-global/test2-13" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xe/y, " ", "F - test-create-nonexistent-global/test2-14" check-background-color-in-screen-row screen, 0xf/bg=modal, 0xf/y, " ", "F - test-create-nonexistent-global/test2-15" } fn render-go-modal screen: (addr screen), _self: (addr environment) { var self/esi: (addr environment) <- copy _self var width/eax: int <- copy 0 var height/ecx: int <- copy 0 width, height <- screen-size screen # xmin = max(0, width/2 - 0x20) var xmin: int var tmp/edx: int <- copy width tmp <- shift-right 1 tmp <- subtract 0x20/half-global-name-capacity { compare tmp, 0 break-if->= tmp <- copy 0 } copy-to xmin, tmp # xmax = min(width, width/2 + 0x20) var xmax: int tmp <- copy width tmp <- shift-right 1 tmp <- add 0x20/half-global-name-capacity { compare tmp, width break-if-<= tmp <- copy width } copy-to xmax, tmp # ymin = height/2 - 2 var ymin: int tmp <- copy height tmp <- shift-right 1 tmp <- subtract 2 copy-to ymin, tmp # ymax = height/2 + 1 var ymax: int tmp <- add 3 copy-to ymax, tmp # clear-rect screen, xmin, ymin, xmax, ymax, 0xf/bg=modal add-to xmin, 4 set-cursor-position screen, xmin, ymin draw-text-rightward-from-cursor screen, "go to global (or leave blank to go to REPL)", xmax, 8/fg=dark-grey, 0xf/bg=modal var partial-global-name-ah/eax: (addr handle gap-buffer) <- get self, partial-global-name var _partial-global-name/eax: (addr gap-buffer) <- lookup *partial-global-name-ah var partial-global-name/edx: (addr gap-buffer) <- copy _partial-global-name subtract-from xmin, 4 increment ymin { var go-modal-error-ah/eax: (addr handle array byte) <- get self, go-modal-error var go-modal-error/eax: (addr array byte) <- lookup *go-modal-error-ah compare go-modal-error, 0 break-if-= var dummy/eax: int <- draw-text-rightward screen, go-modal-error, xmin, xmax, ymin, 4/fg=error, 0xf/bg=modal } increment ymin var dummy/eax: int <- copy 0 var dummy2/ecx: int <- copy 0 dummy, dummy2 <- render-gap-buffer-wrapping-right-then-down screen, partial-global-name, xmin, ymin, xmax, ymax, 1/always-render-cursor, 0/fg=black, 0xf/bg=modal } fn render-go-modal-menu screen: (addr screen), _self: (addr environment) { var self/esi: (addr environment) <- copy _self var _width/eax: int <- copy 0 var height/ecx: int <- copy 0 _width, height <- screen-size screen var width/edx: int <- copy _width var y/ecx: int <- copy height y <- decrement var height/ebx: int <- copy y height <- increment clear-rect screen, 0/x, y, width, height, 0xc5/bg=blue-bg set-cursor-position screen, 0/x, y draw-text-rightward-from-cursor screen, " ^r ", width, 0/fg, 0x5c/bg=menu-highlight draw-text-rightward-from-cursor screen, " run main ", width, 7/fg, 0xc5/bg=blue-bg draw-text-rightward-from-cursor screen, " enter ", width, 0/fg, 0xc/bg=menu-really-highlight draw-text-rightward-from-cursor screen, " go ", width, 7/fg, 0xc5/bg=blue-bg draw-text-rightward-from-cursor screen, " ^m ", width, 0/fg, 0xc/bg=menu-really-highlight draw-text-rightward-from-cursor screen, " create ", width, 7/fg, 0xc5/bg=blue-bg draw-text-rightward-from-cursor screen, " esc ", width, 0/fg, 0x5c/bg=menu-highlight draw-text-rightward-from-cursor screen, " cancel ", width, 7/fg, 0xc5/bg=blue-bg draw-text-rightward-from-cursor screen, " ^a ", width, 0/fg, 0x5c/bg=menu-highlight draw-text-rightward-from-cursor screen, " << ", width, 7/fg, 0xc5/bg=blue-bg draw-text-rightward-from-cursor screen, " ^b ", width, 0/fg, 0x5c/bg=menu-highlight draw-text-rightward-from-cursor screen, " <word ", width, 7/fg, 0xc5/bg=blue-bg draw-text-rightward-from-cursor screen, " ^f ", width, 0/fg, 0x5c/bg=menu-highlight draw-text-rightward-from-cursor screen, " word> ", width, 7/fg, 0xc5/bg=blue-bg draw-text-rightward-from-cursor screen, " ^e ", width, 0/fg, 0x5c/bg=menu-highlight draw-text-rightward-from-cursor screen, " >> ", width, 7/fg, 0xc5/bg=blue-bg } fn word-at-cursor _self: (addr environment), out: (addr stream byte) { var self/esi: (addr environment) <- copy _self var cursor-in-go-modal-a/eax: (addr boolean) <- get self, cursor-in-go-modal? compare *cursor-in-go-modal-a, 0/false { break-if-= # cursor in go modal return } var cursor-in-globals-a/edx: (addr boolean) <- get self, cursor-in-globals? compare *cursor-in-globals-a, 0/false { break-if-= # cursor in some global editor var globals/eax: (addr global-table) <- get self, globals var cursor-index/ecx: int <- cursor-global globals var globals-data-ah/eax: (addr handle array global) <- get globals, data var globals-data/eax: (addr array global) <- lookup *globals-data-ah var cursor-offset/ecx: (offset global) <- compute-offset globals-data, cursor-index var curr-global/eax: (addr global) <- index globals-data, cursor-offset var curr-global-data-ah/eax: (addr handle gap-buffer) <- get curr-global, input var curr-global-data/eax: (addr gap-buffer) <- lookup *curr-global-data-ah word-at-gap curr-global-data, out return } # cursor in sandbox var sandbox/ecx: (addr sandbox) <- get self, sandbox var sandbox-data-ah/eax: (addr handle gap-buffer) <- get sandbox, data var sandbox-data/eax: (addr gap-buffer) <- lookup *sandbox-data-ah word-at-gap sandbox-data, out } # Gotcha: some saved state may not load. fn load-state _self: (addr environment), data-disk: (addr disk) { var self/esi: (addr environment) <- copy _self # data-disk -> stream var s-storage: (stream byte 0x40000) # space for 0x200/sectors var s/ebx: (addr stream byte) <- address s-storage draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "loading sectors from data disk", 3/fg, 0/bg move-cursor-to-left-margin-of-next-line 0/screen load-sectors data-disk, 0/lba, 0x200/sectors, s #? draw-stream-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, s, 7/fg, 0xc5/bg=blue-bg # stream -> gap-buffer (HACK: we temporarily cannibalize the sandbox's gap-buffer) draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "parsing", 3/fg, 0/bg move-cursor-to-left-margin-of-next-line 0/screen var sandbox/eax: (addr sandbox) <- get self, sandbox var data-ah/eax: (addr handle gap-buffer) <- get sandbox, data var data/eax: (addr gap-buffer) <- lookup *data-ah load-gap-buffer-from-stream data, s draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " into gap buffer", 3/fg, 0/bg move-cursor-to-left-margin-of-next-line 0/screen clear-stream s # read: gap-buffer -> cell var initial-root-storage: (handle cell) var initial-root/ecx: (addr handle cell) <- address initial-root-storage var trace-storage: trace var trace/edi: (addr trace) <- address trace-storage initialize-trace trace, 1/only-errors, 0x10/capacity, 0/visible read-cell data, initial-root, trace draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, " into s-expressions", 3/fg, 0/bg move-cursor-to-left-margin-of-next-line 0/screen clear-gap-buffer data # { var initial-root-addr/eax: (addr cell) <- lookup *initial-root compare initial-root-addr, 0 break-if-!= return } # load globals from assoc(initial-root, 'globals) var globals-literal-storage: (handle cell) var globals-literal-ah/eax: (addr handle cell) <- address globals-literal-storage new-symbol globals-literal-ah, "globals" var globals-literal/eax: (addr cell) <- lookup *globals-literal-ah var globals-cell-storage: (handle cell) var globals-cell-ah/edx: (addr handle cell) <- address globals-cell-storage clear-trace trace lookup-symbol globals-literal, globals-cell-ah, *initial-root, 0/no-globals, trace, 0/no-screen, 0/no-keyboard var globals-cell/eax: (addr cell) <- lookup *globals-cell-ah { compare globals-cell, 0 break-if-= var globals/eax: (addr global-table) <- get self, globals load-globals globals-cell-ah, globals } # sandbox = assoc(initial-root, 'sandbox) draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0/screen, "loading sandbox", 3/fg, 0/bg var sandbox-literal-storage: (handle cell) var sandbox-literal-ah/eax: (addr handle cell) <- address sandbox-literal-storage new-symbol sandbox-literal-ah, "sandbox" var sandbox-literal/eax: (addr cell) <- lookup *sandbox-literal-ah var sandbox-cell-storage: (handle cell) var sandbox-cell-ah/edx: (addr handle cell) <- address sandbox-cell-storage clear-trace trace lookup-symbol sandbox-literal, sandbox-cell-ah, *initial-root, 0/no-globals, trace, 0/no-screen, 0/no-keyboard var sandbox-cell/eax: (addr cell) <- lookup *sandbox-cell-ah { compare sandbox-cell, 0 break-if-= var sandbox-data-ah/eax: (addr handle stream byte) <- get sandbox-cell, text-data var _sandbox-data/eax: (addr stream byte) <- lookup *sandbox-data-ah var sandbox-data/ecx: (addr stream byte) <- copy _sandbox-data # stream -> gap-buffer var sandbox/eax: (addr sandbox) <- get self, sandbox var data-ah/eax: (addr handle gap-buffer) <- get sandbox, data var data/eax: (addr gap-buffer) <- lookup *data-ah load-gap-buffer-from-stream data, sandbox-data } } # Save state as an alist of alists: # ((globals . ((a . (fn ...)) # ...)) # (sandbox . ...)) fn store-state data-disk: (addr disk), sandbox: (addr sandbox), globals: (addr global-table) { compare data-disk, 0/no-disk { break-if-!= return } var stream-storage: (stream byte 0x40000) # space enough for 0x200/sectors var stream/edi: (addr stream byte) <- address stream-storage write stream, "(\n" write-globals stream, globals write-sandbox stream, sandbox write stream, ")\n" store-sectors data-disk, 0/lba, 0x200/sectors, stream }