Steve Losh avatar Steve Losh committed f903877

clojure-lanterna: Update site.

Comments (0)

Files changed (4)

clojure-lanterna/installation/index.html

 versions, but I make no guarantees.</p>
 <p>It has no other dependencies (aside from Lanterna itself, of course).</p>
 <p>Add this to your <code>project.clj</code>:</p>
-<div class="codehilite"><pre><span class="p">[</span><span class="n">clojure</span><span class="o">-</span><span class="n">lanterna</span> "1<span class="p">.</span>0<span class="p">.</span>0"<span class="p">]</span>
+<div class="codehilite"><pre><span class="p">[</span><span class="n">clojure</span><span class="o">-</span><span class="n">lanterna</span> "0<span class="p">.</span>9<span class="p">.</span>1"<span class="p">]</span>
 </pre></div>
 
 

clojure-lanterna/reference/index.html

 <li><a href="#lanternaterminalstart">lanterna.terminal/start</a></li>
 <li><a href="#lanternaterminalstop">lanterna.terminal/stop</a></li>
 <li><a href="#lanternaterminalin-terminal">lanterna.terminal/in-terminal</a></li>
+<li><a href="#lanternaterminalget-size">lanterna.terminal/get-size</a></li>
 <li><a href="#lanternaterminalmove-cursor">lanterna.terminal/move-cursor</a></li>
 <li><a href="#lanternaterminalput-character">lanterna.terminal/put-character</a></li>
 <li><a href="#lanternaterminalput-string">lanterna.terminal/put-string</a></li>
+<li><a href="#lanternaterminalclear">lanterna.terminal/clear</a></li>
 <li><a href="#lanternaterminalset-fg-color">lanterna.terminal/set-fg-color</a></li>
 <li><a href="#lanternaterminalset-bg-color">lanterna.terminal/set-bg-color</a></li>
 <li><a href="#lanternaterminalset-style">lanterna.terminal/set-style</a></li>
 <li><a href="#lanternascreenstart">lanterna.screen/start</a></li>
 <li><a href="#lanternascreenstop">lanterna.screen/stop</a></li>
 <li><a href="#lanternascreenin-screen">lanterna.screen/in-screen</a></li>
+<li><a href="#lanternascreenget-size">lanterna.screen/get-size</a></li>
 <li><a href="#lanternascreenredraw">lanterna.screen/redraw</a></li>
 <li><a href="#lanternascreenmove-cursor">lanterna.screen/move-cursor</a></li>
 <li><a href="#lanternascreenput-string">lanterna.screen/put-string</a></li>
+<li><a href="#lanternascreenclear">lanterna.screen/clear</a></li>
 <li><a href="#lanternascreenget-key">lanterna.screen/get-key</a></li>
 <li><a href="#lanternascreenget-key-blocking">lanterna.screen/get-key-blocking</a></li>
 <li><a href="#lanternascreenadd-resize-listener">lanterna.screen/add-resize-listener</a></li>
 will actually happen.</p>
 <p>Use this if you don't need detailed control of the terminal starting and
 stopping process.</p>
+<h3 id="lanternaterminalget-size">lanterna.terminal/get-size</h3>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">get-size</span> <span class="nv">terminal</span><span class="p">)</span>
+</pre></div>
+
+
+<p>Return the current size of the terminal as <code>[cols rows]</code>.</p>
 <h3 id="lanternaterminalmove-cursor">lanterna.terminal/move-cursor</h3>
 <div class="codehilite"><pre><span class="p">(</span><span class="nf">move-cursor</span> <span class="nv">terminal</span> <span class="nv">x</span> <span class="nv">y</span><span class="p">)</span>
 </pre></div>
 
 <p>Draw the string at the specified cursor location.</p>
 <p>The cursor will end up at the position directly after the string.</p>
+<h3 id="lanternaterminalclear">lanterna.terminal/clear</h3>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">clear</span> <span class="nv">terminal</span><span class="p">)</span>
+</pre></div>
+
+
+<p>Clear the given terminal.</p>
+<p>The cursor will be at the coordinates 0, 0 after the clearing.</p>
 <h3 id="lanternaterminalset-fg-color">lanterna.terminal/set-fg-color</h3>
 <div class="codehilite"><pre><span class="p">(</span><span class="nf">set-fg-color</span> <span class="nv">terminal</span> <span class="nv">color</span><span class="p">)</span>
 </pre></div>
 will actually happen.</p>
 <p>Use this if you don't need detailed control of the screen starting and stopping
 process.</p>
+<h3 id="lanternascreenget-size">lanterna.screen/get-size</h3>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">get-size</span> <span class="nv">screen</span><span class="p">)</span>
+</pre></div>
+
+
+<p>Return the current size of the screen as <code>[cols rows]</code>.</p>
 <h3 id="lanternascreenredraw">lanterna.screen/redraw</h3>
 <div class="codehilite"><pre><span class="p">(</span><span class="nf">redraw</span> <span class="nv">screen</span><span class="p">)</span>
 </pre></div>
   (default <code>:default</code>).</li>
 <li><code>:styles</code> - Styles to apply to the text.  Must be a set containing zero or
   more <a href="#styles">style constants</a> (default <code>#{}</code>).  <strong>CURRENTLY BROKEN, SORRY</strong></li>
-</ul><h3 id="lanternascreenget-key">lanterna.screen/get-key</h3>
+</ul><h3 id="lanternascreenclear">lanterna.screen/clear</h3>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">clear</span> <span class="nv">screen</span><span class="p">)</span>
+</pre></div>
+
+
+<p>Clear the given screen.</p>
+<p>Note that this is buffered just like every other screen-related action.  You
+need to <a href="#lanternascreenredraw"><code>redraw</code></a> to actually see it happen.</p>
+<h3 id="lanternascreenget-key">lanterna.screen/get-key</h3>
 <div class="codehilite"><pre><span class="p">(</span><span class="nf">get-key</span> <span class="nv">screen</span><span class="p">)</span>
 </pre></div>
 

clojure-lanterna/screens/index.html

 </ul></li>
 <li><a href="#moving-the-cursor">Moving the Cursor</a></li>
 <li><a href="#input">Input</a></li>
-<li><a href="#resizing">Resizing</a></li>
+<li><a href="#sizing">Sizing</a></li>
 <li><a href="#whats-next">What's Next?</a></li>
 </ul></div>
 <h2 id="getting-a-screen">Getting a Screen</h2>
 
 
 <p>Go back and read the terminal docs if you don't understand those functions.</p>
-<h2 id="resizing">Resizing</h2>
-<p>Resizing works the same way as the terminal layer.  Pass a resize listening
-function when you create your screen:</p>
+<h2 id="sizing">Sizing</h2>
+<p>Sizing works the same way as the terminal layer.  Screen have a <code>get-size</code>
+function of their own:</p>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">s/get-size</span> <span class="nv">scr</span><span class="p">)</span>
+<span class="c1">; =&gt; [130 44]</span>
+</pre></div>
+
+
+<p>You can pass a resize listening function when you create your screen:</p>
 <div class="codehilite"><pre><span class="p">(</span><span class="k">def </span><span class="nv">screen-size</span> <span class="p">(</span><span class="nb">ref </span><span class="p">[</span><span class="mi">0</span> <span class="mi">0</span><span class="p">]))</span>
 
 <span class="p">(</span><span class="kd">defn </span><span class="nv">handle-resize</span> <span class="p">[</span><span class="nv">cols</span> <span class="nv">rows</span><span class="p">]</span>

clojure-lanterna/terminals/index.html

 <li><a href="#colors">Colors</a></li>
 <li><a href="#styles">Styles</a></li>
 <li><a href="#input">Input</a></li>
-<li><a href="#resizing">Resizing</a></li>
+<li><a href="#sizing">Sizing</a></li>
 <li><a href="#whats-next">What's Next?</a></li>
 </ul></div>
 <h2 id="getting-a-terminal">Getting a Terminal</h2>
 </pre></div>
 
 
-<h2 id="resizing">Resizing</h2>
-<p>The final piece of Lantera's terminal layer is the concept of resizing.</p>
+<h2 id="sizing">Sizing</h2>
+<p>The final piece of Lantera's terminal layer is the concept of terminal sizes.</p>
 <p>When writing a terminal application, you're at the mercy of the user when it
 comes to how big (or small) the window is going to be.</p>
 <p>Obviously in a console environment the user can resize their xterm window.
 Lanterna's Swing terminal emulator can be resized by dragging normally as well.</p>
+<p>First of all, you can get the size of the terminal at any time with <code>get-size</code>:</p>
+<div class="codehilite"><pre><span class="p">(</span><span class="nf">t/get-size</span> <span class="nv">term</span><span class="p">)</span>
+<span class="c1">; =&gt; [80 24]</span>
+</pre></div>
+
+
+<p>But getting the size at a single point in time usually won't be enough.</p>
 <p>Your application needs to be able to handle resized windows.  To do this you can
 provide a function when you create the terminal.  This function will be called
 by Lanterna whenever the window is resized and passed the new columns and rows.</p>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.