X-Git-Url: https://git.sommitrealweird.co.uk/curses-crossword.git/blobdiff_plain/3fc70686c19e36d7c5c490d6ebca63cff3393479..refs/heads/master:/curses_crossword.py diff --git a/curses_crossword.py b/curses_crossword.py index 88db74e..d18a8d7 100755 --- a/curses_crossword.py +++ b/curses_crossword.py @@ -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 +# +# 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,7 +230,8 @@ def crossword(stdscr, crossworddata): padtly = cury (padbry, padbrx) = stdscr.getmaxyx() - sys.stderr.write("Pady, padx, max bits: %dx%d, %dx%d\n" %(padtly, padtlx, padbry, padbrx)) + if padbry > cluespad.getmaxyx()[0] + padtly: + padbry = cluespad.getmaxyx()[0] + padtly cury = 0 cluespad.addstr(cury, curx, "Across") cury += 1 @@ -255,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