mirror of git://git.sv.gnu.org/nano.git
DLR: latest patch
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1221 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
790d362f41
commit
f21cd10a3f
79
ChangeLog
79
ChangeLog
|
@ -3,11 +3,88 @@ CVS Code -
|
|||
- Translation updates (see po/ChangeLog for details).
|
||||
- Upgraded to gettext 0.11.2 (Jordi).
|
||||
Removed intl/ entirely, and a few more tweaks by gettextize.
|
||||
- i18nized a few strings used in DEBUG mode. (DLR)
|
||||
- Some chars being assigned 0 are now assigned '\0'. (DLR)
|
||||
- Put header files in a more consistent order. (DLR)
|
||||
- Remove some unneeded blank lines and spaces, and make some
|
||||
spacing more consistent. (DLR)
|
||||
- When possible, use iscntrl() to determine whether a character
|
||||
is a control character or not. (DLR)
|
||||
- Miscellaneous typo fixes. (DLR)
|
||||
- files.c:
|
||||
read_file(), read_line():
|
||||
- Rework to properly handle nulls in the input file, fix
|
||||
detection of binary files to properly mark a file as binary if
|
||||
the only binary characters it contains are ASCII 127's, and
|
||||
after reading the last line of a file that doesn't end in a
|
||||
newline, increment totsize. Remove previous kludge to set
|
||||
totsize properly. (DLR)
|
||||
write_file():
|
||||
- Rework to properly handle nulls in the input file. When
|
||||
appending/prepending, don't change the current file's name to
|
||||
the name of the file it's being appended/prepended to. When
|
||||
writing a marked selection to a file, save and restore totsize
|
||||
so it isn't decreased by the size of the selection afterward.
|
||||
(DLR)
|
||||
append_slash_if_dir(), input_tab():
|
||||
- Changed a variable name: lastWasTab -> lastwastab. (DLR)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Rework IFHELP macro (David Benbennick).
|
||||
- move.c:
|
||||
page_down(), page_up():
|
||||
- Put sanity checks for current_x back in, to avoid rare
|
||||
segfaults (oops). Now, however, they are only called when
|
||||
placewewant is zero instead of being called unconditionally;
|
||||
see changes to winio.c:actual_x_from_start() below. (DLR)
|
||||
- nanorc.sample:
|
||||
- Put in much less crappy example regex rules for c-file.
|
||||
- nano.c:
|
||||
clear_filename():
|
||||
- Remove this function, as it has unneeded functionality, is
|
||||
short enough to be inlined, and is only called in two spots
|
||||
anyway. (DLR)
|
||||
do_int_spell(), do_alt_spell():
|
||||
- Rework to save the marked selection before doing spell checking
|
||||
and restore it afterward. (DLR)
|
||||
main():
|
||||
- Rework to blank out filename manually before doing anything
|
||||
with it, instead of calling clear_filename() in two places.
|
||||
Make startline an int instead of a long, since it's supposed to
|
||||
hold a line number. (DLR)
|
||||
- search.c:
|
||||
findnextstr():
|
||||
- Update the current line at current_x if we don't find a match.
|
||||
(DLR)
|
||||
do_gotopos():
|
||||
- Simplify the sanity check to only put x within the range of the
|
||||
current line; don't call actual_x() anymore. (DLR)
|
||||
- utils.c:
|
||||
- Add sunder() and unsunder(). These functions convert nulls
|
||||
other than the terminating null in strings to newlines and
|
||||
back; they're used to handle null characters in files properly.
|
||||
(DLR)
|
||||
- winio.c:
|
||||
actual_x_from_start():
|
||||
- Overhaul to make cursor placement more like that of Pico: add
|
||||
sanity check for i, and then place i as close to the value of
|
||||
xplus column as possible. This change is most noticeable when
|
||||
moving down through binary files. (DLR)
|
||||
nanogetstr():
|
||||
- After the user presses Enter at the prompt, refresh the edit
|
||||
window in case there's a list of possible filename matches
|
||||
(left over from attempted tab completion) on it. (DLR)
|
||||
update_line():
|
||||
- When marking control characters, make sure the mark moves
|
||||
forward by two characters inctead of one. Rework control
|
||||
character display routine to display newlines within the line
|
||||
(which should never occur under normal circumstances; they will
|
||||
only be there if the line had nulls in it and was unsunder()ed
|
||||
beforehand) as ^@'s. (DLR)
|
||||
do_help():
|
||||
- Add support for the handled keyboard escape sequences in the
|
||||
help menu, as they are needed with some terminals (e.g. xterm
|
||||
with TERM=ansi). (DLR)
|
||||
- THANKS:
|
||||
- Completed a bit (Jordi).
|
||||
GNU nano 1.1.9 - 05/12/2002
|
||||
|
@ -88,7 +165,7 @@ GNU nano 1.1.9 - 05/12/2002
|
|||
(David Lawrence Ramsey).
|
||||
- winio.c:
|
||||
edit_add()
|
||||
- Changed some syntax hilight computations for the sake of COLS.
|
||||
- Changed some syntax highlight computations for the sake of COLS.
|
||||
- Add in the necessary regfree() calls to stop nano from leaking
|
||||
memory like a sieve when using color syntax highlighting :-)
|
||||
botombars(), onekey()
|
||||
|
|
1
TODO
1
TODO
|
@ -19,7 +19,6 @@ For version 1.4:
|
|||
- UTF-8 support.
|
||||
- Undo/Redo key?
|
||||
|
||||
|
||||
Old requests:
|
||||
|
||||
For version 1.0:
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
/* Define this if your curses library has the use_default_colors command */
|
||||
#undef HAVE_USE_DEFAULT_COLORS
|
||||
|
||||
/* Define this to have syntax hilighting, requires ENABLE_NANORC too! */
|
||||
/* Define this to have syntax highlighting, requires ENABLE_NANORC too! */
|
||||
#undef ENABLE_COLOR
|
||||
|
||||
/* Define this to enable undoing....something */
|
||||
|
|
6
color.c
6
color.c
|
@ -43,7 +43,7 @@
|
|||
void color_on(WINDOW *win, int whatever)
|
||||
{
|
||||
/* Temporary fallback, if the color value hasn't been set,
|
||||
turn on hilighting */
|
||||
turn on highlighting */
|
||||
if (!colors[whatever - FIRST_COLORNUM].set) {
|
||||
wattron(win, A_REVERSE);
|
||||
return;
|
||||
|
@ -78,7 +78,6 @@ void color_off(WINDOW *win, int whatever)
|
|||
wattroff(win, A_BOLD);
|
||||
}
|
||||
|
||||
|
||||
void colorinit_one(int colortoset, short fg, short bg, int bold)
|
||||
{
|
||||
colors[colortoset - FIRST_COLORNUM].fg = fg;
|
||||
|
@ -135,7 +134,7 @@ int do_colorinit(void)
|
|||
init_pair(i, tmpcolor->fg, tmpcolor->bg);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Running init_pair with fg = %d and bg = %d\n", tmpcolor->fg, tmpcolor->bg);
|
||||
fprintf(stderr, _("Running init_pair with fg = %d and bg = %d\n"), tmpcolor->fg, tmpcolor->bg);
|
||||
#endif
|
||||
|
||||
tmpcolor->pairnum = i;
|
||||
|
@ -209,4 +208,3 @@ void update_color(void)
|
|||
}
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
|
|
4
cut.c
4
cut.c
|
@ -94,7 +94,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
|||
current_x = top_x;
|
||||
update_cursor();
|
||||
}
|
||||
tmpstr[newsize - 1] = 0;
|
||||
tmpstr[newsize - 1] = '\0';
|
||||
tmp->data = tmpstr;
|
||||
add_to_cutbuffer(tmp);
|
||||
dump_buffer(cutbuffer);
|
||||
|
@ -233,7 +233,7 @@ int do_cut_text(void)
|
|||
junk = NULL;
|
||||
junk = make_new_node(current);
|
||||
junk->data = charalloc(1);
|
||||
junk->data[0] = 0;
|
||||
junk->data[0] = '\0';
|
||||
|
||||
add_to_cutbuffer(junk);
|
||||
dump_buffer(cutbuffer);
|
||||
|
|
3
faq.html
3
faq.html
|
@ -342,7 +342,7 @@ install</b>.</font></blockquote>
|
|||
'gettext' and/or 'gettextdomain'. What can I do about it?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Try doing a <b>./configure --with-included-gettext</b>
|
||||
and see if that solves your problem. You make need to do a <b>make
|
||||
and see if that solves your problem. You may need to do a <b>make
|
||||
clean ; make</b> to get it to work fully.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
|
@ -694,6 +694,7 @@ and you should know the answer.</font></blockquote>
|
|||
<a NAME="8"></a><font color="#330000">8. ChangeLog</font>
|
||||
</h2>
|
||||
|
||||
<blockquote>2002/05/15 - Typo fix (DLR).</blockquote>
|
||||
<blockquote>2001/12/26 - Misc. fixes (Aaron S. Hawley, DLR).</blockquote>
|
||||
<blockquote>2001/10/02 - Update for Free Translation Project.</blockquote>
|
||||
<blockquote>2001/10/02 - Assorted fixes, Debian additions.</blockquote>
|
||||
|
|
123
files.c
123
files.c
|
@ -33,7 +33,6 @@
|
|||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
|
@ -108,11 +107,15 @@ void new_file(void)
|
|||
|
||||
}
|
||||
|
||||
filestruct *read_line(char *buf, filestruct *prev, int *line1ins)
|
||||
filestruct *read_line(char *buf, filestruct *prev, int *line1ins, int len)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
|
||||
fileptr = nmalloc(sizeof(filestruct));
|
||||
|
||||
/* nulls to newlines; len is the string's real length here */
|
||||
unsunder(buf, len);
|
||||
|
||||
fileptr->data = charalloc(strlen(buf) + 2);
|
||||
strcpy(fileptr->data, buf);
|
||||
|
||||
|
@ -120,7 +123,7 @@ filestruct *read_line(char *buf, filestruct *prev, int *line1ins)
|
|||
/* If it's a DOS file (CRLF), and file conversion isn't disabled,
|
||||
strip out the CR part */
|
||||
if (!ISSET(NO_CONVERT) && buf[strlen(buf) - 1] == '\r') {
|
||||
fileptr->data[strlen(buf) - 1] = 0;
|
||||
fileptr->data[strlen(buf) - 1] = '\0';
|
||||
totsize--;
|
||||
|
||||
if (!fileformat)
|
||||
|
@ -158,8 +161,8 @@ filestruct *read_line(char *buf, filestruct *prev, int *line1ins)
|
|||
|
||||
int read_file(FILE *f, const char *filename, int quiet)
|
||||
{
|
||||
int num_lines = 0;
|
||||
signed char input; /* current input character */
|
||||
int num_lines = 0, len = 0;
|
||||
char input; /* current input character */
|
||||
char *buf;
|
||||
long i = 0, bufx = 128;
|
||||
filestruct *fileptr = current, *tmp = NULL;
|
||||
|
@ -181,28 +184,51 @@ int read_file(FILE *f, const char *filename, int quiet)
|
|||
while ((input_int = getc(f)) != EOF) {
|
||||
input = (char) input_int;
|
||||
#ifndef NANO_SMALL
|
||||
if (!ISSET(NO_CONVERT) && input >= 0 && input <= 31
|
||||
&& input != 127 && input != '\t' && input != '\r'
|
||||
&& input != '\n')
|
||||
/* If the file has binary chars in it, don't stupidly
|
||||
assume it's a DOS or Mac formatted file! */
|
||||
SET(NO_CONVERT);
|
||||
if (!ISSET(NO_CONVERT) && iscntrl((int) input) && input != '\t'
|
||||
&& input != '\r' && input != '\n') {
|
||||
/* If the file has binary chars in it, don't stupidly
|
||||
assume it's a DOS or Mac formatted file! */
|
||||
SET(NO_CONVERT);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* calculate the total length of the line; it might have nulls in
|
||||
it, so we can't just use strlen() */
|
||||
len++;
|
||||
|
||||
if (input == '\n') {
|
||||
fileptr = read_line(buf, fileptr, &line1ins);
|
||||
|
||||
/* don't count the newline in the line length */
|
||||
len--;
|
||||
|
||||
/* read in the line properly */
|
||||
fileptr = read_line(buf, fileptr, &line1ins, len);
|
||||
|
||||
/* reset the line length, in preparation for the next line */
|
||||
len = 0;
|
||||
|
||||
num_lines++;
|
||||
buf[0] = 0;
|
||||
buf[0] = '\0';
|
||||
i = 0;
|
||||
#ifndef NANO_SMALL
|
||||
/* If it's a Mac file (no LF just a CR), and file conversion
|
||||
isn't disabled, handle it! */
|
||||
} else if (!ISSET(NO_CONVERT) && i > 0 && buf[i-1] == '\r') {
|
||||
} else if (!ISSET(NO_CONVERT) && i > 0 && buf[i - 1] == '\r') {
|
||||
fileformat = 2;
|
||||
fileptr = read_line(buf, fileptr, &line1ins);
|
||||
|
||||
/* don't count the newline in the line length */
|
||||
len--;
|
||||
|
||||
/* read in the line properly */
|
||||
fileptr = read_line(buf, fileptr, &line1ins, len);
|
||||
|
||||
/* reset the line length, in preparation for the next line */
|
||||
len = 0;
|
||||
|
||||
num_lines++;
|
||||
totsize++;
|
||||
buf[0] = input;
|
||||
buf[1] = 0;
|
||||
buf[1] = '\0';
|
||||
i = 1;
|
||||
#endif
|
||||
} else {
|
||||
|
@ -216,7 +242,7 @@ int read_file(FILE *f, const char *filename, int quiet)
|
|||
bufx += 128;
|
||||
}
|
||||
buf[i] = input;
|
||||
buf[i + 1] = 0;
|
||||
buf[i + 1] = '\0';
|
||||
i++;
|
||||
}
|
||||
totsize++;
|
||||
|
@ -229,10 +255,14 @@ int read_file(FILE *f, const char *filename, int quiet)
|
|||
}
|
||||
|
||||
/* Did we not get a newline but still have stuff to do? */
|
||||
if (buf[0]) {
|
||||
fileptr = read_line(buf, fileptr, &line1ins);
|
||||
if (len > 0) {
|
||||
|
||||
/* read in the LAST line properly */
|
||||
fileptr = read_line(buf, fileptr, &line1ins, len);
|
||||
|
||||
num_lines++;
|
||||
buf[0] = 0;
|
||||
totsize++;
|
||||
buf[0] = '\0';
|
||||
}
|
||||
|
||||
/* Did we even GET a file if we don't already have one? */
|
||||
|
@ -450,13 +480,6 @@ int do_insertfile(int loading_file)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Here is a kludge. If the current file is blank (including
|
||||
* after new_file()), then totlines==1 and totsize==0. Thus
|
||||
* after open_pipe() or open_file() below, the totsize is short
|
||||
* by one. */
|
||||
if (totlines==1 && totsize==0)
|
||||
totsize++;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (i == NANO_EXTCMD_KEY) {
|
||||
i = open_pipe(answer);
|
||||
|
@ -1212,7 +1235,7 @@ int check_operating_dir(char *currpath, int allow_tabcomp)
|
|||
* append == 2 means we are prepending instead of overwriting.
|
||||
*
|
||||
* nonamechange means don't change the current filename, it is ignored
|
||||
* if tmp == 1.
|
||||
* if tmp == 1 or if we're appending/prepending.
|
||||
*/
|
||||
int write_file(char *name, int tmp, int append, int nonamechange)
|
||||
{
|
||||
|
@ -1312,7 +1335,7 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
|||
|
||||
dump_buffer(fileage);
|
||||
|
||||
f = fdopen(fd, append==1 ? "ab" : "wb");
|
||||
f = fdopen(fd, append == 1 ? "ab" : "wb");
|
||||
if (!f) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
|
@ -1326,7 +1349,15 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
|||
break;
|
||||
|
||||
data_len = strlen(fileptr->data);
|
||||
|
||||
/* newlines to nulls, just before we write to disk */
|
||||
sunder(fileptr->data);
|
||||
|
||||
size = fwrite(fileptr->data, 1, data_len, f);
|
||||
|
||||
/* nulls to newlines; data_len is the string's real length here */
|
||||
unsunder(fileptr->data, data_len);
|
||||
|
||||
if (size < data_len) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
|
@ -1354,7 +1385,15 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
|||
int data_len;
|
||||
|
||||
data_len = strlen(fileptr->data);
|
||||
|
||||
/* newlines to nulls, just before we write to disk */
|
||||
sunder(fileptr->data);
|
||||
|
||||
size = fwrite(fileptr->data, 1, data_len, f);
|
||||
|
||||
/* nulls to newlines; data_len is the string's real length here */
|
||||
unsunder(fileptr->data, data_len);
|
||||
|
||||
if (size < data_len) {
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
|
@ -1486,7 +1525,7 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
|||
statusbar(_("Could not set permissions %o on %s: %s"),
|
||||
mask, realname, strerror(errno));
|
||||
|
||||
if (!tmp) {
|
||||
if (!tmp && !append) {
|
||||
if (!nonamechange)
|
||||
filename = mallocstrcpy(filename, realname);
|
||||
|
||||
|
@ -1589,9 +1628,9 @@ int do_writeout(char *path, int exiting, int append)
|
|||
TOGGLE(MAC_FILE);
|
||||
return(do_writeout(answer, exiting, append));
|
||||
} else if (i == NANO_PREPEND_KEY)
|
||||
return(do_writeout(answer, exiting, append==2 ? 0 : 2));
|
||||
return(do_writeout(answer, exiting, append == 2 ? 0 : 2));
|
||||
else if (i == NANO_APPEND_KEY)
|
||||
return(do_writeout(answer, exiting, append==1 ? 0 : 1));
|
||||
return(do_writeout(answer, exiting, append == 1 ? 0 : 1));
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("filename is %s"), answer);
|
||||
|
@ -1622,6 +1661,7 @@ int do_writeout(char *path, int exiting, int append)
|
|||
filestruct *fileagebak = fileage;
|
||||
filestruct *filebotbak = filebot;
|
||||
filestruct *cutback = cutbuffer;
|
||||
long totsizebak = totsize;
|
||||
int oldmod = 0;
|
||||
cutbuffer = NULL;
|
||||
|
||||
|
@ -1648,6 +1688,7 @@ int do_writeout(char *path, int exiting, int append)
|
|||
fileage = fileagebak;
|
||||
filebot = filebotbak;
|
||||
cutbuffer = cutback;
|
||||
totsize = totsizebak;
|
||||
if (oldmod)
|
||||
set_modified();
|
||||
} else
|
||||
|
@ -1708,7 +1749,7 @@ char *real_dir_from_tilde(char *buf)
|
|||
;
|
||||
|
||||
find_user = mallocstrcpy(find_user, &buf[1]);
|
||||
find_user[i - 1] = 0;
|
||||
find_user[i - 1] = '\0';
|
||||
|
||||
for (userdata = getpwent(); userdata != NULL &&
|
||||
strcmp(userdata->pw_name, find_user);
|
||||
|
@ -1732,7 +1773,7 @@ char *real_dir_from_tilde(char *buf)
|
|||
}
|
||||
|
||||
/* Tack a slash onto the string we're completing if it's a directory */
|
||||
int append_slash_if_dir(char *buf, int *lastWasTab, int *place)
|
||||
int append_slash_if_dir(char *buf, int *lastwastab, int *place)
|
||||
{
|
||||
char *dirptr;
|
||||
struct stat fileinfo;
|
||||
|
@ -1746,7 +1787,7 @@ int append_slash_if_dir(char *buf, int *lastWasTab, int *place)
|
|||
strncat(buf, "/", 1);
|
||||
*place += 1;
|
||||
/* now we start over again with # of tabs so far */
|
||||
*lastWasTab = 0;
|
||||
*lastwastab = 0;
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
|
@ -1844,7 +1885,7 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
|||
tmp++;
|
||||
|
||||
strncpy(dirName, buf, tmp - buf + 1);
|
||||
dirName[tmp - buf] = 0;
|
||||
dirName[tmp - buf] = '\0';
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -1933,7 +1974,7 @@ char **cwd_tab_completion(char *buf, int *num_matches)
|
|||
/* This function now has an arg which refers to how much the
|
||||
* statusbar (place) should be advanced, i.e. the new cursor pos.
|
||||
*/
|
||||
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list)
|
||||
char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list)
|
||||
{
|
||||
/* Do TAB completion */
|
||||
static int num_matches = 0, match_matches = 0;
|
||||
|
@ -1944,10 +1985,10 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list)
|
|||
|
||||
*list = 0;
|
||||
|
||||
if (*lastWasTab == FALSE) {
|
||||
if (*lastwastab == FALSE) {
|
||||
char *tmp, *copyto, *matchBuf;
|
||||
|
||||
*lastWasTab = 1;
|
||||
*lastwastab = 1;
|
||||
|
||||
/* Make a local copy of the string -- up to the position of the
|
||||
cursor */
|
||||
|
@ -2006,7 +2047,7 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list)
|
|||
tmp = buf;
|
||||
|
||||
if (!strcmp(tmp, matches[0]))
|
||||
is_dir = append_slash_if_dir(buf, lastWasTab, newplace);
|
||||
is_dir = append_slash_if_dir(buf, lastwastab, newplace);
|
||||
|
||||
if (is_dir)
|
||||
break;
|
||||
|
@ -2028,7 +2069,7 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list)
|
|||
*newplace = 0;
|
||||
|
||||
/* Is it a directory? */
|
||||
append_slash_if_dir(buf, lastWasTab, newplace);
|
||||
append_slash_if_dir(buf, lastwastab, newplace);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
|
4
global.c
4
global.c
|
@ -23,8 +23,8 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
#include "nano.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
|
@ -38,7 +38,7 @@
|
|||
*/
|
||||
|
||||
int flags = 0; /* Our new flag containing many options */
|
||||
WINDOW *edit; /* The file portion of the editor */
|
||||
WINDOW *edit; /* The file portion of the editor */
|
||||
WINDOW *topwin; /* Top line of screen */
|
||||
WINDOW *bottomwin; /* Bottom buffer */
|
||||
char *filename = NULL; /* Name of the file */
|
||||
|
|
9
move.c
9
move.c
|
@ -112,9 +112,10 @@ int do_down(void)
|
|||
{
|
||||
wrap_reset();
|
||||
if (current->next != NULL) {
|
||||
update_line(current->prev, 0);
|
||||
if (placewewant > 0)
|
||||
current_x = actual_x(current->next, placewewant);
|
||||
else if (current_x > strlen(current->next->data))
|
||||
current_x = strlen(current->next->data);
|
||||
} else {
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
check_statblank();
|
||||
|
@ -155,12 +156,11 @@ void page_up(void)
|
|||
current_y = 0;
|
||||
|
||||
update_cursor();
|
||||
|
||||
}
|
||||
|
||||
int do_page_up(void)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
wrap_reset();
|
||||
current_x = 0;
|
||||
|
@ -182,13 +182,14 @@ int do_page_up(void)
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int do_up(void)
|
||||
{
|
||||
wrap_reset();
|
||||
if (current->prev != NULL) {
|
||||
if (placewewant > 0)
|
||||
current_x = actual_x(current->prev, placewewant);
|
||||
else if (current_x > strlen(current->prev->data))
|
||||
current_x = strlen(current->prev->data);
|
||||
}
|
||||
if (current_y > 0)
|
||||
current_y--;
|
||||
|
|
2
nano.1
2
nano.1
|
@ -66,7 +66,7 @@ Set the size (width) of a tab.
|
|||
Show the current version number and author.
|
||||
.TP
|
||||
.B \-Y (\-\-syntax=[str])
|
||||
Specify a specific syntax hilighting from the .nanorc to use (if available).
|
||||
Specify a specific syntax highlighting from the .nanorc to use (if available).
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position.
|
||||
|
|
|
@ -91,7 +91,7 @@ Show the current version number and author.
|
|||
<DT><B>-Y (--syntax=[str])</B>
|
||||
|
||||
<DD>
|
||||
Specify a specific syntax hilighting from the .nanorc to use (if available).
|
||||
Specify a specific syntax highlighting from the .nanorc to use (if available).
|
||||
<DT><B>-c (--const)</B>
|
||||
|
||||
<DD>
|
||||
|
|
76
nano.c
76
nano.c
|
@ -39,7 +39,6 @@
|
|||
#include <locale.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
|
@ -213,14 +212,6 @@ void print_view_warning(void)
|
|||
statusbar(_("Key illegal in VIEW mode"));
|
||||
}
|
||||
|
||||
void clear_filename(void)
|
||||
{
|
||||
if (filename != NULL)
|
||||
free(filename);
|
||||
filename = charalloc(1);
|
||||
filename[0] = 0;
|
||||
}
|
||||
|
||||
/* Initialize global variables - no better way for now. If
|
||||
save_cutbuffer is nonzero, don't set cutbuffer to NULL. */
|
||||
void global_init(int save_cutbuffer)
|
||||
|
@ -253,7 +244,7 @@ void global_init(int save_cutbuffer)
|
|||
|
||||
hblank = charalloc(COLS + 1);
|
||||
memset(hblank, ' ', COLS);
|
||||
hblank[COLS] = 0;
|
||||
hblank[COLS] = '\0';
|
||||
|
||||
}
|
||||
|
||||
|
@ -468,7 +459,7 @@ void null_at(char **data, int index)
|
|||
{
|
||||
|
||||
/* Ahh! Damn dereferencing */
|
||||
(*data)[index] = 0;
|
||||
(*data)[index] = '\0';
|
||||
align(data);
|
||||
}
|
||||
|
||||
|
@ -1367,6 +1358,9 @@ int do_int_spell_fix(char *word)
|
|||
char *prevanswer = NULL, *save_search = NULL, *save_replace = NULL;
|
||||
filestruct *begin;
|
||||
int i = 0, j = 0, beginx, beginx_top, reverse_search_set;
|
||||
#ifndef NANO_SMALL
|
||||
int mark_set;
|
||||
#endif
|
||||
|
||||
/* save where we are */
|
||||
begin = current;
|
||||
|
@ -1376,6 +1370,12 @@ int do_int_spell_fix(char *word)
|
|||
reverse_search_set = ISSET(REVERSE_SEARCH);
|
||||
UNSET(REVERSE_SEARCH);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Make sure the marking highlight is off during Spell Check */
|
||||
mark_set = ISSET(MARK_ISSET);
|
||||
UNSET(MARK_ISSET);
|
||||
#endif
|
||||
|
||||
/* save the current search/replace strings */
|
||||
search_init_globals();
|
||||
save_search = mallocstrcpy(save_search, last_search);
|
||||
|
@ -1438,6 +1438,12 @@ int do_int_spell_fix(char *word)
|
|||
if (reverse_search_set)
|
||||
SET(REVERSE_SEARCH);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* restore marking highlight */
|
||||
if (mark_set)
|
||||
SET(MARK_ISSET);
|
||||
#endif
|
||||
|
||||
edit_update(current, CENTER);
|
||||
|
||||
if (i == -1)
|
||||
|
@ -1451,8 +1457,7 @@ int do_int_speller(char *tempfile_name)
|
|||
{
|
||||
char *read_buff, *read_buff_ptr, *read_buff_word;
|
||||
size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
|
||||
int in_fd[2], tempfile_fd;
|
||||
int spell_status;
|
||||
int in_fd[2], tempfile_fd, spell_status;
|
||||
pid_t pid_spell;
|
||||
|
||||
/* Create a pipe to spell program */
|
||||
|
@ -1583,12 +1588,25 @@ int do_alt_speller(char *file_name)
|
|||
{
|
||||
int alt_spell_status, lineno_cur = current->lineno;
|
||||
int x_cur = current_x, y_cur = current_y, pww_cur = placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
int mark_set = 0, mbb_lineno_cur, mbx_cur;
|
||||
#endif
|
||||
|
||||
pid_t pid_spell;
|
||||
char *ptr;
|
||||
static int arglen = 3;
|
||||
static char **spellargs = (char **) NULL;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
mark_set = ISSET(MARK_ISSET);
|
||||
if (mark_set) {
|
||||
/* Save the marking position */
|
||||
mbb_lineno_cur = mark_beginbuf->lineno;
|
||||
mbx_cur = mark_beginx;
|
||||
UNSET(MARK_ISSET);
|
||||
}
|
||||
#endif
|
||||
|
||||
endwin();
|
||||
|
||||
/* Set up an argument list to pass the execvp function */
|
||||
|
@ -1635,6 +1653,15 @@ int do_alt_speller(char *file_name)
|
|||
global_init(1);
|
||||
open_file(file_name, 0, 1);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (mark_set) {
|
||||
/* Restore the marking position */
|
||||
do_gotopos(mbb_lineno_cur, mbx_cur, y_cur, 0);
|
||||
mark_beginbuf = current;
|
||||
SET(MARK_ISSET);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* go back to the old position, mark the file as modified, and make
|
||||
sure that the titlebar is refreshed */
|
||||
do_gotopos(lineno_cur, x_cur, y_cur, pww_cur);
|
||||
|
@ -2043,7 +2070,7 @@ void handle_sigwinch(int s)
|
|||
|
||||
hblank = nrealloc(hblank, COLS + 1);
|
||||
memset(hblank, ' ', COLS);
|
||||
hblank[COLS] = 0;
|
||||
hblank[COLS] = '\0';
|
||||
|
||||
#ifdef HAVE_RESIZETERM
|
||||
resizeterm(LINES, COLS);
|
||||
|
@ -2788,7 +2815,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
int optchr;
|
||||
int kbinput; /* Input from keyboard */
|
||||
long startline = 0; /* Line to try and start at */
|
||||
int startline = 0; /* Line to try and start at */
|
||||
int keyhandled; /* Have we handled the keystroke yet? */
|
||||
int modify_control_seq;
|
||||
char *argv0;
|
||||
|
@ -3022,6 +3049,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
}
|
||||
|
||||
/* Clear the filename we'll be using */
|
||||
filename = charalloc(1);
|
||||
filename[0] = '\0';
|
||||
|
||||
/* See if we were invoked with the name "pico" */
|
||||
argv0 = strrchr(argv[0], '/');
|
||||
if ((argv0 && strstr(argv0, "pico"))
|
||||
|| (!argv0 && strstr(argv[0], "pico")))
|
||||
|
@ -3029,23 +3061,17 @@ int main(int argc, char *argv[])
|
|||
|
||||
/* See if there's a non-option in argv (first non-option is the
|
||||
filename, if +LINE is not given) */
|
||||
if (argc == 1 || argc <= optind)
|
||||
clear_filename();
|
||||
else {
|
||||
if (argc > 1 && argc > optind) {
|
||||
/* Look for the +line flag... */
|
||||
if (argv[optind][0] == '+') {
|
||||
startline = atoi(&argv[optind][1]);
|
||||
optind++;
|
||||
if (argc == 1 || argc <= optind)
|
||||
clear_filename();
|
||||
else
|
||||
if (argc > 1 && argc > optind)
|
||||
filename = mallocstrcpy(filename, argv[optind]);
|
||||
|
||||
} else
|
||||
filename = mallocstrcpy(filename, argv[optind]);
|
||||
}
|
||||
|
||||
|
||||
/* First back up the old settings so they can be restored, duh */
|
||||
tcgetattr(0, &oldterm);
|
||||
|
||||
|
@ -3138,7 +3164,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
kbinput = wgetch(edit);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "AHA! %c (%d)\n", kbinput, kbinput);
|
||||
fprintf(stderr, _("AHA! %c (%d)\n"), kbinput, kbinput);
|
||||
#endif
|
||||
|
||||
if (kbinput == 27) { /* Grab Alt-key stuff first */
|
||||
|
@ -3421,7 +3447,7 @@ int main(int argc, char *argv[])
|
|||
break;
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "I got %c (%d)!\n", kbinput, kbinput);
|
||||
fprintf(stderr, _("I got %c (%d)!\n"), kbinput, kbinput);
|
||||
#endif
|
||||
/* We no longer stop unhandled sequences so that people with
|
||||
odd character sets can type... */
|
||||
|
|
|
@ -105,4 +105,3 @@
|
|||
#
|
||||
# syntax "mutt"
|
||||
# color green "^>.*"
|
||||
|
||||
|
|
4
proto.h
4
proto.h
|
@ -171,10 +171,12 @@ int do_left(void);
|
|||
int do_right(void);
|
||||
int check_wildcard_match(const char *text, const char *pattern);
|
||||
|
||||
char *input_tab(char *buf, int place, int *lastWasTab, int *newplace, int *list);
|
||||
char *input_tab(char *buf, int place, int *lastwastab, int *newplace, int *list);
|
||||
char *real_dir_from_tilde(char *buf);
|
||||
|
||||
void signal_init(void);
|
||||
void unsunder(char *str, int true_len);
|
||||
void sunder(char *str);
|
||||
void lowercase(char *src);
|
||||
void blank_bottombars(void);
|
||||
void check_wrap(filestruct * inptr);
|
||||
|
|
14
rcfile.c
14
rcfile.c
|
@ -221,7 +221,7 @@ void parse_syntax(FILE * rcstream, char *buf, char *ptr)
|
|||
tmpsyntax = syntaxes;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"Starting a new syntax type\n");
|
||||
_("Starting a new syntax type\n"));
|
||||
fprintf(stderr, "string val=%s\n", nameptr);
|
||||
#endif
|
||||
|
||||
|
@ -229,7 +229,7 @@ void parse_syntax(FILE * rcstream, char *buf, char *ptr)
|
|||
for (tmpsyntax = syntaxes;
|
||||
tmpsyntax->next != NULL; tmpsyntax = tmpsyntax->next);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Adding new syntax after 1st\n");
|
||||
fprintf(stderr, _("Adding new syntax after 1st\n"));
|
||||
#endif
|
||||
|
||||
tmpsyntax->next = nmalloc(sizeof(syntaxtype));
|
||||
|
@ -345,17 +345,17 @@ void parse_colors(FILE * rcstream, char *buf, char *ptr)
|
|||
tmpcolor = tmpsyntax->color;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,
|
||||
"Starting a new colorstring for fg %d bg %d\n",
|
||||
_("Starting a new colorstring for fg %d bg %d\n"),
|
||||
fg, bg);
|
||||
fprintf(stderr, "string val=%s\n", tmp);
|
||||
fprintf(stderr, _("string val=%s\n"), tmp);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
for (tmpcolor = tmpsyntax->color;
|
||||
tmpcolor->next != NULL; tmpcolor = tmpcolor->next);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Adding new entry for fg %d bg %d\n", fg, bg);
|
||||
fprintf(stderr, "string val=%s\n", tmp);
|
||||
fprintf(stderr, _("Adding new entry for fg %d bg %d\n"), fg, bg);
|
||||
fprintf(stderr, _("string val=%s\n"), tmp);
|
||||
#endif
|
||||
|
||||
tmpcolor->next = nmalloc(sizeof(colortype));
|
||||
|
@ -387,7 +387,7 @@ void parse_colors(FILE * rcstream, char *buf, char *ptr)
|
|||
beginning = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "For end part, beginning = \"%s\"\n",
|
||||
fprintf(stderr, _("For end part, beginning = \"%s\"\n"),
|
||||
beginning);
|
||||
#endif
|
||||
tmp = NULL;
|
||||
|
|
13
search.c
13
search.c
|
@ -221,7 +221,7 @@ void not_found_msg(char *str)
|
|||
char *foo = NULL;
|
||||
|
||||
foo = mallocstrcpy(foo, str);
|
||||
foo[COLS / 2] = 0;
|
||||
foo[COLS / 2] = '\0';
|
||||
statusbar(_("\"%s...\" not found"), foo);
|
||||
|
||||
free(foo);
|
||||
|
@ -274,6 +274,7 @@ filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beg
|
|||
if (search_last_line) {
|
||||
if (!quiet)
|
||||
not_found_msg(needle);
|
||||
update_line(fileptr, current_x);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -571,7 +572,7 @@ char *replace_line(void)
|
|||
|
||||
/* Head of Original Line */
|
||||
strncpy(copy, current->data, current_x);
|
||||
copy[current_x] = 0;
|
||||
copy[current_x] = '\0';
|
||||
|
||||
/* Replacement Text */
|
||||
if (!ISSET(USE_REGEXP))
|
||||
|
@ -863,11 +864,9 @@ void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant)
|
|||
current_y = pos_y;
|
||||
do_gotoline(line, 1);
|
||||
|
||||
/* recalculate the x-coordinate and place we want, just in case their
|
||||
values are insane; if they aren't, they won't be changed by this */
|
||||
current_x = pos_x;
|
||||
pos_placewewant = xplustabs();
|
||||
pos_x = actual_x(current, pos_placewewant);
|
||||
/* make sure that the x-coordinate is sane here */
|
||||
if (pos_x > strlen(current->data))
|
||||
pos_x = strlen(current->data);
|
||||
|
||||
/* set the rest of the coordinates up */
|
||||
current_x = pos_x;
|
||||
|
|
32
utils.c
32
utils.c
|
@ -19,16 +19,14 @@
|
|||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "nano.h"
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
#include <libintl.h>
|
||||
|
@ -52,6 +50,32 @@ int num_of_digits(int n)
|
|||
return i;
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
normally have newlines in it, so encode its nulls as newlines. */
|
||||
void unsunder(char *str, int true_len)
|
||||
{
|
||||
int i;
|
||||
if (strlen(str) < true_len) {
|
||||
for (i = 0; i < true_len; i++) {
|
||||
if (str[i] == '\0')
|
||||
str[i] = '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* For non-null-terminated lines. A line, by definition, shouldn't
|
||||
normally have newlines in it, so decode its newlines into nulls. */
|
||||
void sunder(char *str)
|
||||
{
|
||||
int i, true_len = strlen(str);
|
||||
if (strchr(str, '\n')) {
|
||||
for (i = 0; i < true_len; i++) {
|
||||
if (str[i] == '\n')
|
||||
str[i] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Lower case a string - must be null terminated */
|
||||
void lowercase(char *src)
|
||||
{
|
||||
|
|
101
winio.c
101
winio.c
|
@ -19,13 +19,13 @@
|
|||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
|
@ -85,7 +85,7 @@ int xpt(filestruct * fileptr, int index)
|
|||
} else if (fileptr->data[i] & 0x80)
|
||||
/* Make 8 bit chars only 1 column! */
|
||||
;
|
||||
else if (fileptr->data[i] < 32 || fileptr->data[i] == 127)
|
||||
else if (iscntrl((int) fileptr->data[i]))
|
||||
tabs++;
|
||||
}
|
||||
|
||||
|
@ -114,11 +114,25 @@ int actual_x_from_start(filestruct * fileptr, int xplus, int start)
|
|||
tot += tabsize - (tot % tabsize);
|
||||
} else if (fileptr->data[i] & 0x80)
|
||||
tot++; /* Make 8 bit chars only 1 column (again) */
|
||||
else if (fileptr->data[i] < 32 || fileptr->data[i] == 127) {
|
||||
else if (iscntrl((int) fileptr->data[i])) {
|
||||
i++;
|
||||
tot += 2;
|
||||
}
|
||||
|
||||
if (i > strlen(fileptr->data))
|
||||
i = strlen(fileptr->data);
|
||||
|
||||
/* see if we're in the x-plus-tabs column of xplus; if not, look
|
||||
for the closest column to it */
|
||||
if (xpt(fileptr, i) < xplus) {
|
||||
while (xpt(fileptr, i) < xplus && i < strlen(fileptr->data))
|
||||
i++;
|
||||
}
|
||||
else if (xpt(fileptr, i) > xplus) {
|
||||
while (xpt(fileptr, i) > xplus && i > start)
|
||||
i--;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("actual_x_from_start for xplus=%d returned %d\n"),
|
||||
xplus, i);
|
||||
|
@ -151,7 +165,7 @@ int strnlenpt(char *buf, int size)
|
|||
} else if (buf[i] & 0x80)
|
||||
/* Make 8 bit chars only 1 column! */
|
||||
;
|
||||
else if (buf[i] < 32 || buf[i] == 127)
|
||||
else if (iscntrl((int) buf[i]))
|
||||
tabs++;
|
||||
}
|
||||
|
||||
|
@ -192,7 +206,6 @@ void blank_bottombars(void)
|
|||
|
||||
for (; i <= 2; i++)
|
||||
mvwaddstr(bottomwin, i, 0, hblank);
|
||||
|
||||
}
|
||||
|
||||
void blank_edit(void)
|
||||
|
@ -275,7 +288,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut *s,
|
|||
|
||||
slen = length_of_list(s);
|
||||
inputbuf = charalloc(strlen(def) + 1);
|
||||
inputbuf[0] = 0;
|
||||
inputbuf[0] = '\0';
|
||||
|
||||
x_left = strlen(buf);
|
||||
x = strlen(def) + x_left;
|
||||
|
@ -363,7 +376,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut *s,
|
|||
memmove(inputbuf + (x - x_left),
|
||||
inputbuf + (x - x_left) + 1,
|
||||
strlen(inputbuf) - (x - x_left) - 1);
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
inputbuf[strlen(inputbuf) - 1] = '\0';
|
||||
}
|
||||
break;
|
||||
case NANO_CONTROL_K:
|
||||
|
@ -376,12 +389,12 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut *s,
|
|||
case NANO_CONTROL_H:
|
||||
if (strlen(inputbuf) > 0) {
|
||||
if (x == (x_left + strlen(inputbuf)))
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
inputbuf[strlen(inputbuf) - 1] = '\0';
|
||||
else if (x - x_left) {
|
||||
memmove(inputbuf + (x - x_left) - 1,
|
||||
inputbuf + (x - x_left),
|
||||
strlen(inputbuf) - (x - x_left));
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
inputbuf[strlen(inputbuf) - 1] = '\0';
|
||||
}
|
||||
}
|
||||
if (x > strlen(buf))
|
||||
|
@ -447,7 +460,7 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut *s,
|
|||
memmove(inputbuf + (x - x_left),
|
||||
inputbuf + (x - x_left) + 1,
|
||||
strlen(inputbuf) - (x - x_left) - 1);
|
||||
inputbuf[strlen(inputbuf) - 1] = 0;
|
||||
inputbuf[strlen(inputbuf) - 1] = '\0';
|
||||
}
|
||||
goto skip_tilde;
|
||||
case '4':
|
||||
|
@ -504,6 +517,13 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut *s,
|
|||
nanoget_repaint(buf, inputbuf, x);
|
||||
wrefresh(bottomwin);
|
||||
}
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/* if we've done tab completion, there might be a list of filename
|
||||
matches on the edit window at this point; make sure they're
|
||||
cleared off */
|
||||
if (list)
|
||||
edit_refresh();
|
||||
#endif
|
||||
|
||||
answer = mallocstrcpy(answer, inputbuf);
|
||||
free(inputbuf);
|
||||
|
@ -817,7 +837,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
|||
break;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Match! (%d chars) \"%s\"\n",
|
||||
fprintf(stderr, _("Match! (%d chars) \"%s\"\n"),
|
||||
colormatches[0].rm_eo - colormatches[0].rm_so,
|
||||
&fileptr->data[k + colormatches[0].rm_so]);
|
||||
#endif
|
||||
|
@ -830,7 +850,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
|||
paintlen =
|
||||
colormatches[0].rm_eo - colormatches[0].rm_so;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "paintlen (%d) = eo (%d) - so (%d)\n",
|
||||
fprintf(stderr, _("paintlen (%d) = eo (%d) - so (%d)\n"),
|
||||
paintlen, colormatches[0].rm_eo, colormatches[0].rm_so);
|
||||
#endif
|
||||
|
||||
|
@ -838,7 +858,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
|||
else {
|
||||
paintlen = COLS - k - colormatches[0].rm_so - 1;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "paintlen (%d) = COLS (%d) - k (%d), - rm.so (%d) - 1\n",
|
||||
fprintf(stderr, _("paintlen (%d) = COLS (%d) - k (%d), - rm.so (%d) - 1\n"),
|
||||
paintlen, COLS, k, colormatches[0].rm_so);
|
||||
#endif
|
||||
}
|
||||
|
@ -941,7 +961,7 @@ void edit_add(filestruct * fileptr, int yval, int start, int virt_cur_x,
|
|||
&fileptr->data[start + smatch],
|
||||
ematch - smatch);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "start = %d, smatch = %d, ematch = %d\n", start,
|
||||
fprintf(stderr, _("start = %d, smatch = %d, ematch = %d\n"), start,
|
||||
smatch, ematch);
|
||||
#endif
|
||||
|
||||
|
@ -1181,12 +1201,31 @@ void update_line(filestruct * fileptr, int index)
|
|||
if (i < mark_beginx)
|
||||
virt_mark_beginx--;
|
||||
} else if (realdata[i] == 127) {
|
||||
/* Treat control characters as ^symbol (ASCII 1 - 31, 127) */
|
||||
/* Treat control characters as ^symbol (ASCII 1 - 31 omitting
|
||||
10, 127) */
|
||||
fileptr->data[pos++] = '^';
|
||||
fileptr->data[pos++] = '?';
|
||||
} else if (realdata[i] >= 1 && realdata[i] <= 31) {
|
||||
if (i < current_x)
|
||||
virt_cur_x++;
|
||||
if (i < mark_beginx)
|
||||
virt_mark_beginx++;
|
||||
} else if (realdata[i] >= 1 && realdata[i] <= 31 && realdata[i] != 10) {
|
||||
fileptr->data[pos++] = '^';
|
||||
fileptr->data[pos++] = realdata[i] + 64;
|
||||
if (i < current_x)
|
||||
virt_cur_x++;
|
||||
if (i < mark_beginx)
|
||||
virt_mark_beginx++;
|
||||
} else if (realdata[i] == 10) {
|
||||
/* Treat newlines (ASCII 10's) embedded in a line as encoded
|
||||
nulls (ASCII 0's); the line in question should be run
|
||||
through unsunder() before reaching here */
|
||||
fileptr->data[pos++] = '^';
|
||||
fileptr->data[pos++] = '@';
|
||||
if (i < current_x)
|
||||
virt_cur_x++;
|
||||
if (i < mark_beginx)
|
||||
virt_mark_beginx++;
|
||||
} else {
|
||||
fileptr->data[pos++] = realdata[i];
|
||||
}
|
||||
|
@ -1741,9 +1780,36 @@ int do_help(void)
|
|||
break;
|
||||
#endif
|
||||
#endif
|
||||
case 27:
|
||||
kbinput = wgetch(edit);
|
||||
switch(kbinput) {
|
||||
case '[':
|
||||
kbinput = wgetch(edit);
|
||||
switch(kbinput) {
|
||||
case '5': /* Alt-[-5 = Page Up */
|
||||
wgetch(edit);
|
||||
goto do_pageupkey;
|
||||
break;
|
||||
case 'V': /* Alt-[-V = Page Up in Hurd Console */
|
||||
case 'I': /* Alt-[-I = Page Up - FreeBSD Console */
|
||||
goto do_pageupkey;
|
||||
break;
|
||||
case '6': /* Alt-[-6 = Page Down */
|
||||
wgetch(edit);
|
||||
goto do_pagedownkey;
|
||||
break;
|
||||
case 'U': /* Alt-[-U = Page Down in Hurd Console */
|
||||
case 'G': /* Alt-[-G = Page Down - FreeBSD Console */
|
||||
goto do_pagedownkey;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NANO_NEXTPAGE_KEY:
|
||||
case NANO_NEXTPAGE_FKEY:
|
||||
case KEY_NPAGE:
|
||||
do_pagedownkey:
|
||||
if (!no_more) {
|
||||
blank_edit();
|
||||
page++;
|
||||
|
@ -1752,6 +1818,7 @@ int do_help(void)
|
|||
case NANO_PREVPAGE_KEY:
|
||||
case NANO_PREVPAGE_FKEY:
|
||||
case KEY_PPAGE:
|
||||
do_pageupkey:
|
||||
if (page > 1) {
|
||||
no_more = 0;
|
||||
blank_edit();
|
||||
|
|
Loading…
Reference in New Issue