# HG changeset patch # User Steve Losh # Date 1342146918 14400 # Node ID f903877193f44c3440477159b5fde7b1fd50b19d # Parent 871d17fdead1b3a06bf6d32f0c393f2399503bd5 clojure-lanterna: Update site. diff -r 871d17fdead1 -r f903877193f4 clojure-lanterna/installation/index.html --- 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.

It has no other dependencies (aside from Lanterna itself, of course).

Add this to your project.clj:

-
[clojure-lanterna "1.0.0"]
+
[clojure-lanterna "0.9.1"]
 
diff -r 871d17fdead1 -r f903877193f4 clojure-lanterna/reference/index.html --- 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 @@
  • lanterna.terminal/start
  • lanterna.terminal/stop
  • lanterna.terminal/in-terminal
  • +
  • lanterna.terminal/get-size
  • lanterna.terminal/move-cursor
  • lanterna.terminal/put-character
  • lanterna.terminal/put-string
  • +
  • lanterna.terminal/clear
  • lanterna.terminal/set-fg-color
  • lanterna.terminal/set-bg-color
  • lanterna.terminal/set-style
  • @@ -33,9 +35,11 @@
  • lanterna.screen/start
  • lanterna.screen/stop
  • lanterna.screen/in-screen
  • +
  • lanterna.screen/get-size
  • lanterna.screen/redraw
  • lanterna.screen/move-cursor
  • lanterna.screen/put-string
  • +
  • lanterna.screen/clear
  • lanterna.screen/get-key
  • lanterna.screen/get-key-blocking
  • lanterna.screen/add-resize-listener
  • @@ -167,6 +171,12 @@ will actually happen.

    Use this if you don't need detailed control of the terminal starting and stopping process.

    +

    lanterna.terminal/get-size

    +
    (get-size terminal)
    +
    + + +

    Return the current size of the terminal as [cols rows].

    lanterna.terminal/move-cursor

    (move-cursor terminal x y)
     
    @@ -200,6 +210,13 @@

    Draw the string at the specified cursor location.

    The cursor will end up at the position directly after the string.

    +

    lanterna.terminal/clear

    +
    (clear terminal)
    +
    + + +

    Clear the given terminal.

    +

    The cursor will be at the coordinates 0, 0 after the clearing.

    lanterna.terminal/set-fg-color

    (set-fg-color terminal color)
     
    @@ -322,6 +339,12 @@ will actually happen.

    Use this if you don't need detailed control of the screen starting and stopping process.

    +

    lanterna.screen/get-size

    +
    (get-size screen)
    +
    + + +

    Return the current size of the screen as [cols rows].

    lanterna.screen/redraw

    (redraw screen)
     
    @@ -357,7 +380,15 @@ (default :default).
  • :styles - Styles to apply to the text. Must be a set containing zero or more style constants (default #{}). CURRENTLY BROKEN, SORRY
  • -

    lanterna.screen/get-key

    +

    lanterna.screen/clear

    +
    (clear screen)
    +
    + + +

    Clear the given screen.

    +

    Note that this is buffered just like every other screen-related action. You +need to redraw to actually see it happen.

    +

    lanterna.screen/get-key

    (get-key screen)
     
    diff -r 871d17fdead1 -r f903877193f4 clojure-lanterna/screens/index.html --- 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 @@
  • Moving the Cursor
  • Input
  • -
  • Resizing
  • +
  • Sizing
  • What's Next?
  • Getting a Screen

    @@ -134,9 +134,15 @@

    Go back and read the terminal docs if you don't understand those functions.

    -

    Resizing

    -

    Resizing works the same way as the terminal layer. Pass a resize listening -function when you create your screen:

    +

    Sizing

    +

    Sizing works the same way as the terminal layer. Screen have a get-size +function of their own:

    +
    (s/get-size scr)
    +; => [130 44]
    +
    + + +

    You can pass a resize listening function when you create your screen:

    (def screen-size (ref [0 0]))
     
     (defn handle-resize [cols rows]
    diff -r 871d17fdead1 -r f903877193f4 clojure-lanterna/terminals/index.html
    --- 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 @@
     
  • Colors
  • Styles
  • Input
  • -
  • Resizing
  • +
  • Sizing
  • What's Next?
  • Getting a Terminal

    @@ -158,12 +158,19 @@ -

    Resizing

    -

    The final piece of Lantera's terminal layer is the concept of resizing.

    +

    Sizing

    +

    The final piece of Lantera's terminal layer is the concept of terminal sizes.

    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.

    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.

    +

    First of all, you can get the size of the terminal at any time with get-size:

    +
    (t/get-size term)
    +; => [80 24]
    +
    + + +

    But getting the size at a single point in time usually won't be enough.

    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.