f903877193f4

clojure-lanterna: Update site.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Thu, 12 Jul 2012 22:35:18 -0400
parents 871d17fdead1
children 10f91124d5a9
branches/tags (none)
files clojure-lanterna/installation/index.html clojure-lanterna/reference/index.html clojure-lanterna/screens/index.html clojure-lanterna/terminals/index.html

Changes

--- a/clojure-lanterna/installation/index.html	Sat Jul 07 15:23:49 2012 -0400
+++ b/clojure-lanterna/installation/index.html	Thu Jul 12 22:35:18 2012 -0400
@@ -6,7 +6,7 @@
 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>
 
 
--- a/clojure-lanterna/reference/index.html	Sat Jul 07 15:23:49 2012 -0400
+++ b/clojure-lanterna/reference/index.html	Thu Jul 12 22:35:18 2012 -0400
@@ -17,9 +17,11 @@
 <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>
@@ -33,9 +35,11 @@
 <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>
@@ -167,6 +171,12 @@
 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>
@@ -200,6 +210,13 @@
 
 <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>
@@ -322,6 +339,12 @@
 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>
@@ -357,7 +380,15 @@
   (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>
 
--- a/clojure-lanterna/screens/index.html	Sat Jul 07 15:23:49 2012 -0400
+++ b/clojure-lanterna/screens/index.html	Thu Jul 12 22:35:18 2012 -0400
@@ -21,7 +21,7 @@
 </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>
@@ -134,9 +134,15 @@
 
 
 <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>
--- a/clojure-lanterna/terminals/index.html	Sat Jul 07 15:23:49 2012 -0400
+++ b/clojure-lanterna/terminals/index.html	Thu Jul 12 22:35:18 2012 -0400
@@ -12,7 +12,7 @@
 <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>
@@ -158,12 +158,19 @@
 </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>