Merge pull request #16 from spewspew/forpull - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 3f0e640d1eaf110d015506181383979f0b10a230
 (DIR) parent d3d56423183ecfcf6207ca8adb5a59d2950acf39
 (HTM) Author: Rob King <deadpixi@users.noreply.github.com>
       Date:   Tue, 30 Aug 2016 16:32:52 -0400
       
       Merge pull request #16 from spewspew/forpull
       
       Add beginning of line and end of line movement commands.
       Diffstat:
         commands.h.def                      |       2 ++
         include/commands.h                  |       2 ++
         samterm/main.c                      |      39 +++++++++++++++++++++++++++++--
       
       3 files changed, 41 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/commands.h.def b/commands.h.def
       @@ -30,6 +30,8 @@
         * Ccut         - cut text to the snarf buffer
         * Cexchange    - exchange operating system and sam snarf buffers
         * Cwrite       - write the current file to disk
       + * Cbol         - move to beginning of line
       + * Ceol         - move to end of line
         *
         * The default configuration shipped with sam has the keyboard commands mapped
         * to the "classic" Unix sam of the 1980s, plus the WordStar Diamond for cursor
 (DIR) diff --git a/include/commands.h b/include/commands.h
       @@ -27,6 +27,8 @@ enum{
            Cpaste,
            Cexchange,
            Cwrite,
       +    Ceol,
       +    Cbol,
            Cmax
        }; /* virtual command keystrokes */
        
 (DIR) diff --git a/samterm/main.c b/samterm/main.c
       @@ -1,4 +1,4 @@
       -//* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
       +/* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
        #include <u.h>
        #include <libc.h>
        #include <libg.h>
       @@ -517,6 +517,39 @@ cmdcharright(Flayer *l, long a, Text *t)
        }
        
        static long
       +cmdeol(Flayer *l, long a, Text *t)
       +{
       +    flsetselect(l, a, a);
       +    flushtyping(1);
       +    while(a < t->rasp.nrunes)
       +         if(raspc(&t->rasp, a++) == '\n') {
       +             a--;
       +             break;
       +         }
       +
       +    flsetselect(l, a, a);
       +    center(l, a);
       +
       +    return a;
       +}
       +
       +static long
       +cmdbol(Flayer *l, long a, Text *t)
       +{
       +    flsetselect(l, a, a);
       +    flushtyping(1);
       +    while(a > 0)
       +        if(raspc(&t->rasp, --a) == '\n') {
       +            a++;
       +            break;
       +    }
       +    flsetselect(l, a, a);
       +    center(l, a);
       +
       +    return a;
       +}
       +
       +static long
        cmdlineup(Flayer *l, long a, Text *t)
        {
            flsetselect(l, a, a);
       @@ -771,7 +804,9 @@ CommandEntry commands[Cmax] ={
            [Cdelword]    = {cmddelword,    1},
            [Cdelbol]     = {cmddelbol,     1},
            [Cdel]        = {cmddel,        1},
       -    [Cwrite]      = {cmdwrite,      1}
       +    [Cwrite]      = {cmdwrite,      1},
       +    [Ceol]        = {cmdeol,        0},
       +    [Cbol]        = {cmdbol,        0}
        };
        
        void