Added conversion messages for DOS and Mac files, and Alt-space as do-previous-word
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@858 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
ab23fbd019
commit
76e291beee
|
@ -1,4 +1,10 @@
|
||||||
CVS code -
|
CVS code -
|
||||||
|
- files.c:
|
||||||
|
- Added status messages for converted DOS and Mac files.
|
||||||
|
People should know that their file wasnt normally formatted.
|
||||||
|
- nano.c:
|
||||||
|
- New function do_prev_word, similar to do_next_word. Hard coded as
|
||||||
|
Alt-space, as next word is hard coded as control-space.
|
||||||
- po/sv.po:
|
- po/sv.po:
|
||||||
- Updated Swedish translation (Christian Rose).
|
- Updated Swedish translation (Christian Rose).
|
||||||
- po/sv.po:
|
- po/sv.po:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p4
|
||||||
|
|
||||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||||
dnl This file is free software; the Free Software Foundation
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
@ -125,6 +125,24 @@ for am_file in <<$1>>; do
|
||||||
done<<>>dnl>>)
|
done<<>>dnl>>)
|
||||||
changequote([,]))])
|
changequote([,]))])
|
||||||
|
|
||||||
|
#serial 1
|
||||||
|
# This test replaces the one in autoconf.
|
||||||
|
# Currently this macro should have the same name as the autoconf macro
|
||||||
|
# because gettext's gettext.m4 (distributed in the automake package)
|
||||||
|
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
|
||||||
|
# give these diagnostics:
|
||||||
|
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
|
||||||
|
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
|
||||||
|
|
||||||
|
undefine([AC_ISC_POSIX])
|
||||||
|
|
||||||
|
AC_DEFUN([AC_ISC_POSIX],
|
||||||
|
[
|
||||||
|
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
|
||||||
|
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
#serial 19
|
#serial 19
|
||||||
|
|
||||||
dnl By default, many hosts won't let programs access large files;
|
dnl By default, many hosts won't let programs access large files;
|
||||||
|
@ -797,15 +815,17 @@ AC_SUBST($1)dnl
|
||||||
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
# Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||||
#
|
#
|
||||||
# This file can be copied and used freely without restrictions. It can
|
# This file can be copied and used freely without restrictions. It can
|
||||||
# be used in projects which are not available under the GNU Public License
|
# be used in projects which are not available under the GNU General Public
|
||||||
# but which still want to provide support for the GNU gettext functionality.
|
# License but which still want to provide support for the GNU gettext
|
||||||
# Please note that the actual code is *not* freely available.
|
# functionality.
|
||||||
|
# Please note that the actual code of GNU gettext is covered by the GNU
|
||||||
|
# General Public License and is *not* in the public domain.
|
||||||
|
|
||||||
# serial 1
|
# serial 2
|
||||||
|
|
||||||
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
||||||
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
||||||
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
|
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
|
||||||
[# Extract the first word of "$2", so it can be a program name with args.
|
[# Extract the first word of "$2", so it can be a program name with args.
|
||||||
set dummy $2; ac_word=[$]2
|
set dummy $2; ac_word=[$]2
|
||||||
AC_MSG_CHECKING([for $ac_word])
|
AC_MSG_CHECKING([for $ac_word])
|
||||||
|
@ -833,7 +853,7 @@ ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
||||||
;;
|
;;
|
||||||
esac])dnl
|
esac])dnl
|
||||||
$1="$ac_cv_path_$1"
|
$1="$ac_cv_path_$1"
|
||||||
if test -n "[$]$1"; then
|
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
|
||||||
AC_MSG_RESULT([$]$1)
|
AC_MSG_RESULT([$]$1)
|
||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
|
|
|
@ -31,9 +31,6 @@
|
||||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||||
#undef off_t
|
#undef off_t
|
||||||
|
|
||||||
/* Define if you need to in order for stat and other things to work. */
|
|
||||||
#undef _POSIX_SOURCE
|
|
||||||
|
|
||||||
/* Define as the return type of signal handlers (int or void). */
|
/* Define as the return type of signal handlers (int or void). */
|
||||||
#undef RETSIGTYPE
|
#undef RETSIGTYPE
|
||||||
|
|
||||||
|
|
20
files.c
20
files.c
|
@ -43,6 +43,11 @@
|
||||||
#define _(string) (string)
|
#define _(string) (string)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* statics for here */
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
static int fileformat = 0; /* 0 = *nix, 1 = DOS, 2 = Mac */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Load file into edit buffer - takes data from file struct */
|
/* Load file into edit buffer - takes data from file struct */
|
||||||
void load_file(int quiet)
|
void load_file(int quiet)
|
||||||
{
|
{
|
||||||
|
@ -130,6 +135,9 @@ filestruct *read_line(char *buf, filestruct * prev, int *line1ins)
|
||||||
if (buf[strlen(buf) - 1] == '\r') {
|
if (buf[strlen(buf) - 1] == '\r') {
|
||||||
fileptr->data[strlen(buf) - 1] = 0;
|
fileptr->data[strlen(buf) - 1] = 0;
|
||||||
totsize--;
|
totsize--;
|
||||||
|
|
||||||
|
if (!fileformat)
|
||||||
|
fileformat = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -195,6 +203,7 @@ int read_file(int fd, char *filename, int quiet)
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* If it's a Mac file (no LF just a CR), handle it! */
|
/* If it's a Mac file (no LF just a CR), handle it! */
|
||||||
} else if (i > 0 && buf[i-1] == '\r') {
|
} else if (i > 0 && buf[i-1] == '\r') {
|
||||||
|
fileformat = 2;
|
||||||
fileptr = read_line(buf, fileptr, &line1ins);
|
fileptr = read_line(buf, fileptr, &line1ins);
|
||||||
num_lines++;
|
num_lines++;
|
||||||
buf[0] = input[0];
|
buf[0] = input[0];
|
||||||
|
@ -245,7 +254,16 @@ int read_file(int fd, char *filename, int quiet)
|
||||||
/* Update the edit buffer */
|
/* Update the edit buffer */
|
||||||
load_file(quiet);
|
load_file(quiet);
|
||||||
}
|
}
|
||||||
statusbar(_("Read %d lines"), num_lines);
|
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
if (fileformat == 2)
|
||||||
|
statusbar(_("Read %d lines (Converted Mac format)"), num_lines);
|
||||||
|
else if (fileformat == 1)
|
||||||
|
statusbar(_("Read %d lines (Converted DOS format)"), num_lines);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
statusbar(_("Read %d lines"), num_lines);
|
||||||
|
|
||||||
totlines += num_lines;
|
totlines += num_lines;
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
74
nano.c
74
nano.c
|
@ -235,6 +235,7 @@ void global_init(int save_cutbuffer)
|
||||||
hblank = charalloc(COLS + 1);
|
hblank = charalloc(COLS + 1);
|
||||||
memset(hblank, ' ', COLS);
|
memset(hblank, ' ', COLS);
|
||||||
hblank[COLS] = 0;
|
hblank[COLS] = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
|
@ -817,6 +818,74 @@ void do_next_word(void)
|
||||||
|
|
||||||
update_line(current, current_x);
|
update_line(current, current_x);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* the same thing for backwards */
|
||||||
|
void do_prev_word(void)
|
||||||
|
{
|
||||||
|
filestruct *fileptr, *old;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (current == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
old = current;
|
||||||
|
i = current_x;
|
||||||
|
for (fileptr = current; fileptr != NULL; fileptr = fileptr->prev) {
|
||||||
|
if (fileptr == current) {
|
||||||
|
while (isalnum((int) fileptr->data[i])
|
||||||
|
&& i != 0)
|
||||||
|
i--;
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
if (fileptr->prev != NULL)
|
||||||
|
i = strlen(fileptr->prev->data) - 1;
|
||||||
|
else if (fileptr == fileage && filebot != NULL)
|
||||||
|
i = strlen(filebot->data) - 1;
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
while (!isalnum((int) fileptr->data[i]) && i != 0)
|
||||||
|
i--;
|
||||||
|
|
||||||
|
if (i > 0) {
|
||||||
|
i--;
|
||||||
|
|
||||||
|
while (isalnum((int) fileptr->data[i]) && i != 0)
|
||||||
|
i--;
|
||||||
|
|
||||||
|
i++;
|
||||||
|
if (i != 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (fileptr->prev != NULL)
|
||||||
|
i = strlen(fileptr->prev->data) - 1;
|
||||||
|
else if (fileptr == fileage && filebot != NULL)
|
||||||
|
i = strlen(filebot->data) - 1;
|
||||||
|
}
|
||||||
|
if (fileptr == NULL)
|
||||||
|
current = fileage;
|
||||||
|
else
|
||||||
|
current = fileptr;
|
||||||
|
|
||||||
|
current_x = i;
|
||||||
|
placewewant = xplustabs();
|
||||||
|
|
||||||
|
if (current->lineno <= edittop->lineno)
|
||||||
|
edit_update(current, CENTER);
|
||||||
|
else {
|
||||||
|
/* If we've jumped lines, refresh the old line. We can't just use
|
||||||
|
* current->prev here, because we may have skipped over some blank
|
||||||
|
* lines, in which case the previous line is the wrong one.
|
||||||
|
*/
|
||||||
|
if (current != old)
|
||||||
|
update_line(old, 0);
|
||||||
|
|
||||||
|
update_line(current, current_x);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* NANO_SMALL */
|
#endif /* NANO_SMALL */
|
||||||
|
@ -2794,6 +2863,11 @@ int main(int argc, char *argv[])
|
||||||
modify_control_seq = 1;
|
modify_control_seq = 1;
|
||||||
keyhandled = 1;
|
keyhandled = 1;
|
||||||
break;
|
break;
|
||||||
|
case ' ':
|
||||||
|
/* If control-space is next word, Alt-space should be previous word */
|
||||||
|
do_prev_word();
|
||||||
|
keyhandled = 1;
|
||||||
|
break;
|
||||||
case '[':
|
case '[':
|
||||||
switch (kbinput = wgetch(edit)) {
|
switch (kbinput = wgetch(edit)) {
|
||||||
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
|
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
|
||||||
|
|
Loading…
Reference in New Issue