Deleted Added
sdiff udiff text old ( 192850 ) new ( 192914 )
full compact
1/*
2 | new_curse.c
3 |
4 | A subset of curses developed for use with ae.
5 |
6 | written by Hugh Mahon
7 |
8 | THIS MATERIAL IS PROVIDED "AS IS". THERE ARE
9 | NO WARRANTIES OF ANY KIND WITH REGARD TO THIS
10 | MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE
11 | IMPLIED WARRANTIES OF MERCHANTABILITY AND
12 | FITNESS FOR A PARTICULAR PURPOSE. Neither
13 | Hewlett-Packard nor Hugh Mahon shall be liable
14 | for errors contained herein, nor for
15 | incidental or consequential damages in
16 | connection with the furnishing, performance or
17 | use of this material. Neither Hewlett-Packard
18 | nor Hugh Mahon assumes any responsibility for
19 | the use or reliability of this software or
20 | documentation. This software and
21 | documentation is totally UNSUPPORTED. There
22 | is no support contract available. Hewlett-
23 | Packard has done NO Quality Assurance on ANY
24 | of the program or documentation. You may find
25 | the quality of the materials inferior to
26 | supported materials.
27 |
28 | This software is not a product of Hewlett-Packard, Co., or any
29 | other company. No support is implied or offered with this software.
30 | You've got the source, and you're on your own.
31 |
32 | This software may be distributed under the terms of Larry Wall's
33 | Artistic license, a copy of which is included in this distribution.
34 |
35 | This notice must be included with this software and any derivatives.
36 |
37 | Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon
38 | All are rights reserved.
39 |
40 | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.50 2001/01/19 02:53:40 hugh Exp hugh $
41 |
42 */
43
44char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon",
45 "All rights are reserved."};
46
47char * new_curse_name= "@(#) new_curse.c $Revision: 1.50 $";
48
49#include "new_curse.h"
50#include <signal.h>
51#include <fcntl.h>
52
53#ifdef SYS5
54#include <string.h>
55#else

--- 440 unchanged lines hidden (view full) ---

496int Num_bits; /* number of bits per character */
497int Flip_Bytes; /* some systems have byte order reversed */
498int interrupt_flag = FALSE; /* set true if SIGWINCH received */
499
500#ifndef CAP
501char *Strings;
502#endif
503
504struct KEYS {
505 int length; /* length of string sent by key */
506 char *string; /* string sent by key */
507 int value; /* CURSES value of key (9-bit) */
508 };
509
510struct KEY_STACK {
511 struct KEYS *element;

--- 141 unchanged lines hidden (view full) ---

653int Booleans[128];
654int Numbers[128];
655char *String_table[1024];
656
657int *virtual_lines;
658
659static char nc_scrolling_ability = FALSE;
660
661#ifdef CAP
662
663#if defined(__STDC__) || defined(__cplusplus)
664#define P_(s) s
665#else
666#define P_(s) ()
667#endif /* __STDC__ */
668

--- 93 unchanged lines hidden (view full) ---

762 interrupt_flag = TRUE;
763}
764#endif /* SIGWINCH */
765
766void
767initscr() /* initialize terminal for operations */
768{
769 int value;
770 char *lines_string;
771 char *columns_string;
772#ifdef CAP
773 char *pointer;
774#endif /* CAP */
775
776#ifdef DIAG
777printf("starting initscr \n");fflush(stdout);

--- 116 unchanged lines hidden (view full) ---

894 Fildes = -1;
895 TERM_PATH = getenv("TERMINFO");
896 if (TERM_PATH != NULL)
897 {
898 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
899 Term_File_name = malloc(Data_Line_len);
900 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
901 Fildes = open(Term_File_name, O_RDONLY);
902 }
903 if (Fildes == -1)
904 {
905 TERM_PATH = "/usr/lib/terminfo";
906 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
907 Term_File_name = malloc(Data_Line_len);
908 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
909 Fildes = open(Term_File_name, O_RDONLY);
910 }
911 if (Fildes == -1)
912 {
913 TERM_PATH = "/usr/share/lib/terminfo";
914 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
915 Term_File_name = malloc(Data_Line_len);
916 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
917 Fildes = open(Term_File_name, O_RDONLY);
918 }
919 if (Fildes == -1)
920 {
921 TERM_PATH = "/usr/share/terminfo";
922 Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
923 Term_File_name = malloc(Data_Line_len);
924 sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
925 Fildes = open(Term_File_name, O_RDONLY);
926 }
927 if (Fildes == -1)
928 {
929 free(Term_File_name);
930 Term_File_name = NULL;
931 }
932 else
933 TERM_INFO = INFO_PARSE();
934#else
935 /*
936 | termcap information can be in the TERMCAP env variable, if so
937 | use that, otherwise check the /etc/termcap file
938 */
939 if ((pointer = Term_File_name = getenv("TERMCAP")) != NULL)
940 {
941 if (*Term_File_name != '/')
942 Term_File_name = "/etc/termcap";
943 }
944 else
945 {
946 Term_File_name = "/etc/termcap";
947 }
948 if ((TFP = fopen(Term_File_name, "r")) == NULL)
949 {
950 printf("unable to open /etc/termcap file \n");
951 exit(0);
952 }
953 for (value = 0; value < 1024; value++)
954 String_table[value] = NULL;
955 for (value = 0; value < 128; value++)
956 Booleans[value] = 0;
957 for (value = 0; value < 128; value++)
958 Numbers[value] = 0;

--- 141 unchanged lines hidden (view full) ---

1100 Num_names--;
1101 }
1102 counter = 0;
1103 while (Num_bools)
1104 {
1105 Num_bools--;
1106 Booleans[counter++] = *TERM_data_ptr++;
1107 }
1108 if (((unsigned int) TERM_data_ptr) & 1) /* force alignment */
1109 TERM_data_ptr++;
1110 counter = 0;
1111 while (Num_ints)
1112 {
1113 Num_ints--;
1114 Numbers[counter] = Get_int();
1115 counter++;
1116 }

--- 238 unchanged lines hidden (view full) ---

1355}
1356
1357void
1358Find_term() /* find terminal description in termcap file */
1359{
1360 char *Name;
1361 char *Ftemp;
1362
1363 Ftemp = Name = malloc(strlen(TERMINAL_TYPE + 1) + 1);
1364 strcpy(Name, TERMINAL_TYPE);
1365 while (*Ftemp != (char)NULL)
1366 Ftemp++;
1367 *Ftemp++ = '|';
1368 *Ftemp = (char)NULL;
1369 CFOUND = FALSE;
1370 Data_Line_len = strlen(TERMINAL_TYPE) + 1;
1371 while ((!CFOUND) && ((TERM_data_ptr=fgets(Data_Line, 512, TFP)) != NULL))

--- 91 unchanged lines hidden (view full) ---

1463 tmp = (struct _line *) malloc(sizeof (struct _line));
1464 tmp->row = malloc(columns + 1);
1465 tmp->attributes = malloc(columns + 1);
1466 tmp->prev_screen = NULL;
1467 tmp->next_screen = NULL;
1468 for (i = 0; i < columns; i++)
1469 {
1470 tmp->row[i] = ' ';
1471 tmp->attributes[i] = (char) NULL;
1472 }
1473 tmp->scroll = tmp->changed = FALSE;
1474 tmp->row[0] = (char) NULL;
1475 tmp->attributes[0] = (char) NULL;
1476 tmp->row[columns] = (char) NULL;
1477 tmp->attributes[columns] = (char) NULL;
1478 tmp->last_char = 0;
1479 return(tmp);
1480}
1481
1482WINDOW *newwin(lines, cols, start_l, start_c)
1483int lines, cols; /* number of lines and columns to be in window */
1484int start_l, start_c; /* starting line and column to be inwindow */
1485{

--- 368 unchanged lines hidden (view full) ---

1854 {
1855 for (temp = 1; (place != 0); temp++)
1856 {
1857 p[temp] = p_list[--place];
1858 }
1859 }
1860 delay = 0;
1861 Otemp = string;
1862 while (*Otemp != (char) NULL)
1863 {
1864 if (*Otemp == '%')
1865 {
1866 Otemp++;
1867 if ((*Otemp == '?') || (*Otemp == 't') || (*Otemp == 'e') || (*Otemp == ';'))
1868 {
1869 if (*Otemp == '?')
1870 {
1871 Otemp++;
1872 Cond_FLAG = TRUE;
1873 EVAL = TRUE;
1874 while (EVAL)
1875 {
1876 /*
1877 | find the end of the
1878 | conditional statement
1879 */
1880 while ((strncmp(Otemp, "%t", 2)) && (*Otemp != (char) NULL))
1881 {
1882 /*
1883 | move past '%'
1884 */
1885 Otemp++;
1886 Cond_place = Operation(Cond_Stack, Cond_place);
1887 }
1888

--- 11 unchanged lines hidden (view full) ---

1900 Otemp++;
1901 }
1902 else /* condition is false */
1903 {
1904 /*
1905 | find 'else' or end
1906 | of if statement
1907 */
1908 while ((strncmp(Otemp, "%e", 2)) && (strncmp(Otemp, "%;", 2)) && (*Otemp != (char) NULL))
1909 Otemp++;
1910 /*
1911 | if an 'else' found
1912 */
1913 if ((*Otemp != (char) NULL) && (!strncmp(Otemp, "%e", 2)))
1914 {
1915 Otemp++;
1916 Otemp++;
1917 tchar = Otemp;
1918 /*
1919 | check for 'then' part
1920 */
1921 while ((*tchar != (char) NULL) && (strncmp(tchar, "%t", 2)) && (strncmp(tchar, "%;", 2)))
1922 tchar++;
1923 /*
1924 | if end of string
1925 */
1926 if (*tchar == (char) NULL)
1927 {
1928 EVAL = FALSE;
1929 Cond_FLAG = FALSE;
1930 Otemp = tchar;
1931 }
1932 /*
1933 | if end of if found,
1934 | set up to parse

--- 7 unchanged lines hidden (view full) ---

1942 | 'else'
1943 */
1944 }
1945 /*
1946 | if end of if found,
1947 | get out of if
1948 | statement
1949 */
1950 else if ((*Otemp != (char) NULL) && (!strncmp(Otemp, "%;", 2)))
1951 {
1952 EVAL = FALSE;
1953 Otemp++;
1954 Otemp++;
1955 }
1956 else /* Otemp == NULL */
1957 {
1958 EVAL = FALSE;
1959 Cond_FLAG = FALSE;
1960 }
1961 }
1962 }
1963 }
1964 else
1965 {
1966 Otemp++;
1967 Cond_FLAG = FALSE;
1968 if (*Otemp != ';')
1969 {
1970 while ((*Otemp != (char) NULL) && (strncmp(Otemp, "%;", 2)))
1971 Otemp++;
1972 if (*Otemp != (char) NULL)
1973 {
1974 Otemp++;
1975 Otemp++;
1976 }
1977 }
1978 else
1979 Otemp++;
1980 }

--- 52 unchanged lines hidden (view full) ---

2033{
2034 int j;
2035
2036 if (column > line->last_char)
2037 {
2038 for (j = line->last_char; j < column; j++)
2039 {
2040 line->row[j] = ' ';
2041 line->attributes[j] = (char) NULL;
2042 }
2043 }
2044 line->last_char = column;
2045 line->row[column] = (char) NULL;
2046 line->attributes[column] = (char) NULL;
2047 line->changed = TRUE;
2048}
2049
2050void
2051werase(window) /* clear the specified window */
2052WINDOW *window;
2053{
2054 int i;

--- 115 unchanged lines hidden (view full) ---

2170 }
2171 for (user_col = user_line->last_char,
2172 virt_col = window->SC + user_line->last_char;
2173 (virt_col < virtual_scr->Num_cols)
2174 && (user_col < window->Num_cols);
2175 virt_col++, user_col++)
2176 {
2177 virtual_line->row[virt_col] = ' ';
2178 virtual_line->attributes[virt_col] = (char) NULL;
2179 }
2180 }
2181 if (virtual_scr->Num_cols != window->Num_cols)
2182 {
2183 if (virtual_line->last_char < (user_line->last_char + window->SC))
2184 {
2185 if (virtual_line->row[virtual_line->last_char] == (char) NULL)
2186 virtual_line->row[virtual_line->last_char] = ' ';
2187 virtual_line->last_char =
2188 min(virtual_scr->Num_cols,
2189 (user_line->last_char + window->SC));
2190 }
2191 }
2192 else
2193 virtual_line->last_char = user_line->last_char;
2194 virtual_line->row[virtual_line->last_char] = (char) NULL;
2195 virtual_line->changed = user_line->changed;
2196 virtual_line = virtual_line->next_screen;
2197 user_line = user_line->next_screen;
2198 }
2199 window->SCROLL_CLEAR = FALSE;
2200 window->scroll_up = window->scroll_down = 0;
2201 last_window_refreshed = window;
2202}

--- 128 unchanged lines hidden (view full) ---

2331 struct KEY_STACK *St_point;
2332#if (!defined( BSD_SELECT)) || (!defined(SYS5))
2333 int value;
2334#endif /* BSD_SELECT */
2335
2336 Count = 0;
2337 Gtemp = string;
2338 string[Count++] = first_char;
2339 string[Count] = (char) NULL;
2340 Time_Out = FALSE;
2341#ifndef BSD_SELECT
2342 signal(SIGALRM, Clear);
2343 value = alarm(1);
2344#endif /* BSD_SELECT */
2345 Noblock = TRUE;
2346#ifdef SYS5
2347 Gterminal.c_cc[VTIME] = 0; /* timeout value */

--- 7 unchanged lines hidden (view full) ---

2355 in_char = wgetch(stdscr);
2356#ifdef DEBUG
2357fprintf(stderr, "back in GetKey()\n");
2358fflush(stderr);
2359#endif /* DEBUG */
2360 if (in_char != -1)
2361 {
2362 string[Count++] = in_char;
2363 string[Count] = (char) NULL;
2364 St_point = KEY_TOS;
2365 while ((St_point != NULL) && (!Found))
2366 {
2367 if (!strcmp(string, St_point->element->string))
2368 Found = TRUE;
2369 else
2370 St_point = St_point->next;
2371 }

--- 69 unchanged lines hidden (view full) ---

2441 tmpline->attributes[column] = window->Attrib;
2442 tmpline->changed = TRUE;
2443 if (column >= tmpline->last_char)
2444 {
2445 if (column > tmpline->last_char)
2446 for (j = tmpline->last_char; j < column; j++)
2447 {
2448 tmpline->row[j] = ' ';
2449 tmpline->attributes[j] = (char) NULL;
2450 }
2451 tmpline->row[column + 1] = (char) NULL;
2452 tmpline->attributes[column + 1] = (char) NULL;
2453 tmpline->last_char = column + 1;
2454 }
2455 }
2456 if (c == '\n')
2457 {
2458 wclrtoeol(window);
2459 window->LX = window->Num_cols;
2460 }

--- 161 unchanged lines hidden (view full) ---

2622
2623void
2624waddstr(window, string) /* write 'string' in window */
2625WINDOW *window;
2626char *string;
2627{
2628 char *wstring;
2629
2630 for (wstring = string; *wstring != (char) NULL; wstring++)
2631 waddch(window, *wstring);
2632}
2633
2634void
2635clearok(window, flag) /* erase screen and redraw at next refresh */
2636WINDOW *window;
2637int flag;
2638{

--- 61 unchanged lines hidden (view full) ---

2700noraw() /* set to normal character read mode */
2701{
2702 int value;
2703
2704#ifdef SYS5
2705 Terminal.c_lflag |= ICANON; /* enable canonical operation */
2706 Terminal.c_lflag |= ISIG; /* enable signal checking */
2707 Terminal.c_cc[VEOF] = 4; /* EOF character = 4 */
2708 Terminal.c_cc[VEOL] = (char) NULL; /* EOL = 0 */
2709 Terminal.c_cc[VINTR] = Intr; /* reset interrupt char */
2710 value = ioctl(0, TCSETA, &Terminal); /* set characteristics */
2711#else
2712 Terminal.sg_flags &= ~RAW; /* disable raw mode */
2713 value = ioctl(0, TIOCSETP, &Terminal); /* set characteristics */
2714/* old_arg = fcntl(0, F_GETFL, 0);
2715 value = fcntl(0, F_SETFL, old_arg & ~FNDELAY);*/
2716#endif

--- 151 unchanged lines hidden (view full) ---

2868 va_start(ap);
2869 window = va_arg(ap, WINDOW *);
2870 format = va_arg(ap, char *);
2871#else /* __STDC__ */
2872 va_start(ap, format);
2873#endif /* __STDC__ */
2874
2875 fpoint = (char *) format;
2876 while (*fpoint != (char) NULL)
2877 {
2878 if (*fpoint == '%')
2879 {
2880 fpoint++;
2881 if (*fpoint == 'd')
2882 {
2883 value = va_arg(ap, int);
2884 iout(window, value);

--- 60 unchanged lines hidden (view full) ---

2945 if (line1->last_char != line2->last_char)
2946 return(2);
2947
2948 c1 = line1->row;
2949 c2 = line2->row;
2950 att1 = line1->attributes;
2951 att2 = line2->attributes;
2952 i = 0;
2953 while ((c1[i] != (char) NULL) && (c2[i] != (char) NULL) && (c1[i] == c2[i]) && (att1[i] == att2[i]))
2954 i++;
2955 count1 = i + 1;
2956 if ((count1 == 1) && (c1[i] == (char) NULL) && (c2[i] == (char) NULL))
2957 count1 = 0; /* both lines blank */
2958 else if ((c1[i] == (char) NULL) && (c2[i] == (char) NULL))
2959 count1 = -1; /* equal */
2960 else
2961 count1 = 1; /* lines unequal */
2962 return(count1);
2963}
2964
2965struct _line *
2966Insert_line(row, end_row, window) /* insert line into screen */

--- 136 unchanged lines hidden (view full) ---

3103 int x, y;
3104 struct _line *tmp1;
3105
3106 for (y = 0, tmp1 = curscr->first_line; (y < (window->SR+row)) && (tmp1->next_screen != NULL); y++)
3107 tmp1 = tmp1->next_screen;
3108 for (x = column; x<window->Num_cols; x++)
3109 {
3110 tmp1->row[x] = ' ';
3111 tmp1->attributes[x] = (char) NULL;
3112 }
3113 tmp1->row[column] = (char) NULL;
3114 tmp1->last_char = column;
3115 if (column < COLS)
3116 {
3117 if (STAND)
3118 {
3119 STAND = FALSE;
3120 Position(window, row, column);
3121 attribute_off();

--- 25 unchanged lines hidden (view full) ---

3147 char *new_att;
3148
3149 changed = FALSE;
3150 new_lin = pointer_new->row;
3151 new_att = pointer_new->attributes;
3152 old_lin = pointer_old->row;
3153 old_att = pointer_old->attributes;
3154 end_old = end_new = offset;
3155 while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (old_lin[end_old] != (char) NULL) && (new_lin[end_old] != (char) NULL))
3156 end_old++;
3157 if (old_lin[end_old] != (char) NULL)
3158 {
3159 k = 0;
3160 while ((old_lin[end_old+k] == new_lin[end_new+k]) && (new_att[end_new+k] == old_att[end_old+k]) && (new_lin[end_new+k] != (char) NULL) && (old_lin[end_old+k] != (char) NULL) && (k < 10))
3161 k++;
3162 if ((k > 8) || ((new_lin[end_new+k] == (char) NULL) && (k != 0)))
3163 {
3164 if (new_lin[end_new+k] == (char) NULL)
3165 {
3166 Position(window, line, (end_new+k));
3167 CLEAR_TO_EOL(window, line, (end_new+k));
3168 }
3169 Position(window, line, offset);
3170 for (k = offset; k < end_old; k++)
3171 Char_del(old_lin, old_att, offset, window->Num_cols);
3172 while ((old_lin[offset] != (char) NULL) && (offset < COLS))
3173 offset++;
3174 pointer_old->last_char = offset;
3175 changed = TRUE;
3176 }
3177 }
3178 return(changed);
3179}
3180

--- 20 unchanged lines hidden (view full) ---

3201 char *new_att;
3202
3203 changed = FALSE;
3204 new_lin = pointer_new->row;
3205 new_att = pointer_new->attributes;
3206 old_lin = pointer_old->row;
3207 old_att = pointer_old->attributes;
3208 end_old = end_new = offset;
3209 while (((new_lin[end_new] != old_lin[end_old]) || (new_att[end_new] != old_att[end_old])) && (new_lin[end_new] != (char) NULL) && (old_lin[end_new] != (char) NULL))
3210 end_new++;
3211 if (new_lin[end_new] != (char) NULL)
3212 {
3213 k = 0;
3214 while ((old_lin[end_old+k] == new_lin[end_new+k]) && (old_att[end_old+k] == new_att[end_new+k]) && (new_lin[end_new+k] != (char) NULL) && (old_lin[end_old+k] != (char) NULL) && (k < 10))
3215 k++;
3216 /*
3217 | check for commonality between rest of lines (are the old
3218 | and new lines the same, except for a chunk in the middle?)
3219 | if the rest of the lines are common, do not insert text
3220 */
3221 old_off = end_new;
3222 while ((old_lin[old_off] != (char) NULL) && (new_lin[old_off] != (char) NULL) && (old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off]))
3223 old_off++;
3224 if ((old_lin[old_off] == new_lin[old_off]) && (old_att[old_off] == new_att[old_off]))
3225 same = TRUE;
3226 if ((!same) && ((k > 8) || ((new_lin[end_new+k] == (char) NULL) && (k != 0))))
3227 {
3228 Position(window, line, offset);
3229 insert = FALSE;
3230 if (String_table[ic__] == NULL)
3231 {
3232 String_Out(String_table[im__], NULL, 0);
3233 insert = TRUE;
3234 }
3235 for (k = offset; k < end_new; k++)
3236 {
3237 if (!insert)
3238 String_Out(String_table[ic__], NULL, 0);
3239 Char_ins(old_lin, old_att, new_lin[k], new_att[k], k, window->Num_cols);
3240 }
3241 if (insert)
3242 String_Out(String_table[ei__], NULL, 0);
3243 while ((old_lin[offset] != (char) NULL) && (offset < COLS))
3244 offset++;
3245 pointer_old->last_char = offset;
3246 changed = TRUE;
3247 }
3248 }
3249 return(changed);
3250}
3251

--- 54 unchanged lines hidden (view full) ---

3306 putchar(' ');
3307 }
3308 from_top++;
3309 }
3310 }
3311 for (from_top = 0, curr = curscr->first_line; from_top < curscr->Num_lines; from_top++, curr = curr->next_screen)
3312 {
3313 Position(curscr, from_top, 0);
3314 for (j = 0; (curr->row[j] != (char) NULL) && (j < curscr->Num_cols); j++)
3315 {
3316 Char_out(curr->row[j], curr->attributes[j], curr->row, curr->attributes, j);
3317 }
3318 if (STAND)
3319 {
3320 STAND = FALSE;
3321 Position(curscr, from_top, j);
3322 attribute_off();

--- 205 unchanged lines hidden (view full) ---

3528 /*
3529 | If either 'insert mode' or 'insert char' are
3530 | available, enter the following 'if' statement,
3531 | else, need to simply rewrite the contents of the line
3532 | at the point where the contents of the line change.
3533 */
3534
3535 if (((String_table[ic__]) || (String_table[im__])) &&
3536 (String_table[dc__]) && (curr->row[0] != (char) NULL) &&
3537 (!NC_chinese))
3538 {
3539 j = 0;
3540 first_time = TRUE;
3541 vrt_lin = virt->row;
3542 vrt_att = virt->attributes;
3543 cur_lin = curr->row;
3544 cur_att = curr->attributes;
3545 while ((vrt_lin[j] != (char) NULL) && (j < window->Num_cols))
3546 {
3547 if ((STAND) && (Booleans[xs__]))
3548 {
3549 while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != (char) NULL) && (vrt_att[j]))
3550 j++;
3551 if ((STAND) && (!vrt_att[j]))
3552 {
3553 STAND = FALSE;
3554 Position(window, from_top, j);
3555 attribute_off();
3556 attribute_off();
3557 }
3558 }
3559 else
3560 {
3561 while ((vrt_lin[j] == cur_lin[j]) && (vrt_att[j] == cur_att[j]) && (vrt_lin[j] != (char) NULL))
3562 j++;
3563 }
3564 if ((vrt_att[j] != cur_att[j]) && (cur_att[j]) && (Booleans[xs__]))
3565 {
3566 Position(window, from_top, j);
3567/* CLEAR_TO_EOL(window, from_top, j);*/
3568 attribute_off();
3569 attribute_off();
3570 }
3571 if (vrt_lin[j] != (char) NULL)
3572 {
3573 begin_new = j;
3574 begin_old = j;
3575 end_old = j;
3576 end_new = j;
3577 if ((first_time) && (virt->changed))
3578 {
3579 if (curr->last_char <= virt->last_char)
3580 changed = check_insert(window, from_top, j, virt, curr);
3581 }
3582 changed = check_delete(window, from_top, j, virt, curr);
3583 first_time = FALSE;
3584 virt->changed = FALSE;
3585 if (!changed)
3586 changed = check_insert(window, from_top, j, virt, curr);
3587 if (((!changed) || (cur_lin[j] != vrt_lin[j]) || (cur_att[j] != vrt_att[j])) && (j < window->Num_cols))
3588 {
3589 if ((vrt_lin[j] == ' ') && (cur_lin[j] == (char) NULL) && (vrt_att[j] == cur_att[j]))
3590 cur_lin[j] = ' ';
3591 else
3592 {
3593 Position(window, from_top, j);
3594 Char_out(vrt_lin[j], vrt_att[j], cur_lin, cur_att, j);
3595 }
3596 }
3597 if ((vrt_lin[j] != (char) NULL))
3598 j++;
3599 }
3600 if ((STAND) && (!vrt_att[j]))
3601 {
3602 STAND = FALSE;
3603 Position(window, from_top, j);
3604 attribute_off();
3605 }
3606 }
3607 if ((vrt_lin[j] == (char) NULL) && (cur_lin[j] != (char) NULL))
3608 {
3609 Position(window, from_top, j);
3610 CLEAR_TO_EOL(window, from_top, j);
3611 }
3612 }
3613 else /*if ((similar != -1) && (similar != 0))*/
3614 {
3615 j = 0;
3616 c1 = curr->row;
3617 att1 = curr->attributes;
3618 c2 = virt->row;
3619 att2 = virt->attributes;
3620 while ((j < window->Num_cols) && (c2[j] != (char) NULL))
3621 {
3622 while ((c1[j] == c2[j]) && (att1[j] == att2[j]) && (j < window->Num_cols) && (c2[j] != (char) NULL))
3623 j++;
3624
3625 /*
3626 | if previous character is an eight bit
3627 | char, start redraw from that character
3628 */
3629
3630 if ((NC_chinese) && (highbitset(c1[j - 1])))
3631 j--;
3632 begin_old = j;
3633 begin_new = j;
3634 if ((j < window->Num_cols) && (c2[j] != (char) NULL))
3635 {
3636 Position(window, from_top, begin_old);
3637 CLEAR_TO_EOL(window, from_top, j);
3638 Position(window, from_top, begin_old);
3639 for (j = begin_old; (c2[j] != (char) NULL) && (j < window->Num_cols); j++)
3640 Char_out(c2[j], att2[j], c1, att1, j);
3641 }
3642 }
3643 if ((c2[j] == (char) NULL) && (c1[j] != (char) NULL))
3644 {
3645 Position(window, from_top, j);
3646 CLEAR_TO_EOL(window, from_top, j);
3647 }
3648 }
3649 if (STAND)
3650 {
3651 STAND = FALSE;

--- 39 unchanged lines hidden (view full) ---

3691Char_del(line, attrib, offset, maxlen) /* delete chars from line */
3692char *line;
3693char *attrib;
3694int offset;
3695int maxlen;
3696{
3697 int one, two;
3698
3699 for (one = offset, two = offset+1; (line[one] != (char) NULL) && (one < maxlen); one++, two++)
3700 {
3701 line[one] = line[two];
3702 attrib[one] = attrib[two];
3703 }
3704 String_Out(String_table[dc__], NULL, 0);
3705}
3706
3707void
3708Char_ins(line, attrib, newc, newatt, offset, maxlen) /* insert chars in line */
3709char *line;
3710char *attrib;
3711char newc;
3712char newatt;
3713int offset;
3714int maxlen;
3715{
3716 int one, two;
3717
3718 one = 0;
3719 while ((line[one] != (char) NULL) && (one < (maxlen - 2)))
3720 one++;
3721 for (two = one + 1; (two > offset); one--, two--)
3722 {
3723 line[two] = line[one];
3724 attrib[two] = attrib[one];
3725 }
3726 line[offset] = newc;
3727 attrib[offset] = newatt;

--- 86 unchanged lines hidden ---