git: cgram(6): Sync the rewritten version from NetBSD

Aaron LI aly at crater.dragonflybsd.org
Mon Feb 22 06:34:03 PST 2021


commit 564d76995a9b0d872beace4bedee44a79e102dce
Author: Aaron LI <aly at aaronly.me>
Date:   Mon Feb 22 21:51:58 2021 +0800

    cgram(6): Sync the rewritten version from NetBSD
    
    Fixes:
    
    * Do not consider the puzzle solved if all letters in the visible area
      are substituted correctly.  To be properly solved, the whole puzzle
      must be solved, even those parts that are currently off-screen.
    
    * Never place the cursor at the very right edge of the screen since that
      does not work well with some terminals.  The maximum valid x
      coordinate is COLS - 1.
    
    * Add horizontal scrolling.  Make all coordinate handling symmetric in
      regard to the horizontal and vertical axes.  Previously, lines longer
      than 80 characters could not be seen on the screen.
    
    * Fix undefined behavior when pressing function keys, which was
      resulting parts of the screen being cleaned.
    
    Improvements:
    
    * Remove the arbitrary limit of 128 characters per line.  Even if
      fortune(6) may never generate such long lines, the code is easy
      enough to adapt to other sources.
    
    * Properly clean up the allocated memory.  Previously, only the string
      arrays were freed but not the strings themselves.
    
    * Allow navigation with page up/down keys.
    
    * Consistently use char for characters, avoiding converting back and
      forth between char, unsigned char and int.

Summary of changes:
 games/cgram/cgram.c | 525 +++++++++++++++++++++++++++++++++-------------------
 1 file changed, 336 insertions(+), 189 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/564d76995a9b0d872beace4bedee44a79e102dce


-- 
DragonFly BSD source repository


More information about the Commits mailing list