aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2001-03-27 13:38:19 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2001-03-27 13:38:19 +0000
commit74d9f07d37b88dfd997d3255b57ba8fa80577380 (patch)
tree2e403ab4aab1243123d1b5c9886fcf8df7321275
parent465fbee7fd2dfb980694faf4fe5f28b63c59cbef (diff)
downloadsrc-74d9f07d37b88dfd997d3255b57ba8fa80577380.tar.gz
src-74d9f07d37b88dfd997d3255b57ba8fa80577380.zip
Virgin import of Hugh F. Mahon's EasyEditor 1.4.1.
Notes
Notes: svn path=/cvs2svn/branches/HUGH_F_MAHON/; revision=74853
-rw-r--r--usr.bin/ee/README20
-rw-r--r--usr.bin/ee/ee.118
-rw-r--r--usr.bin/ee/ee.c398
-rw-r--r--usr.bin/ee/ee.i18n.guide39
-rw-r--r--usr.bin/ee/new_curse.c208
-rw-r--r--usr.bin/ee/new_curse.h6
-rw-r--r--usr.bin/ee/nls/en_US.ISO_8859-1/ee.msg185
7 files changed, 714 insertions, 160 deletions
diff --git a/usr.bin/ee/README b/usr.bin/ee/README
index e15070077a98..8850af245dc0 100644
--- a/usr.bin/ee/README
+++ b/usr.bin/ee/README
@@ -15,7 +15,6 @@
This software may be distributed under the terms of Larry Wall's
Artistic license, a copy of which is included in this distribution.
- (see doc/Artistic).
This notice must be included with this software and any
derivatives.
@@ -68,19 +67,17 @@ terminal's capabilities.
While ee is based on curses, I have included here the source code to
new_curse, a subset of curses developed for use with ee. 'curses' often
will have a defect that reduces the usefulness of the editor relying upon
-it. This is unused by the FreeBSD version of ee (the existing ncurses
-library works just fine) but is included in the doc subdirectory for
-reference purposes should anyone wish to port ee to a platform for
-which the existing curses libraries are insufficient.
+it.
-The files doc/new_curse.[ch] contain a subset of the 'curses' library
-used by applications to handle screen output. Unfortunately, curses
+The file new_curse.c contains a subset of 'curses', a package for
+applications to use to handle screen output. Unfortunately, curses
varies from system to system, so I developed new_curse to provide
consistent behavior across systems. It works on both SystemV and BSD
systems, and while it can sometimes be slower than other curses packages,
it will get the information on the screen painted correctly more often
-than vendor supplied curses. Again, FreeBSD does not have this problem
-but you may find it useful on other platforms.
+than vendor supplied curses. Unless problems occur during the building
+of ee, it is recommended that you use new_curse rather than the curses
+supplied with your system.
If you experience problems with data being displayed improperly, check
your terminal configuration, especially if you're using a terminal
@@ -93,7 +90,10 @@ else (like the terminal emulator being used).
Both ee and new_curse were developed using K&R C (also known as "classic
C"), but it can also be compiled with ANSI C. You should be able to
-build ee by simply typing "make".
+build ee by simply typing "make". A make file which takes into account
+the characteristics of your system will be created, and then ee will be
+built. If there are problems encountered, you will be notified about
+them.
ee is the result of several conflicting design goals. While I know that it
solves the problems of some users, I also have no doubt that some will decry
diff --git a/usr.bin/ee/ee.1 b/usr.bin/ee/ee.1
index d5f02c807ec5..be79cbf6c50d 100644
--- a/usr.bin/ee/ee.1
+++ b/usr.bin/ee/ee.1
@@ -4,7 +4,7 @@
.\"
.\" nroff -man ee.1
.\"
-.\" $Header: /home/hugh/sources/old_ae/RCS/ee.1,v 1.19 1995/11/29 04:03:15 hugh Exp $
+.\" $Header: /home/hugh/sources/old_ae/RCS/ee.1,v 1.19 1995/11/29 04:03:15 hugh Exp hugh $
.\"
.\"
.TH ee 1 "" "" "" ""
@@ -323,8 +323,11 @@ brackets (e.g. "<220>") or as a character.
.IP "\fBinfo window\fR"
A window showing the keyboard operations that can be performed can be
displayed or not.
-.IP"\fBemacs keys\fR"
+.IP "\fBemacs keys\fR"
Control keys may be given bindings similar to emacs, or not.
+.IP "\f16 bit characters\fR"
+Toggles whether sixteen bit characters are handled as one 16-bit quantities or
+two 8-bit quantities. This works primarily with the Chinese Big 5 code set.
.RE
.PP
You may set these modes via the initialization file (see below), or with a
@@ -452,6 +455,10 @@ Turns on display of eight bit characters.
.IP \fBnoeightbit\fR
Turns off display of eight bit characters (they are displayed as their decimal
value inside angle brackets, e.g., "<220>").
+.IP \fB16bit\fR
+Turns on handling of 16-bit characters.
+.IP \fbno16bit\fR
+Turns off handling of 16-bit characters.
.IP \fBemacs\fR
Turns on emacs key bindings.
.IP \fBnoemacs\fR
@@ -501,7 +508,10 @@ Always make a copy of files that cannot be easily reproduced before
editing. Save files early, and save often.
.SS "International Code Set Support"
.I ee
-supports single-byte character code sets (eight-bit clean).
+supports single-byte character code sets (eight-bit clean), or the
+Chinese Big-5 code set. (Other multi-byte code sets may function, but the
+reason Big-5 works is that a two-byte character also takes up two columns on
+the screen.)
.SH WARNINGS
The automatic paragraph formatting operation
may be too slow for slower systems.
@@ -522,7 +532,7 @@ This software and documentation contains
proprietary information which is protected by
copyright. All rights are reserved.
.PP
-Copyright (c) 1990, 1991, 1992, 1993, 1995 Hugh Mahon.
+Copyright (c) 1990, 1991, 1992, 1993, 1995, 1996 Hugh Mahon.
.SH "SEE ALSO"
.PP
termcap(4), terminfo(4), environ(5), spell(1), ispell(1), lp(1)
diff --git a/usr.bin/ee/ee.c b/usr.bin/ee/ee.c
index fc0c06f1a790..9a08dc43312c 100644
--- a/usr.bin/ee/ee.c
+++ b/usr.bin/ee/ee.c
@@ -49,7 +49,7 @@
| proprietary information which is protected by
| copyright. All rights are reserved.
|
- | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.92 1996/05/07 02:48:19 hugh Exp hugh $
+ | $Header: /home/hugh/sources/old_ae/RCS/ee.c,v 1.96 1998/07/14 05:02:30 hugh Exp $
|
*/
@@ -62,7 +62,7 @@ char *ee_long_notice[] = {
"copyright. All rights are reserved."
};
-char *version = "@(#) ee, version 1.3 $Revision: 1.92 $";
+char *version = "@(#) ee, version 1.4.1 $Revision: 1.96 $";
#ifdef NCURSE
#include "new_curse.h"
@@ -124,7 +124,7 @@ nl_catd catalog;
#define COMMANDS 2
struct text {
- char *line; /* line of characters */
+ unsigned char *line; /* line of characters */
int line_number; /* line number */
int line_length; /* actual number of characters in the line */
int max_length; /* maximum number of characters the line handles */
@@ -139,7 +139,7 @@ struct text *tmp_line; /* temporary line pointer */
struct text *srch_line; /* temporary pointer for search routine */
struct files { /* structure to store names of files to be edited*/
- char *name; /* name of file */
+ unsigned char *name; /* name of file */
struct files *next_name;
};
@@ -185,21 +185,25 @@ int local_LINES = 0; /* copy of LINES, to detect when win resizes */
int local_COLS = 0; /* copy of COLS, to detect when win resizes */
int curses_initialized = FALSE; /* flag indicating if curses has been started*/
int emacs_keys_mode = FALSE; /* mode for if emacs key binings are used */
-
-char *point; /* points to current position in line */
-char *srch_str; /* pointer for search string */
-char *u_srch_str; /* pointer to non-case sensitive search */
-char *srch_1; /* pointer to start of suspect string */
-char *srch_2; /* pointer to next character of string */
-char *srch_3;
-char *in_file_name = NULL; /* name of input file */
-char *tmp_file; /* temporary file name */
-char d_char; /* deleted character */
-char *d_word; /* deleted word */
-char *d_line; /* deleted line */
-char in_string[513]; /* buffer for reading a file */
-char *print_command = "lp"; /* string to use for the print command */
-char *start_at_line = NULL; /* move to this line at start of session*/
+int ee_chinese = FALSE; /* allows handling of multi-byte characters */
+ /* by checking for high bit in a byte the */
+ /* code recognizes a two-byte character */
+ /* sequence */
+
+unsigned char *point; /* points to current position in line */
+unsigned char *srch_str; /* pointer for search string */
+unsigned char *u_srch_str; /* pointer to non-case sensitive search */
+unsigned char *srch_1; /* pointer to start of suspect string */
+unsigned char *srch_2; /* pointer to next character of string */
+unsigned char *srch_3;
+unsigned char *in_file_name = NULL; /* name of input file */
+char *tmp_file; /* temporary file name */
+unsigned char *d_char; /* deleted character */
+unsigned char *d_word; /* deleted word */
+unsigned char *d_line; /* deleted line */
+char in_string[513]; /* buffer for reading a file */
+unsigned char *print_command = "lp"; /* string to use for the print command */
+unsigned char *start_at_line = NULL; /* move to this line at start of session*/
int in; /* input character */
FILE *temp_fp; /* temporary file pointer */
@@ -248,22 +252,22 @@ struct menu_entries {
struct menu_entries *ptr_argument;
int (*iprocedure)P_((int));
void (*nprocedure)P_((void));
- unsigned int argument;
+ int argument;
};
int main P_((int argc, char *argv[]));
-char *resiz_line P_((int factor, struct text *rline, int rpos));
+unsigned char *resiz_line P_((int factor, struct text *rline, int rpos));
void insert P_((int character));
void delete P_((int disp));
-void scanline P_((char *pos));
+void scanline P_((unsigned char *pos));
int tabshift P_((int temp_int));
int out_char P_((WINDOW *window, int character, int column));
int len_char P_((int character, int column));
-void draw_line P_((int vertical, int horiz, char *ptr, int t_pos, int length));
+void draw_line P_((int vertical, int horiz, unsigned char *ptr, int t_pos, int length));
void insert_line P_((int disp));
struct text *txtalloc P_((void));
struct files *name_alloc P_((void));
-char *next_word P_((char *string));
+unsigned char *next_word P_((unsigned char *string));
void prev_word P_((void));
void control P_((void));
void emacs_control P_((void));
@@ -284,11 +288,11 @@ int scan P_((char *line, int offset, int column));
char *get_string P_((char *prompt, int advance));
int compare P_((char *string1, char *string2, int sensitive));
void goto_line P_((char *cmd_str));
-void midscreen P_((int line, char *pnt));
+void midscreen P_((int line, unsigned char *pnt));
void get_options P_((int numargs, char *arguments[]));
void check_fp P_((void));
void get_file P_((char *file_name));
-void get_line P_((int length, char *in_string, int *append));
+void get_line P_((int length, unsigned char *in_string, int *append));
void draw_screen P_((void));
void finish P_((void));
int quit P_((int noverify));
@@ -343,22 +347,23 @@ void strings_init P_((void));
*/
struct menu_entries modes_menu[] = {
- {"", NULL, NULL, NULL, NULL, 0},
- {"", NULL, NULL, NULL, NULL, -1},
- {"", NULL, NULL, NULL, NULL, -1},
- {"", NULL, NULL, NULL, NULL, -1},
- {"", NULL, NULL, NULL, NULL, -1},
- {"", NULL, NULL, NULL, NULL, -1},
- {"", NULL, NULL, NULL, NULL, -1},
- {"", NULL, NULL, NULL, NULL, -1},
- {"", NULL, NULL, NULL, NULL, -1},
- {"", NULL, NULL, NULL, dump_ee_conf, -1},
- {NULL, NULL, NULL, NULL, NULL, -1}
+ {"", NULL, NULL, NULL, NULL, 0}, /* title */
+ {"", NULL, NULL, NULL, NULL, -1}, /* 1. tabs to spaces */
+ {"", NULL, NULL, NULL, NULL, -1}, /* 2. case sensitive search*/
+ {"", NULL, NULL, NULL, NULL, -1}, /* 3. margins observed */
+ {"", NULL, NULL, NULL, NULL, -1}, /* 4. auto-paragraph */
+ {"", NULL, NULL, NULL, NULL, -1}, /* 5. eightbit characters*/
+ {"", NULL, NULL, NULL, NULL, -1}, /* 6. info window */
+ {"", NULL, NULL, NULL, NULL, -1}, /* 7. emacs key bindings*/
+ {"", NULL, NULL, NULL, NULL, -1}, /* 8. right margin */
+ {"", NULL, NULL, NULL, NULL, -1}, /* 9. chinese text */
+ {"", NULL, NULL, NULL, dump_ee_conf, -1}, /* 10. save editor config */
+ {NULL, NULL, NULL, NULL, NULL, -1} /* terminator */
};
-char *mode_strings[10];
+char *mode_strings[11];
-#define NUM_MODES_ITEMS 9
+#define NUM_MODES_ITEMS 10
struct menu_entries config_dump_menu[] = {
{"", NULL, NULL, NULL, NULL, 0},
@@ -421,15 +426,15 @@ struct menu_entries main_menu[] = {
{NULL, NULL, NULL, NULL, NULL, -1}
};
-char *help_text[22];
+char *help_text[23];
char *control_keys[5];
char *emacs_help_text[22];
char *emacs_control_keys[5];
char *command_strings[5];
-char *commands[30];
-char *init_strings[20];
+char *commands[32];
+char *init_strings[22];
#define MENU_WARN 1
@@ -528,6 +533,8 @@ char *cancel_string;
char *menu_too_lrg_msg;
char *more_above_str, *more_below_str;
+char *chinese_cmd, *nochinese_cmd;
+
#ifndef __STDC__
#ifndef HAS_STDLIB
extern char *malloc();
@@ -550,13 +557,13 @@ char *argv[];
signal(SIGCHLD, SIG_DFL);
signal(SIGSEGV, SIG_DFL);
signal(SIGINT, edit_abort);
-
- d_char = 0;
+ d_char = malloc(3); /* provide a buffer for multi-byte chars */
d_word = malloc(150);
*d_word = (char) NULL;
d_line = NULL;
dlt_line = txtalloc();
dlt_line->line = d_line;
+ dlt_line->line_length = 0;
curr_line = first_line = txtalloc();
curr_line->line = point = malloc(10);
curr_line->line_length = 1;
@@ -623,7 +630,10 @@ char *argv[];
if (in > 255)
function_key();
else if ((in == '\10') || (in == 127))
+ {
+ in = 8; /* make sure key is set to backspace */
delete(TRUE);
+ }
else if ((in > 31) || (in == 9))
insert(in);
else if ((in >= 0) && (in <= 31))
@@ -637,13 +647,13 @@ char *argv[];
return(0);
}
-char *
+unsigned char *
resiz_line(factor, rline, rpos) /* resize the line to length + factor*/
int factor; /* resize factor */
struct text *rline; /* position in line */
int rpos;
{
- char *rpoint;
+ unsigned char *rpoint;
int resiz_var;
rline->max_length += factor;
@@ -659,8 +669,8 @@ int character; /* new character */
{
int counter;
int value;
- char *temp; /* temporary pointer */
- char *temp2; /* temporary pointer */
+ unsigned char *temp; /* temporary pointer */
+ unsigned char *temp2; /* temporary pointer */
if ((character == '\011') && (expand_tabs))
{
@@ -742,31 +752,46 @@ void
delete(disp) /* delete character */
int disp;
{
- char *tp;
- char *temp2;
+ unsigned char *tp;
+ unsigned char *temp2;
struct text *temp_buff;
int temp_vert;
int temp_pos;
+ int del_width = 1;
if (point != curr_line->line) /* if not at beginning of line */
{
text_changes = TRUE;
temp2 = tp = point;
- tp--;
- point--;
- if ((*tp >= '\000') && (*tp < ' ')) /* check for TAB */
+ if ((ee_chinese) && (position >= 2) && (*(point - 2) > 127))
+ {
+ del_width = 2;
+ }
+ tp -= del_width;
+ point -= del_width;
+ position -= del_width;
+ temp_pos = position;
+ curr_line->line_length -= del_width;
+ if ((*tp < ' ') || (*tp >= 127)) /* check for TAB */
scanline(tp);
else
- --scr_horz;
+ scr_horz -= del_width;
scr_pos = scr_horz;
if (in == 8)
- d_char = *point; /* save deleted character */
- temp_pos = --position;
- curr_line->line_length--;
+ {
+ if (del_width == 1)
+ *d_char = *point; /* save deleted character */
+ else
+ {
+ d_char[0] = *point;
+ d_char[1] = *(point + 1);
+ }
+ d_char[del_width] = (unsigned char) NULL;
+ }
while (temp_pos <= curr_line->line_length)
{
temp_pos++;
- *tp= *temp2;
+ *tp = *temp2;
tp++;
temp2++;
}
@@ -787,7 +812,10 @@ int disp;
curr_line->next_line = temp_buff->next_line;
temp2 = temp_buff->line;
if (in == 8)
- d_char = '\n';
+ {
+ d_char[0] = '\n';
+ d_char[1] = (unsigned char) NULL;
+ }
tp = point;
temp_pos = 1;
while (temp_pos < temp_buff->line_length)
@@ -829,16 +857,16 @@ int disp;
void
scanline(pos) /* find the proper horizontal position for the pointer */
-char *pos;
+unsigned char *pos;
{
int temp;
- char *ptr;
+ unsigned char *ptr;
ptr = curr_line->line;
temp = 0;
while (ptr < pos)
{
- if ((*ptr >= 0) && (*ptr <= 8))
+ if (*ptr <= 8)
temp += 2;
else if (*ptr == 9)
temp += tabshift(temp);
@@ -887,7 +915,7 @@ char character;
int column;
{
int i1, i2;
- char *string;
+ unsigned char *string;
char string2[8];
if (character == TAB)
@@ -915,13 +943,13 @@ int column;
}
else
{
- waddch(window, (unsigned char)character );
+ waddch(window, (char)character );
return(1);
}
}
else
{
- waddch(window, (unsigned char)character);
+ waddch(window, (char)character);
return(1);
}
for (i2 = 0; (string[i2] != (char) NULL) && (((column+i2+1)-horiz_offset) < last_col); i2++)
@@ -956,12 +984,12 @@ void
draw_line(vertical, horiz, ptr, t_pos, length) /* redraw line from current position */
int vertical; /* current vertical position on screen */
int horiz; /* current horizontal position on screen */
-char *ptr; /* pointer to line */
+unsigned char *ptr; /* pointer to line */
int t_pos; /* current position (offset in bytes) from bol */
int length; /* length (in bytes) of line */
{
int d; /* partial length of special or tab char to display */
- char *temp; /* temporary pointer to position in line */
+ unsigned char *temp; /* temporary pointer to position in line */
int abs_column; /* offset in screen units from begin of line */
int column; /* horizontal position on screen */
int row; /* vertical position on screen */
@@ -990,7 +1018,7 @@ int length; /* length (in bytes) of line */
wclrtoeol(text_win);
while ((posit < length) && (column <= last_col))
{
- if ((*temp < 32) || (*temp == 127))
+ if ((*temp < 32) || (*temp >= 127))
{
column += len_char(*temp, abs_column);
abs_column += out_char(text_win, *temp, abs_column);
@@ -1015,8 +1043,8 @@ int disp;
{
int temp_pos;
int temp_pos2;
- char *temp;
- char *extra;
+ unsigned char *temp;
+ unsigned char *extra;
struct text *temp_nod;
text_changes = TRUE;
@@ -1095,8 +1123,8 @@ struct files *name_alloc() /* allocate space for file name list node */
return((struct files *) malloc(sizeof( struct files)));
}
-char *next_word(string) /* move to next word in string */
-char *string;
+unsigned char *next_word(string) /* move to next word in string */
+unsigned char *string;
{
while ((*string != (char) NULL) && ((*string != 32) && (*string != 9)))
string++;
@@ -1348,6 +1376,11 @@ int disp;
{
if (point != curr_line->line) /* if not at begin of line */
{
+ if ((ee_chinese) && (position >= 2) && (*(point - 2) > 127))
+ {
+ point--;
+ position--;
+ }
point--;
position--;
scanline(point);
@@ -1377,6 +1410,12 @@ int disp;
{
if (position < curr_line->line_length)
{
+ if ((ee_chinese) && (*point > 127) &&
+ ((curr_line->line_length - position) >= 2))
+ {
+ point++;
+ position++;
+ }
point++;
position++;
scanline(point);
@@ -1413,8 +1452,15 @@ find_pos() /* move to the same column as on other line */
{
if (*point == 9)
scr_horz += tabshift(scr_horz);
- else if ((*point >= '\0') && (*point < ' '))
+ else if (*point < ' ')
+ scr_horz += 2;
+ else if ((ee_chinese) && (*point > 127) &&
+ ((curr_line->line_length - position) >= 2))
+ {
scr_horz += 2;
+ point++;
+ position++;
+ }
else
scr_horz++;
position++;
@@ -1672,10 +1718,7 @@ char *cmd_str1;
{
wmove(com_win, 0, 0);
wclrtoeol(com_win);
- if (*point >= '\0')
- wprintw(com_win, char_str, *point);
- else
- wprintw(com_win, char_str, (*point + 256));
+ wprintw(com_win, char_str, *point);
}
else if (compare(cmd_str, REDRAW, FALSE))
redraw();
@@ -1710,6 +1753,20 @@ char *cmd_str1;
expand_tabs = FALSE;
else if (compare(cmd_str, Exit_string, FALSE))
finish();
+ else if (compare(cmd_str, chinese_cmd, FALSE))
+ {
+ ee_chinese = TRUE;
+#ifdef NCURSE
+ nc_setattrib(A_NC_BIG5);
+#endif /* NCURSE */
+ }
+ else if (compare(cmd_str, nochinese_cmd, FALSE))
+ {
+ ee_chinese = FALSE;
+#ifdef NCURSE
+ nc_clearattrib(A_NC_BIG5);
+#endif /* NCURSE */
+ }
else if (compare(cmd_str, QUIT_string, FALSE))
quit(0);
else if (*cmd_str == '!')
@@ -1943,7 +2000,7 @@ char *cmd_str;
void
midscreen(line, pnt) /* put current line in middle of screen */
int line;
-char *pnt;
+unsigned char *pnt;
{
struct text *mid_line;
int i;
@@ -2197,11 +2254,11 @@ char *file_name;
void
get_line(length, in_string, append) /* read string and split into lines */
int length; /* length of string read by read */
-char *in_string; /* string read by read */
+unsigned char *in_string; /* string read by read */
int *append; /* TRUE if must append more text to end of current line */
{
- char *str1;
- char *str2;
+ unsigned char *str1;
+ unsigned char *str2;
int num; /* offset from start of string */
int char_count; /* length of new line (or added portion */
int temp_counter; /* temporary counter value */
@@ -2242,7 +2299,7 @@ int *append; /* TRUE if must append more text to end of current line */
if (tline->next_line != NULL)
tline->next_line->prev_line = tline;
curr_line = tline;
- curr_line->line = point = (char *) malloc(char_count);
+ curr_line->line = point = (unsigned char *) malloc(char_count);
curr_line->line_length = char_count;
curr_line->max_length = char_count;
}
@@ -2268,7 +2325,7 @@ void
draw_screen() /* redraw the screen from current postion */
{
struct text *temp_line;
- char *line_out;
+ unsigned char *line_out;
int temp_vert;
temp_line = curr_line;
@@ -2604,6 +2661,12 @@ del_char() /* delete current character */
in = 8; /* backspace */
if (position < curr_line->line_length) /* if not end of line */
{
+ if ((ee_chinese) && (*point > 127) &&
+ ((curr_line->line_length - position) >= 2))
+ {
+ point++;
+ position++;
+ }
position++;
point++;
scanline(point);
@@ -2619,12 +2682,17 @@ del_char() /* delete current character */
void
undel_char() /* undelete last deleted character */
{
- if (d_char == '\n') /* insert line if last del_char deleted eol */
+ if (d_char[0] == '\n') /* insert line if last del_char deleted eol */
insert_line(TRUE);
else
{
- in = d_char;
+ in = d_char[0];
insert(in);
+ if (d_char[1] != (unsigned char) NULL)
+ {
+ in = d_char[1];
+ insert(in);
+ }
}
}
@@ -2633,14 +2701,16 @@ del_word() /* delete word in front of cursor */
{
int tposit;
int difference;
- char *d_word2;
- char *d_word3;
- char tmp_char;
+ unsigned char *d_word2;
+ unsigned char *d_word3;
+ unsigned char tmp_char[3];
if (d_word != NULL)
free(d_word);
d_word = malloc(curr_line->line_length);
- tmp_char = d_char;
+ tmp_char[0] = d_char[0];
+ tmp_char[1] = d_char[1];
+ tmp_char[2] = d_char[2];
d_word3 = point;
d_word2 = d_word;
tposit = position;
@@ -2673,7 +2743,9 @@ del_word() /* delete word in front of cursor */
curr_line->line_length -= difference;
*d_word2 = (char) NULL;
draw_line(scr_vert, scr_horz,point,position,curr_line->line_length);
- d_char = tmp_char;
+ d_char[0] = tmp_char[0];
+ d_char[1] = tmp_char[1];
+ d_char[2] = tmp_char[2];
text_changes = TRUE;
formatted = FALSE;
}
@@ -2683,10 +2755,10 @@ undel_word() /* undelete last deleted word */
{
int temp;
int tposit;
- char *tmp_old_ptr;
- char *tmp_space;
- char *tmp_ptr;
- char *d_word_ptr;
+ unsigned char *tmp_old_ptr;
+ unsigned char *tmp_space;
+ unsigned char *tmp_ptr;
+ unsigned char *d_word_ptr;
/*
| resize line to handle undeleted word
@@ -2743,8 +2815,8 @@ undel_word() /* undelete last deleted word */
void
del_line() /* delete from cursor to end of line */
{
- char *dl1;
- char *dl2;
+ unsigned char *dl1;
+ unsigned char *dl2;
int tposit;
if (d_line != NULL)
@@ -2776,10 +2848,13 @@ del_line() /* delete from cursor to end of line */
void
undel_line() /* undelete last deleted line */
{
- char *ud1;
- char *ud2;
+ unsigned char *ud1;
+ unsigned char *ud2;
int tposit;
+ if (dlt_line->line_length == 0)
+ return;
+
insert_line(TRUE);
left(TRUE);
point = resiz_line(dlt_line->line_length, curr_line, position);
@@ -3163,6 +3238,12 @@ set_up_term() /* set up the terminal for operating with ae */
last_col = COLS - 1;
local_LINES = LINES;
local_COLS = COLS;
+
+#ifdef NCURSE
+ if (ee_chinese)
+ nc_setattrib(A_NC_BIG5);
+#endif /* NCURSE */
+
}
void
@@ -3215,7 +3296,7 @@ struct menu_entries menu_list[];
max_width = length;
}
max_width += 3;
- max_width = max(max_width, strlen(cancel_string));
+ max_width = max(max_width, strlen(menu_cancel_msg));
max_width = max(max_width, max(strlen(more_above_str), strlen(more_below_str)));
max_width += 6;
@@ -3436,7 +3517,7 @@ int off_start, vert_size;
waddstr(menu_win, menu_list[0].item_string);
wmove(menu_win, (max_height - 3), 3);
if (menu_list[0].argument != MENU_WARN)
- waddstr(menu_win, cancel_string);
+ waddstr(menu_win, menu_cancel_msg);
}
if (!nohighlight)
wstandout(menu_win);
@@ -3718,7 +3799,7 @@ int
Blank_Line(test_line) /* test if line has any non-space characters */
struct text *test_line;
{
- char *line;
+ unsigned char *line;
int length;
if (test_line == NULL)
@@ -3756,11 +3837,15 @@ Format() /* format the paragraph according to set margins */
int status;
int tmp_af;
int counter;
- char *line;
- char *tmp_srchstr;
- char *temp1, *temp2;
- char *temp_dword;
- char temp_d_char = d_char;
+ unsigned char *line;
+ unsigned char *tmp_srchstr;
+ unsigned char *temp1, *temp2;
+ unsigned char *temp_dword;
+ unsigned char temp_d_char[3];
+
+ temp_d_char[0] = d_char[0];
+ temp_d_char[1] = d_char[1];
+ temp_d_char[2] = d_char[2];
/*
| if observ_margins is not set, or the current line is blank,
@@ -3794,7 +3879,7 @@ Format() /* format the paragraph according to set margins */
temp_case = case_sen;
case_sen = TRUE;
tmp_srchstr = srch_str;
- temp2 = srch_str = (char *) malloc(1 + curr_line->line_length - position);
+ temp2 = srch_str = (unsigned char *) malloc(1 + curr_line->line_length - position);
if ((*point == ' ') || (*point == '\t'))
adv_word();
offset -= position;
@@ -3955,7 +4040,9 @@ Format() /* format the paragraph according to set margins */
case_sen = temp_case;
free(srch_str);
srch_str = tmp_srchstr;
- d_char = temp_d_char;
+ d_char[0] = temp_d_char[0];
+ d_char[1] = temp_d_char[1];
+ d_char[2] = temp_d_char[2];
auto_format = tmp_af;
midscreen(scr_vert, point);
@@ -3963,7 +4050,7 @@ Format() /* format the paragraph according to set margins */
wrefresh(com_win);
}
-char *init_name[3] = {
+unsigned char *init_name[3] = {
"/usr/local/lib/init.ee",
NULL,
".init.ee"
@@ -3973,9 +4060,9 @@ void
ee_init() /* check for init file and read it if it exists */
{
FILE *init_file;
- char *string;
- char *str1;
- char *str2;
+ unsigned char *string;
+ unsigned char *str1;
+ unsigned char *str2;
char *home;
int counter;
int temp_int;
@@ -4054,17 +4141,37 @@ ee_init() /* check for init file and read it if it exists */
else if (compare(str1, EIGHTBIT, FALSE))
eightbit = TRUE;
else if (compare(str1, NOEIGHTBIT, FALSE))
+ {
eightbit = FALSE;
+ ee_chinese = FALSE;
+ }
else if (compare(str1, EMACS_string, FALSE))
emacs_keys_mode = TRUE;
else if (compare(str1, NOEMACS_string, FALSE))
emacs_keys_mode = FALSE;
+ else if (compare(str1, chinese_cmd, FALSE))
+ {
+ ee_chinese = TRUE;
+ eightbit = TRUE;
+ }
+ else if (compare(str1, nochinese_cmd, FALSE))
+ ee_chinese = FALSE;
}
fclose(init_file);
}
}
free(string);
free(home);
+
+ string = getenv("LANG");
+ if (string != NULL)
+ {
+ if (strcmp(string, "zh_TW.big5") == 0)
+ {
+ ee_chinese = TRUE;
+ eightbit = TRUE;
+ }
+ }
}
/*
@@ -4158,6 +4265,7 @@ dump_ee_conf()
fprintf(init_file, "%s\n", nohighlight ? NOHIGHLIGHT : HIGHLIGHT );
fprintf(init_file, "%s\n", eightbit ? EIGHTBIT : NOEIGHTBIT );
fprintf(init_file, "%s\n", emacs_keys_mode ? EMACS_string : NOEMACS_string );
+ fprintf(init_file, "%s\n", ee_chinese ? chinese_cmd : nochinese_cmd );
fclose(init_file);
@@ -4272,7 +4380,7 @@ first_word_len(test_line)
struct text *test_line;
{
int counter;
- char *pnt;
+ unsigned char *pnt;
if (test_line == NULL)
return(0);
@@ -4317,12 +4425,17 @@ Auto_Format() /* format the paragraph according to set margins */
int status;
int counter;
char not_blank;
- char *line;
- char *tmp_srchstr;
- char *temp1, *temp2;
- char *temp_dword;
- char temp_d_char = d_char;
- char *tmp_d_line;
+ unsigned char *line;
+ unsigned char *tmp_srchstr;
+ unsigned char *temp1, *temp2;
+ unsigned char *temp_dword;
+ unsigned char temp_d_char[3];
+ unsigned char *tmp_d_line;
+
+
+ temp_d_char[0] = d_char[0];
+ temp_d_char[1] = d_char[1];
+ temp_d_char[2] = d_char[2];
/*
| if observ_margins is not set, or the current line is blank,
@@ -4351,7 +4464,7 @@ Auto_Format() /* format the paragraph according to set margins */
temp_case = case_sen;
case_sen = TRUE;
tmp_srchstr = srch_str;
- temp2 = srch_str = (char *) malloc(1 + curr_line->line_length - position);
+ temp2 = srch_str = (unsigned char *) malloc(1 + curr_line->line_length - position);
if ((*point == ' ') || (*point == '\t'))
adv_word();
offset -= position;
@@ -4548,7 +4661,9 @@ Auto_Format() /* format the paragraph according to set margins */
case_sen = temp_case;
free(srch_str);
srch_str = tmp_srchstr;
- d_char = temp_d_char;
+ d_char[0] = temp_d_char[0];
+ d_char[1] = temp_d_char[1];
+ d_char[2] = temp_d_char[2];
auto_format = TRUE;
dlt_line->line_length = tmp_d_line_length;
d_line = tmp_d_line;
@@ -4582,6 +4697,8 @@ modes_op()
(emacs_keys_mode ? ON : OFF));
sprintf(modes_menu[8].item_string, "%s %d", mode_strings[8],
right_margin);
+ sprintf(modes_menu[9].item_string, "%s %s", mode_strings[9],
+ (ee_chinese ? ON : OFF));
ret_value = menu_op(modes_menu);
@@ -4603,6 +4720,15 @@ modes_op()
break;
case 5:
eightbit = !eightbit;
+ if (!eightbit)
+ ee_chinese = FALSE;
+#ifdef NCURSE
+ if (ee_chinese)
+ nc_setattrib(A_NC_BIG5);
+ else
+ nc_clearattrib(A_NC_BIG5);
+#endif /* NCURSE */
+
redraw();
wnoutrefresh(text_win);
break;
@@ -4627,6 +4753,18 @@ modes_op()
free(string);
}
break;
+ case 9:
+ ee_chinese = !ee_chinese;
+ if (ee_chinese != FALSE)
+ eightbit = TRUE;
+#ifdef NCURSE
+ if (ee_chinese)
+ nc_setattrib(A_NC_BIG5);
+ else
+ nc_clearattrib(A_NC_BIG5);
+#endif /* NCURSE */
+ redraw();
+ break;
default:
break;
}
@@ -4920,8 +5058,8 @@ strings_init()
help_text[17] = catgetlocal( 52, "line : display line # 0-9 : go to line \"#\" ");
help_text[18] = catgetlocal( 53, "expand : expand tabs noexpand: do not expand tabs ");
help_text[19] = catgetlocal( 54, " ");
- help_text[20] = catgetlocal( 55, " ee [-i] [-e] [-h] [file(s)] ");
- help_text[21] = catgetlocal( 56, " -i : no information window -e : do not expand tabs -h : no highlight ");
+ help_text[20] = catgetlocal( 55, " ee [+#] [-i] [-e] [-h] [file(s)] ");
+ help_text[21] = catgetlocal( 56, "+# :go to line # -i :no info window -e : don't expand tabs -h :no highlight");
control_keys[0] = catgetlocal( 57, "^[ (escape) menu ^e search prompt ^y delete line ^u up ^p prev page ");
control_keys[1] = catgetlocal( 58, "^a ascii code ^x search ^z undelete line ^d down ^n next page ");
control_keys[2] = catgetlocal( 59, "^b bottom of text ^g begin of line ^w delete word ^l left ");
@@ -5046,16 +5184,18 @@ strings_init()
usage4 = catgetlocal( 161, " +# put cursor at line #\n");
conf_dump_err_msg = catgetlocal( 162, "unable to open .init.ee for writing, no configuration saved!");
conf_dump_success_msg = catgetlocal( 163, "ee configuration saved in file %s");
- modes_menu[9].item_string = catgetlocal( 164, "save editor configuration");
+ modes_menu[10].item_string = catgetlocal( 164, "save editor configuration");
config_dump_menu[0].item_string = catgetlocal( 165, "save ee configuration");
config_dump_menu[1].item_string = catgetlocal( 166, "save in current directory");
config_dump_menu[2].item_string = catgetlocal( 167, "save in home directory");
conf_not_saved_msg = catgetlocal( 168, "ee configuration not saved");
ree_no_file_msg = catgetlocal( 169, "must specify a file when invoking ree");
- cancel_string = catgetlocal( 170, "press Esc to cancel");
menu_too_lrg_msg = catgetlocal( 180, "menu too large for window");
more_above_str = catgetlocal( 181, "^^more^^");
more_below_str = catgetlocal( 182, "VVmoreVV");
+ mode_strings[9] = catgetlocal( 183, "16 bit characters ");
+ chinese_cmd = catgetlocal( 184, "16BIT");
+ nochinese_cmd = catgetlocal( 185, "NO16BIT");
commands[0] = HELP;
commands[1] = WRITE;
@@ -5086,7 +5226,9 @@ strings_init()
commands[26] = "8";
commands[27] = "9";
commands[28] = CHARACTER;
- commands[29] = NULL;
+ commands[29] = chinese_cmd;
+ commands[30] = nochinese_cmd;
+ commands[31] = NULL;
init_strings[0] = CASE;
init_strings[1] = NOCASE;
init_strings[2] = EXPAND;
@@ -5106,7 +5248,9 @@ strings_init()
init_strings[16] = NOEIGHTBIT;
init_strings[17] = EMACS_string;
init_strings[18] = NOEMACS_string;
- init_strings[19] = NULL;
+ init_strings[19] = chinese_cmd;
+ init_strings[20] = nochinese_cmd;
+ init_strings[21] = NULL;
/*
| allocate space for strings here for settings menu
diff --git a/usr.bin/ee/ee.i18n.guide b/usr.bin/ee/ee.i18n.guide
index 0850c2e7400d..eef836a05e5f 100644
--- a/usr.bin/ee/ee.i18n.guide
+++ b/usr.bin/ee/ee.i18n.guide
@@ -1,18 +1,23 @@
-Easy Editor ("ee") provides the ability to translate the messages displayed to
-the user and the commands entered. This is done via message catalogs,
-following X/Open standards. ee only supports eight bit characters.
+Easy Editor ("ee") provides the ability to translate the messages
+displayed to the user and the commands entered. This is done via message
+catalogs, following X/Open standards. ee supports eight bit characters,
+as well as 16-bit characters. The Chinese Big 5 code set is the 16-bit
+code set that ee was modified to handle, as it is relatively easy to
+support since two byte characters also take up two columns on the screen,
+thereby simplifying the screen position calculations. Other multibyte
+code sets may function, but have not been tested.
(The name ee.i18n.guide is for "ee internationalization guide". The i18n
abbreviation is used because there are 18 characters between the first
-letter ("i") and last ("n") of "internationalization".)
+letter ("i") and last ("n") of "internationalization".)
-All of the messages, warnings, information, and commands, are contained in the
-message catalog. Each numbered entry represents an individual string used by
-ee. Some strings contain formatting information for formatted print
-statements, which are of the form "%s", or "%d", these must be preserved in
-the translation, or the correct information will not be displayed. For those
-strings containing multiple formatting codes, the order of each item must be
-preserved as well.
+All of the messages, warnings, information, and commands, are contained
+in the message catalog. Each numbered entry represents an individual
+string used by ee. Some strings contain formatting information for
+formatted print statements, which are of the form "%s", or "%d", these
+must be preserved in the translation, or the correct information will not
+be displayed. For those strings containing multiple formatting codes,
+the order of each item must be preserved as well.
Message content
1 title for modes, or settings menu
@@ -93,6 +98,18 @@ Message content
154 - 158 info window entries for emacs key bindings info
159 string for turning on emacs key bindings in the init file
160 string for turning off emacs key bindings in the init file
+161 fifth line of usage statement
+162 error message when unable to save configuration file
+163 positive feedback about saving the configuration file
+164 - 167 menu items for saving editor configuration
+168 error message when unable to save configuration file
+169 error message for ree when not specifying the file
+180 self-explanatory
+181 - 182 indicators of more information in menu (for when scrolling
+ menus because menu contents won't fit vertically on screen)
+183 menu entry for modes menu for 16 bit characters
+184 - 185 strings for initialization to turn on or off 16 bit
+ character handling
Care should be taken when translating commands and initialization keywords
because the algorithm used for detecting uniqueness of entered commands
diff --git a/usr.bin/ee/new_curse.c b/usr.bin/ee/new_curse.c
index a22ccf5f8695..5a986ddce523 100644
--- a/usr.bin/ee/new_curse.c
+++ b/usr.bin/ee/new_curse.c
@@ -37,14 +37,14 @@
| Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon
| All are rights reserved.
|
- | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.43 1996/03/21 04:27:06 hugh Exp $
+ | $Header: /home/hugh/sources/old_ae/RCS/new_curse.c,v 1.49 1998/12/21 02:25:59 hugh Exp hugh $
|
*/
char *copyright_message[] = { "Copyright (c) 1986, 1987, 1988, 1991, 1992, 1993, 1994, 1995 Hugh Mahon",
"All rights are reserved."};
-char * new_curse_name= "@(#) new_curse.c $Revision: 1.43 $";
+char * new_curse_name= "@(#) new_curse.c $Revision: 1.49 $";
#include "new_curse.h"
#include <signal.h>
@@ -95,6 +95,7 @@ WINDOW *last_window_refreshed;
#endif
#define min(a, b) (a < b ? a : b)
+#define highbitset(a) ((a) & 0x80)
#ifndef CAP
#define String_Out(table, stack, place) Info_Out(table, stack, place)
@@ -514,6 +515,106 @@ struct KEY_STACK {
struct KEY_STACK *KEY_TOS = NULL;
struct KEY_STACK *KEY_POINT;
+/*
+ |
+ | Not all systems have good terminal information, so we will define
+ | keyboard information here for the most widely used terminal type,
+ | the VT100.
+ |
+ */
+
+struct KEYS vt100[] =
+ {
+ { 3, "\033[A", 0403 }, /* key up */
+ { 3, "\033[C", 0405 }, /* key right */
+ { 3, "\033[D", 0404 }, /* key left */
+
+ { 4, "\033[6~", 0522 }, /* key next page */
+ { 4, "\033[5~", 0523 }, /* key prev page */
+ { 3, "\033[[", 0550 }, /* key end */
+ { 3, "\033[@", 0406 }, /* key home */
+ { 4, "\033[2~", 0513 }, /* key insert char */
+
+ { 3, "\033[y", 0410 }, /* key F0 */
+ { 3, "\033[P", 0411 }, /* key F1 */
+ { 3, "\033[Q", 0412 }, /* key F2 */
+ { 3, "\033[R", 0413 }, /* key F3 */
+ { 3, "\033[S", 0414 }, /* key F4 */
+ { 3, "\033[t", 0415 }, /* key F5 */
+ { 3, "\033[u", 0416 }, /* key F6 */
+ { 3, "\033[v", 0417 }, /* key F7 */
+ { 3, "\033[l", 0420 }, /* key F8 */
+ { 3, "\033[w", 0421 }, /* key F9 */
+ { 3, "\033[x", 0422 }, /* key F10 */
+
+ { 5, "\033[10~", 0410 }, /* key F0 */
+ { 5, "\033[11~", 0411 }, /* key F1 */
+ { 5, "\033[12~", 0412 }, /* key F2 */
+ { 5, "\033[13~", 0413 }, /* key F3 */
+ { 5, "\033[14~", 0414 }, /* key F4 */
+ { 5, "\033[15~", 0415 }, /* key F5 */
+ { 5, "\033[17~", 0416 }, /* key F6 */
+ { 5, "\033[18~", 0417 }, /* key F7 */
+ { 5, "\033[19~", 0420 }, /* key F8 */
+ { 5, "\033[20~", 0421 }, /* key F9 */
+ { 5, "\033[21~", 0422 }, /* key F10 */
+ { 5, "\033[23~", 0423 }, /* key F11 */
+ { 5, "\033[24~", 0424 }, /* key F12 */
+ { 3, "\033[q", 0534 }, /* ka1 upper-left of keypad */
+ { 3, "\033[s", 0535 }, /* ka3 upper-right of keypad */
+ { 3, "\033[r", 0536 }, /* kb2 center of keypad */
+ { 3, "\033[p", 0537 }, /* kc1 lower-left of keypad */
+ { 3, "\033[n", 0540 }, /* kc3 lower-right of keypad */
+
+ /*
+ | The following are the same keys as above, but with
+ | a different character following the escape char.
+ */
+
+ { 3, "\033OA", 0403 }, /* key up */
+ { 3, "\033OC", 0405 }, /* key right */
+ { 3, "\033OD", 0404 }, /* key left */
+ { 3, "\033OB", 0402 }, /* key down */
+ { 4, "\033O6~", 0522 }, /* key next page */
+ { 4, "\033O5~", 0523 }, /* key prev page */
+ { 3, "\033O[", 0550 }, /* key end */
+ { 3, "\033O@", 0406 }, /* key home */
+ { 4, "\033O2~", 0513 }, /* key insert char */
+
+ { 3, "\033Oy", 0410 }, /* key F0 */
+ { 3, "\033OP", 0411 }, /* key F1 */
+ { 3, "\033OQ", 0412 }, /* key F2 */
+ { 3, "\033OR", 0413 }, /* key F3 */
+ { 3, "\033OS", 0414 }, /* key F4 */
+ { 3, "\033Ot", 0415 }, /* key F5 */
+ { 3, "\033Ou", 0416 }, /* key F6 */
+ { 3, "\033Ov", 0417 }, /* key F7 */
+ { 3, "\033Ol", 0420 }, /* key F8 */
+ { 3, "\033Ow", 0421 }, /* key F9 */
+ { 3, "\033Ox", 0422 }, /* key F10 */
+
+ { 5, "\033O10~", 0410 }, /* key F0 */
+ { 5, "\033O11~", 0411 }, /* key F1 */
+ { 5, "\033O12~", 0412 }, /* key F2 */
+ { 5, "\033O13~", 0413 }, /* key F3 */
+ { 5, "\033O14~", 0414 }, /* key F4 */
+ { 5, "\033O15~", 0415 }, /* key F5 */
+ { 5, "\033O17~", 0416 }, /* key F6 */
+ { 5, "\033O18~", 0417 }, /* key F7 */
+ { 5, "\033O19~", 0420 }, /* key F8 */
+ { 5, "\033O20~", 0421 }, /* key F9 */
+ { 5, "\033O21~", 0422 }, /* key F10 */
+ { 5, "\033O23~", 0423 }, /* key F11 */
+ { 5, "\033O24~", 0424 }, /* key F12 */
+ { 3, "\033Oq", 0534 }, /* ka1 upper-left of keypad */
+ { 3, "\033Os", 0535 }, /* ka3 upper-right of keypad */
+ { 3, "\033Or", 0536 }, /* kb2 center of keypad */
+ { 3, "\033Op", 0537 }, /* kc1 lower-left of keypad */
+ { 3, "\033On", 0540 }, /* kc3 lower-right of keypad */
+
+ { 0, "", 0 } /* end */
+ };
+
struct Parameters {
int value;
struct Parameters *next;
@@ -537,6 +638,8 @@ int Key_vals[] = {
int attributes_set[9];
+static int nc_attributes = 0; /* global attributes for new_curse to observe */
+
#ifdef SYS5
struct termio Terminal;
struct termio Saved_tty;
@@ -815,6 +918,14 @@ printf("starting initscr \n");fflush(stdout);
}
if (Fildes == -1)
{
+ TERM_PATH = "/usr/share/terminfo";
+ Data_Line_len = 23 + strlen(TERM_PATH) + strlen(TERMINAL_TYPE);
+ Term_File_name = malloc(Data_Line_len);
+ sprintf(Term_File_name, "%s/%c/%s", TERM_PATH, *TERMINAL_TYPE, TERMINAL_TYPE);
+ Fildes = open(Term_File_name, O_RDONLY);
+ }
+ if (Fildes == -1)
+ {
free(Term_File_name);
Term_File_name = NULL;
}
@@ -865,6 +976,7 @@ printf("starting initscr \n");fflush(stdout);
exit(0);
}
Key_Get();
+ keys_vt100();
LINES = Numbers[li__];
COLS = Numbers[co__];
if ((lines_string = getenv("LINES")) != NULL)
@@ -1112,6 +1224,32 @@ Key_Get() /* create linked list with all key sequences obtained from terminal d
}
}
+/*
+ | insert information about keys for a vt100 terminal
+ */
+
+void
+keys_vt100()
+{
+ int counter;
+ int Klen;
+ struct KEY_STACK *Spoint;
+
+ Spoint = KEY_TOS;
+ while (Spoint->next != NULL)
+ Spoint = Spoint->next;
+ for (counter = 0; vt100[counter].length != 0; counter++)
+ {
+ Spoint->next = (struct KEY_STACK *) malloc(sizeof(struct KEY_STACK));
+ Spoint = Spoint->next;
+ Spoint->next = NULL;
+ Spoint->element = &vt100[counter];
+ Klen = strlen(Spoint->element->string);
+ if (Klen > Max_Key_len)
+ Max_Key_len = Klen;
+ }
+}
+
#ifdef CAP
char *
String_Get(param) /* read the string */
@@ -2502,6 +2640,7 @@ int flag;
Repaint_screen = TRUE;
}
+
void
echo() /* turn on echoing */
{
@@ -2669,7 +2808,6 @@ void
endwin() /* end windows */
{
keypad(stdscr, FALSE);
- free(stdscr);
initialized = FALSE;
delwin(curscr);
delwin(virtual_scr);
@@ -3041,6 +3179,11 @@ struct _line *pointer_new, *pointer_old;
return(changed);
}
+/*
+ | Check if characters were inserted in the middle of a line, and if
+ | so, insert them.
+ */
+
int
check_insert(window, line, offset, pointer_new, pointer_old)
WINDOW *window;
@@ -3139,8 +3282,13 @@ doupdate()
char *att1, *att2;
char *c1, *c2;
+ char NC_chinese = FALSE; /* flag to indicate handling Chinese */
+
window = virtual_scr;
+ if ((nc_attributes & A_NC_BIG5) != 0)
+ NC_chinese = TRUE;
+
if (Repaint_screen)
{
if (String_table[cl__])
@@ -3200,7 +3348,7 @@ doupdate()
curr = top_of_win;
similar = 0;
/*
- | if the window has lines that are different
+ | if the window has lines that are different, check for scrolling
*/
if (diff)
{
@@ -3272,7 +3420,7 @@ doupdate()
if (String_table[cs__]) /* scrolling region */
{
list[1] = 0;
- list[0] = LINES;
+ list[0] = LINES - 1;
String_Out(String_table[cs__], list, 2);
Curr_y = Curr_x = -1;
}
@@ -3337,7 +3485,7 @@ doupdate()
if (String_table[cs__]) /* scrolling region */
{
list[1] = 0;
- list[0] = LINES;
+ list[0] = LINES - 1;
String_Out(String_table[cs__], list, 2);
Curr_y = Curr_x = -1;
}
@@ -3366,12 +3514,28 @@ doupdate()
}
}
+
+ /*
+ | Scrolling done, now need to insert, delete, or modify text
+ | within lines.
+ */
+
for (from_top = 0, curr = curscr->first_line; from_top < window->SR; from_top++)
curr = curr->next_screen;
top_of_win = curr;
for (from_top = 0, curr = top_of_win, virt = window->first_line; from_top < window->Num_lines; from_top++, curr = curr->next_screen, virt = virt->next_screen)
{
- if (((String_table[ic__]) || (String_table[im__])) && (String_table[dc__]) && (curr->row[0] != (char) NULL))
+
+ /*
+ | If either 'insert mode' or 'insert char' are
+ | available, enter the following 'if' statement,
+ | else, need to simply rewrite the contents of the line
+ | at the point where the contents of the line change.
+ */
+
+ if (((String_table[ic__]) || (String_table[im__])) &&
+ (String_table[dc__]) && (curr->row[0] != (char) NULL) &&
+ (!NC_chinese))
{
j = 0;
first_time = TRUE;
@@ -3458,6 +3622,14 @@ doupdate()
{
while ((c1[j] == c2[j]) && (att1[j] == att2[j]) && (j < window->Num_cols) && (c2[j] != (char) NULL))
j++;
+
+ /*
+ | if previous character is an eight bit
+ | char, start redraw from that character
+ */
+
+ if ((NC_chinese) && (highbitset(c1[j - 1])))
+ j--;
begin_old = j;
begin_new = j;
if ((j < window->Num_cols) && (c2[j] != (char) NULL))
@@ -3618,3 +3790,25 @@ int offset;
Curr_x++;
}
+/*
+ |
+ | The two routines that follow, nc_setattrib(), nc_clearattrib(), are
+ | hacks that notify new_curse to handle characters that have the high
+ | bit set as the first of two bytes of a multi-byte string.
+ |
+ */
+
+void
+nc_setattrib(flag)
+int flag;
+{
+ nc_attributes |= flag;
+}
+
+void
+nc_clearattrib(flag)
+int flag;
+{
+ nc_attributes &= ~flag;
+}
+
diff --git a/usr.bin/ee/new_curse.h b/usr.bin/ee/new_curse.h
index bc46e5ba8d65..db538bb6b935 100644
--- a/usr.bin/ee/new_curse.h
+++ b/usr.bin/ee/new_curse.h
@@ -142,7 +142,8 @@
#define TRUE 1
#define FALSE 0
-#define A_STANDOUT 0001 /* standout mode */
+#define A_STANDOUT 0001 /* standout mode */
+#define A_NC_BIG5 0x0100 /* Handle Chinese Big5 characters */
#define SCROLL 1 /* text has been scrolled */
#define CLEAR 2 /* window has been cleared */
#define CHANGE 3 /* window has been changed */
@@ -196,6 +197,7 @@ extern int Get_int P_((void));
extern int INFO_PARSE P_((void));
extern int AtoI P_((void));
extern void Key_Get P_((void));
+extern void keys_vt100 P_((void));
extern struct _line *Screenalloc P_((int columns));
extern WINDOW *newwin P_((int lines, int cols, int start_l, int start_c));
extern int Operation P_((int Temp_Stack[], int place));
@@ -252,5 +254,7 @@ extern void attribute_on P_((void));
extern void attribute_off P_((void));
extern void Char_out P_((int newc, int newatt, char *line, char *attrib, int offset));
+extern void nc_setattrib P_((int));
+extern void nc_clearattrib P_((int));
#undef P_
diff --git a/usr.bin/ee/nls/en_US.ISO_8859-1/ee.msg b/usr.bin/ee/nls/en_US.ISO_8859-1/ee.msg
new file mode 100644
index 000000000000..f7c209c1a4b5
--- /dev/null
+++ b/usr.bin/ee/nls/en_US.ISO_8859-1/ee.msg
@@ -0,0 +1,185 @@
+$ This file contains the messages for ee ("easy editor"). See the file
+$ ee.i18n.guide for more information
+$
+$ For ee patchlevel 3
+$
+$ $Header: /home/hugh/sources/old_ae/RCS/ee.msg,v 1.8 1996/11/30 03:23:40 hugh Exp $
+$
+$
+$set 1
+$quote "
+1 "modes menu"
+2 "tabs to spaces "
+3 "case sensitive search"
+4 "margins observed "
+5 "auto-paragraph format"
+6 "eightbit characters "
+7 "info window "
+8 "right margin "
+9 "leave menu"
+10 "save changes"
+11 "no save"
+12 "file menu"
+13 "read a file"
+14 "write a file"
+15 "save file"
+16 "print editor contents"
+17 "search menu"
+18 "search for ..."
+19 "search"
+20 "spell menu"
+21 "use 'spell'"
+22 "use 'ispell'"
+23 "miscellaneous menu"
+24 "format paragraph"
+25 "shell command"
+26 "check spelling"
+27 "main menu"
+28 "leave editor"
+29 "help"
+30 "file operations"
+31 "redraw screen"
+32 "settings"
+33 "search"
+34 "miscellaneous"
+35 "Control keys: "
+36 "^a ascii code ^i tab ^r right "
+37 "^b bottom of text ^j newline ^t top of text "
+38 "^c command ^k delete char ^u up "
+39 "^d down ^l left ^v undelete word "
+40 "^e search prompt ^m newline ^w delete word "
+41 "^f undelete char ^n next page ^x search "
+42 "^g begin of line ^o end of line ^y delete line "
+43 "^h backspace ^p prev page ^z undelete line "
+44 "^[ (escape) menu "
+45 " "
+46 "Commands: "
+47 "help : get this info file : print file name "
+48 "read : read a file char : ascii code of char "
+49 "write : write a file case : case sensitive search "
+50 "exit : leave and save nocase : case insensitive search "
+51 "quit : leave, no save !cmd : execute \"cmd\" in shell "
+52 "line : display line # 0-9 : go to line \"#\" "
+53 "expand : expand tabs noexpand: do not expand tabs "
+54 " "
+55 " ee [+#] [-i] [-e] [-h] [file(s)] "
+56 "+# :go to line # -i :no info window -e : don't expand tabs -h :no highlight"
+57 "^[ (escape) menu ^e search prompt ^y delete line ^u up ^p prev page "
+58 "^a ascii code ^x search ^z undelete line ^d down ^n next page "
+59 "^b bottom of text ^g begin of line ^w delete word ^l left "
+60 "^t top of text ^o end of line ^v undelete word ^r right "
+61 "^c command ^k delete char ^f undelete char "
+62 "help : get help info |file : print file name |line : print line # "
+63 "read : read a file |char : ascii code of char |0-9 : go to line \"#\""
+64 "write: write a file |case : case sensitive search |exit : leave and save "
+65 "!cmd : shell \"cmd\" |nocase: ignore case in search |quit : leave, no save"
+66 "expand: expand tabs |noexpand: do not expand tabs "
+67 " press Escape (^[) for menu"
+68 "no file"
+69 "ascii code: "
+70 "sending contents of buffer to \"%s\" "
+71 "command: "
+72 "name of file to write: "
+73 "name of file to read: "
+74 "character = %d"
+75 "unknown command \"%s\""
+76 "entered command is not unique"
+77 "line %d "
+78 "length = %d"
+79 "current file is \"%s\" "
+80 "usage: %s [-i] [-e] [-h] [+line_number] [file(s)]\n"
+81 " -i turn off info window\n"
+82 " -e do not convert tabs to spaces\n"
+83 " -h do not use highlighting\n"
+84 "file \"%s\" is a directory"
+85 "new file \"%s\""
+86 "can't open \"%s\""
+87 "file \"%s\", %d lines"
+88 "finished reading file \"%s\""
+89 "reading file \"%s\""
+90 ", read only"
+91 "file \"%s\", %d lines"
+92 "enter name of file: "
+93 "no filename entered: file not saved"
+94 "changes have been made, are you sure? (y/n [n]) "
+95 "y"
+96 "file already exists, overwrite? (y/n) [n] "
+97 "unable to create file \"%s\""
+98 "writing file \"%s\""
+99 "\"%s\" %d lines, %d characters"
+100 " ...searching"
+101 "string \"%s\" not found"
+102 "search for: "
+103 "could not exec %s\n"
+104 "press return to continue "
+105 "press Esc to cancel"
+106 "menu too large for window"
+107 "press any key to continue "
+108 "shell command: "
+109 "...formatting paragraph..."
+110 "<!echo 'list of unrecognized words'; echo -=-=-=-=-=-"
+111 "sending contents of edit buffer to 'spell'"
+112 "right margin is: "
+113 "restricted mode: unable to perform requested operation"
+114 "ON"
+115 "OFF"
+116 "HELP"
+117 "WRITE"
+118 "READ"
+119 "LINE"
+120 "FILE"
+121 "CHARACTER"
+122 "REDRAW"
+123 "RESEQUENCE"
+124 "AUTHOR"
+125 "VERSION"
+126 "CASE"
+127 "NOCASE"
+128 "EXPAND"
+129 "NOEXPAND"
+130 "EXIT"
+131 "QUIT"
+132 "INFO"
+133 "NOINFO"
+134 "MARGINS"
+135 "NOMARGINS"
+136 "AUTOFORMAT"
+137 "NOAUTOFORMAT"
+138 "ECHO"
+139 "PRINTCOMMAND"
+140 "RIGHTMARGIN"
+141 "HIGHLIGHT"
+142 "NOHIGHLIGHT"
+143 "EIGHTBIT"
+144 "NOEIGHTBIT"
+145 "emacs key bindings "
+146 "^a beginning of line ^i tab ^r restore word "
+147 "^b back 1 char ^j undel char ^t top of text "
+148 "^c command ^k delete line ^u bottom of text "
+149 "^d delete char ^l undelete line ^v next page "
+150 "^e end of line ^m newline ^w delete word "
+151 "^f forward 1 char ^n next line ^x search "
+152 "^g go back 1 page ^o ascii char insert ^y search prompt "
+153 "^h backspace ^p prev line ^z next word "
+154 "^[ (escape) menu ^y search prompt ^k delete line ^p prev li ^g prev page"
+155 "^o ascii code ^x search ^l undelete line ^n next li ^v next page"
+156 "^u end of file ^a begin of line ^w delete word ^b back 1 char "
+157 "^t top of text ^e end of line ^r restore word ^f forward 1 char "
+158 "^c command ^d delete char ^j undelete char ^z next word "
+159 "EMACS"
+160 "NOEMACS"
+161 " +# put cursor at line #\n"
+162 "unable to open .init.ee for writing, no configuration saved!"
+163 "ee configuration saved in file %s"
+164 "save editor configuration"
+165 "save ee configuration"
+166 "save in current directory"
+167 "save in home directory"
+168 "ee configuration not saved"
+169 "must specify a file when invoking ree"
+180 "menu too large for window"
+181 "^^more^^"
+182 "VVmoreVV"
+183 "16 bit characters "
+184 "16BIT"
+185 "NO16BIT"