Fix refresh clues bug, add COPYING and TODO files and add GPL header to crossword...
[curses-crossword.git] / curses_crossword.py
index e2b5bb63ba0c99cf66b747d2d11486cdeb86a6b9..d18a8d7033ab471fcf438a08c4379dd79a4617ff 100755 (executable)
@@ -3,6 +3,22 @@
 Play a crossword puzzle in a curses grid. Takes a command line argument of the
 crossword puzzle file.
 """
+# curses_crossword.py - play crosswords in a terminal
+# Copyright (C) 2009 Brett Parker <iDunno@sommitrealweird.co.uk>
+#
+# This program is free software; you can redistribute it and/or modify 
+# it under the terms of the GNU General Public License as published by 
+# the Free Software Foundation; either version 2 of the License, or 
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 import curses
 import curses.ascii
@@ -214,6 +230,8 @@ def crossword(stdscr, crossworddata):
     padtly = cury
 
     (padbry, padbrx) = stdscr.getmaxyx()
+    if padbry > cluespad.getmaxyx()[0] + padtly:
+        padbry = cluespad.getmaxyx()[0] + padtly
     cury = 0
     cluespad.addstr(cury, curx, "Across")
     cury += 1
@@ -254,10 +272,12 @@ def crossword(stdscr, crossworddata):
             if cluescury < cluespad.getmaxyx()[0] - (padbry - padtly):
                 cluescury += 1
             cluespad.refresh(cluescury, 0, padtly, padtlx, padbry - 1, padbrx - 1)
+            stdscr.refresh()
         if inch == curses.KEY_PPAGE:
             if cluescury > 0:
                 cluescury -= 1
             cluespad.refresh(cluescury, 0, padtly, padtlx, padbry - 1, padbrx - 1)
+            stdscr.refresh()
         if inch == curses.KEY_RIGHT:
             if gridx < (len(crossword["grid"][0]) - 1):
                 gridx += 1