]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - tack/pad.c
ncurses 5.5
[ncurses.git] / tack / pad.c
index bc6c6933e614add8d52b18fd6f110f8a7ef47593..da1e3d78289537b8a1b1d583fa5e16dba06b13d1 100644 (file)
 ** 
 ** You should have received a copy of the GNU General Public License
 ** along with TACK; see the file COPYING.  If not, write to
-** the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-** Boston, MA 02111-1307, USA.
+** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+** Boston, MA 02110-1301, USA
 */
 
 #include <tack.h>
 
-MODULE_ID("$Id: pad.c,v 1.1 1998/01/10 00:30:27 tom Exp $")
+MODULE_ID("$Id: pad.c,v 1.6 2005/09/17 19:49:16 tom Exp $")
 
 /* test the pad counts on the terminal */
 
@@ -61,8 +61,6 @@ static void pad_smso(struct test_list *, int *, int *);
 static void pad_smacs(struct test_list *, int *, int *);
 static void pad_crash(struct test_list *, int *, int *);
 
-extern struct test_menu change_pad_menu;
-
 /*
    Any command found in this list, executed from a "Done" prompt
    will force the default action to repeat rather than next.
@@ -168,10 +166,8 @@ struct test_list pad_test_list[] = {
        {MENU_LAST, 0, 0, 0, 0, 0, 0}
 };
 
-extern int test_complete;      /* counts number of tests completed */
-
 /* globals */
-int hzcc;                      /* horizontal character count */
+static int hzcc;               /* horizontal character count */
 char letter;                   /* current character being displayed */
 int letter_number;             /* points into letters[] */
 int augment, repeats;          /* number of characters (or lines) effected */
@@ -448,12 +444,14 @@ pad_clear(
                                break;
                        }
                        clear_select++;
+                       /* FALLTHRU */
                case 2:
                        end_message = "Clear one character per line.  ";
                        if (newline) {
                                break;
                        }
                        clear_select++;
+                       /* FALLTHRU */
                case 3:
                        end_message = "Clear one full line.  ";
                        break;
@@ -1008,7 +1006,7 @@ pad_xch1(
        if (enter_insert_mode || exit_insert_mode ||
                enter_delete_mode || exit_delete_mode ||
                !insert_character || !delete_character) {
-               /* this test is quitely ignored */
+               /* this test is quietly ignored */
                return;
        }
        if (skip_pad_test(t, state, ch,
@@ -1025,7 +1023,7 @@ pad_xch1(
        } while(still_testing());
        pad_test_shutdown(t, 1);
        ptextln(xch1);
-       ptext("The preceeding two lines should be the same.  ");
+       ptext("The preceding two lines should be the same.  ");
        pad_done_message(t, state, ch);
 }
 
@@ -1272,7 +1270,7 @@ pad_rin(
        do {
                sprintf(temp, "%d\r", test_complete);
                put_str(temp);
-               if (scroll_reverse && augment == 1) {
+               if (scroll_reverse && repeats == 1) {
                        tt_putp(scroll_reverse);
                } else {
                        tt_putparm(parm_rindex, repeats, repeats, 0);
@@ -1343,7 +1341,7 @@ pad_il(
                }
        } while(still_testing());
        put_str("This line should be on the bottom.\r");
-       if (scroll_reverse && augment == 1) {
+       if (insert_line && augment == 1) {
                for (i = 1; i < lines; i++) {
                        tt_putp(insert_line);
                }
@@ -1384,8 +1382,13 @@ pad_indn(
                start_message = "(indn) Scroll-forward-n-lines start testing";
        } else {
                /* ind */
-               if (!scroll_forward && over_strike) {
+               if (!scroll_forward) {
                        CAP_NOT_FOUND;
+                       ptext("(ind) Scroll-forward not present.  ");
+                       pad_done_message(t, state, ch);
+                       return;
+               }
+               if (over_strike) {
                        ptext("(ind) Scroll-forward not tested on overstrike terminals.  ");
                        pad_done_message(t, state, ch);
                        return;
@@ -1402,14 +1405,14 @@ pad_indn(
        do {
                sprintf(temp, "%d\r", test_complete);
                put_str(temp);
-               if (augment > 1) {
-                       tt_putparm(parm_index, repeats, repeats, 0);
-               } else {
+               if (scroll_forward && repeats == 1) {
                        put_ind();
+               } else {
+                       tt_putparm(parm_index, repeats, repeats, 0);
                }
        } while(still_testing());
        put_str("This line should be on the top.\r");
-       if (augment == 1) {
+       if (scroll_forward && augment == 1) {
                for (i = 1; i < lines; i++) {
                        put_ind();
                }
@@ -1464,26 +1467,26 @@ pad_dl(
        pad_test_startup(1);
        do {
                sprintf(temp, "%d\r", test_complete);
-               if ((i & 0x7f) == 0 && augment < lines - 1) {
+               if (augment < lines - 1) {
                        go_home();
                        putln(temp);
                }
                put_str(temp);
-               if (repeats || !delete_line) {
-                       tt_putparm(parm_delete_line, repeats, repeats, 0);
-               } else {
+               if (delete_line && repeats == 1) {
                        tt_putp(delete_line);
+               } else {
+                       tt_putparm(parm_delete_line, repeats, repeats, 0);
                }
        } while(still_testing());
        home_down();
        put_str("This line should be on the top.");
        go_home();
-       if (repeats || !delete_line) {
-               tt_putparm(parm_delete_line, lines - 1, lines - 1, 0);
-       } else {
+       if (delete_line && augment == 1) {
                for (i = 1; i < lines; i++) {
                        tt_putp(delete_line);
                }
+       } else {
+               tt_putparm(parm_delete_line, lines - 1, lines - 1, 0);
        }
        sprintf(temp, "\nDelete %d line%s.  ", augment,
                augment == 1 ? "" : "s");
@@ -1752,7 +1755,7 @@ pad_csr_cup(
                        put_str(every_line);
                }
                tt_putparm(change_scroll_region, 1, 0, lines - 1);
-               tt_putparm(cursor_address, 1, lines - 1, strlen(every_line));
+               tt_putparm(cursor_address, 1, lines - 1, (int) strlen(every_line));
        } while(still_testing());
        pad_test_shutdown(t, 0);
        put_str("  ");