Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c32a5e7b4e | ||
|
|
a3e5fad059 | ||
|
|
7accda6dd7 | ||
|
|
b9f28013a7 | ||
|
|
c504dffa39 | ||
|
|
fc0ebe982d | ||
|
|
dcb4e3a66d | ||
|
|
00762ffaeb | ||
|
|
4857728f6e | ||
|
|
c0718343f5 | ||
|
|
d9a4dedd35 | ||
|
|
de85d63520 | ||
|
|
53d7bce68a | ||
|
|
a716bf42bc | ||
|
|
403e0feced | ||
|
|
e61e2c6f49 | ||
|
|
d4a071e492 | ||
|
|
894d80fc5d | ||
|
|
612caef65f | ||
|
|
88ad64d597 | ||
|
|
aa683853d4 | ||
|
|
050469c595 | ||
|
|
4811b81456 | ||
|
|
050b13ae5d | ||
|
|
6a84684571 | ||
|
|
caac92012d | ||
|
|
32a285c1eb | ||
|
|
b80d49f071 | ||
|
|
fe605247cb | ||
|
|
78d05481db | ||
|
|
b56ca1b7bb | ||
|
|
d37f6a3f5c | ||
|
|
5f3695bdb5 | ||
|
|
d8367986ce | ||
|
|
6e0ed3c1c6 | ||
|
|
c15583da31 | ||
|
|
8ac9087d75 | ||
|
|
c8857a2c26 | ||
|
|
297851a647 | ||
|
|
cb4f14b8ce | ||
|
|
263b447323 | ||
|
|
bc6a36e40d | ||
|
|
eb5092226d | ||
|
|
cf4db89d56 | ||
|
|
4e0b1ae332 | ||
|
|
c4daf5d49e | ||
|
|
b41df4a140 | ||
|
|
a853e2d650 | ||
|
|
6b94e95ec9 | ||
|
|
aad85151ae | ||
|
|
7ec8d7c6a3 | ||
|
|
39e8ce6f8e | ||
|
|
afbcf68c1a | ||
|
|
b9dec213be | ||
|
|
928babf8a1 | ||
|
|
2d825bae79 | ||
|
|
3dfc879f63 |
121
ChangeLog
121
ChangeLog
@@ -1,3 +1,122 @@
|
||||
GNU nano 1.3.7 - 2005.04.10
|
||||
- General:
|
||||
- Miscellaneous comment fixes. (DLR)
|
||||
- After (re)initializing the terminal, make sure the cursor is
|
||||
always turned on. Changes to do_alt_speller(),
|
||||
handle_sigwinch(), and main(). (DLR)
|
||||
- Make sure that all references to cut-to-end are left out when
|
||||
NANO_SMALL is defined. Changes to cut_to_eol(),
|
||||
do_cut_text(), and do_statusbar_cut_text(). (DLR)
|
||||
- chars.c:
|
||||
make_mbchar()
|
||||
- Remove unneeded assert. (DLR)
|
||||
move_mbleft()
|
||||
- Fix assert to reference the proper variable, so that nano
|
||||
builds with DEBUG defined again. (Mike Frysinger, found by
|
||||
Dmitri Vassilenko)
|
||||
- files.c:
|
||||
do_insertfile()
|
||||
- Fix problem where going into the help browser at the "Insert
|
||||
File" prompt would always result in the current answer's being
|
||||
used as the filename afterward. (DLR)
|
||||
get_full_path()
|
||||
- Rework handling of the results of getcwd() in order to avoid
|
||||
segfaults if they fail, and to remove uses of the nonportable
|
||||
GNU extension where passing a size of 0 will get a string as
|
||||
long as we need. (DLR)
|
||||
do_browser()
|
||||
- Rename variable lineno to fileline to avoid confusion. (DLR)
|
||||
do_browse_from()
|
||||
- Rework handling of the results of getcwd() in order to avoid
|
||||
segfaults if they fail, and to remove uses of the nonportable
|
||||
GNU extension where passing a size of 0 will get a string as
|
||||
long as we need. (DLR)
|
||||
- nano.c:
|
||||
help_init()
|
||||
- When calculating allocsize, take multibyte characters into
|
||||
account, and keep the column number limits consistent. (DLR)
|
||||
- Break htx up into three chunks, in case the string is too long
|
||||
for the compiler to handle (e.g. an ISO C89 compiler that can
|
||||
only handle up to 509 characters). (DLR)
|
||||
- Minor wording fixes. (DLR)
|
||||
print1opt()
|
||||
- Don't include longflag if HAVE_GETOPT_LONG isn't defined.
|
||||
Rename this function to print1opt_full(), leave out the
|
||||
longflag parameter if HAVE_GETOPT_LONG isn't defined, and make
|
||||
print1opt() a macro for print1opt_full() that does that
|
||||
without the need for a lot of extra #ifdefs. (David
|
||||
Benbennick) DLR: Rename print1opt_f() to print1opt_full().
|
||||
- Rework the special case of options that are ignored for Pico
|
||||
compatibility so that they display more neatly when
|
||||
HAVE_GETOPT_LONG isn't defined. (DLR)
|
||||
usage()
|
||||
- Fix erroneous #ifdef that resulted in the -d/--rebinddelete
|
||||
option's not being printed when NANO_SMALL was defined. (DLR)
|
||||
find_paragraph()
|
||||
- Fix problem where a search for the next paragraph would skip
|
||||
over certain cases of one-line paragraphs. (DLR)
|
||||
do_justify()
|
||||
- Instead of breaking a line at a space and readding the space
|
||||
afterwards, just break the line after the space, as it's more
|
||||
efficient. (DLR)
|
||||
main()
|
||||
- Change 0 to NULL in the option struct where needed. (David
|
||||
Benbennick)
|
||||
- nano.h:
|
||||
- Define PATH_MAX as 4096 if it isn't defined, as passing a size
|
||||
of 0 to get a string as long as we need is a nonportable GNU
|
||||
extension, and hence it won't work on non-GNU systems that
|
||||
don't define PATH_MAX. (DLR)
|
||||
- rcfile.c:
|
||||
parse_rcfile()
|
||||
- Fix debugging message to display the long value of a flag
|
||||
properly. (DLR)
|
||||
- utils.c:
|
||||
regexec_safe()
|
||||
- Rename to safe_regexec() for consistency. (DLR)
|
||||
- winio.c:
|
||||
nanogetstr()
|
||||
- Fix misplaced break. (DLR)
|
||||
statusq()
|
||||
- Make sure that the vsnprintf(foo) call and foo's subsequent
|
||||
null termination both take the proper number of bytes when
|
||||
using multibyte characters, so that multibyte prompt strings
|
||||
aren't prematurely cut off. (DLR)
|
||||
titlebar()
|
||||
- Make sure that the (mv)?waddnstr() calls take the proper
|
||||
number of bytes when using multibyte characters, so that
|
||||
multibyte strings aren't prematurely cut off. (DLR, found by
|
||||
Jordi)
|
||||
- Allow the "View" state to be displayed when a filename is
|
||||
passed in, in case we're in multibuffer mode and inside the
|
||||
file browser. (DLR)
|
||||
help_line_len()
|
||||
- Make the text display more flexible, and closer to what nano
|
||||
1.2.x does. (DLR)
|
||||
- configure.ac:
|
||||
- Allow more flexible handling of UTF-8 support by allowing
|
||||
the --enable-utf8 and --disable-utf8 options. (Mike
|
||||
Frysinger) DLR: Extend these options to work with slang as
|
||||
well as curses, consolidate the warning and error messages
|
||||
dealing with UTF-8 support as much as possible, and add a few
|
||||
minor consistency fixes.
|
||||
- Mention explicitly that the check for the broken regexec() is
|
||||
needed for glibc 2.2.3. (DLR)
|
||||
- nanorc.sample:
|
||||
- Fix the description for the whitespace option to mention that
|
||||
only single-column characters are allowed. (DLR)
|
||||
- Add C++ regexes. (Neil Brown, merged into c-file regexes by
|
||||
DLR)
|
||||
- Break up overly long perl and nanorc regexes into separate
|
||||
regexes of no more than 256 bytes, as POSIX-compliant regexp
|
||||
implementations can reject regexes of over 256 bytes. (DLR)
|
||||
- nano.1, nano.texi:
|
||||
- Mention the -? alias for -h/--help, and add various
|
||||
consistency fixes. (DLR)
|
||||
- nanorc.5:
|
||||
- Fix the description for the whitespace option to mention that
|
||||
only single-column characters are allowed. (DLR)
|
||||
|
||||
GNU nano 1.3.6 - 2005.03.20
|
||||
- General:
|
||||
- More int -> bool conversions. (DLR and David Benbennick)
|
||||
@@ -446,7 +565,7 @@ GNU nano 1.3.5 - 2004.11.22
|
||||
- After reading in a file and detecting the format it's in, set
|
||||
the file format flags (DOS_FILE and MAC_FILE) to match, and
|
||||
preserve them across multiple file buffers. Changes to
|
||||
read_file(), add_open_file(), and load_open_file(). (DLR,
|
||||
read_file(), add_open_file(), and load_open_file(). (DLR,
|
||||
suggested by Bill Soudan)
|
||||
- Remove the -D/--dos and -M/--mac command line options, as they
|
||||
aren't much use with the new file format autodetection. Also
|
||||
|
||||
17
NEWS
17
NEWS
@@ -1,6 +1,21 @@
|
||||
2005.04.10 - GNU nano 1.3.7 claws its way to the top. This release
|
||||
mostly contains bugfixes for the massive amount of new
|
||||
code in 1.3.6. Among other things, nano builds with
|
||||
debug support again; going into the help browser at the
|
||||
"Read File" prompt no longer kicks you out of the prompt
|
||||
after you exit the help browser; paragraph searching no
|
||||
longer skips over certain cases of single-line
|
||||
paragraphs; the titlebar no longer cuts off some UTF-8
|
||||
strings prematurely; and the text displayed in the help
|
||||
browser is now wrapped as it was in nano 1.2.x, taking
|
||||
UTF-8 support into account. New features include an
|
||||
--enable/disable-utf8 configure option to explicitly
|
||||
turn detection of UTF-8 support on or off, and sample
|
||||
regexes for C++ as well as C. Have fun.
|
||||
|
||||
2005.03.20 - GNU nano 1.3.6 "shout it from the rooftops" is released.
|
||||
This release finally includes the long-awaited support
|
||||
for UTF-8. Other new features include the ability to
|
||||
for UTF-8. Other new features include the ability to
|
||||
insert UTF-8 characters using verbatim input; the
|
||||
ability to delete all text from the cursor position to
|
||||
the end of the file via ^W^X as (patched) Pico does;
|
||||
|
||||
1
THANKS
1
THANKS
@@ -53,5 +53,4 @@ Jeremy Robichaud <robicj@yahoo.com> Beta tester
|
||||
Bill Soudan <wes0472@rit.edu> Regex code, etc
|
||||
Ken Tyler <kent@werple.net.au> Search fixes and more
|
||||
|
||||
|
||||
$Id$
|
||||
|
||||
3
TODO
3
TODO
@@ -2,8 +2,7 @@ TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
For version 1.4:
|
||||
- UTF-8 support. [DONE except for the NO_CONVERT flag, which should
|
||||
allow editing UTF-8 as raw bytes.]
|
||||
- UTF-8 support. [DONE]
|
||||
- Support for paragraph searches. [DONE]
|
||||
- Support for justifying the entire file at once. [DONE]
|
||||
- Support for filename searches in the file browser.
|
||||
|
||||
373
configure.ac
373
configure.ac
@@ -19,7 +19,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [1.3.6], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [1.3.7], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -42,7 +42,7 @@ dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h getopt.h libintl.h limits.h regex.h termios.h wchar.h wctype.h)
|
||||
AC_CHECK_HEADER(regex.h,
|
||||
AC_MSG_CHECKING([for broken regexec])
|
||||
AC_MSG_CHECKING([for broken regexec from glibc 2.2.3])
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
@@ -58,18 +58,19 @@ int main(void)
|
||||
}],
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.]),
|
||||
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions, as the one from glibc 2.2.3 does.]),
|
||||
AC_MSG_RESULT([cross-compiling; assuming no])))
|
||||
|
||||
dnl options
|
||||
dnl Checks for options.
|
||||
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Enable debugging (disabled by default)],
|
||||
[if test x$enableval = xyes; then
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
|
||||
debug_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
if test "$debug_support" != "yes"; then
|
||||
if test x$debug_support != xyes; then
|
||||
AC_DEFINE(NDEBUG, 1, [Shut up the assert warnings :-)])
|
||||
fi
|
||||
|
||||
@@ -78,7 +79,7 @@ AC_ARG_ENABLE(extra,
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(NANO_EXTRA, 1, [Define this to enable the extra stuff.]) extra_support=yes
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tiny,
|
||||
[ --enable-tiny Disable features for the sake of size],
|
||||
@@ -91,61 +92,61 @@ AC_ARG_ENABLE(tiny,
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
[ --disable-browser Disable mini file browser],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in (crappy) file browser.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(help,
|
||||
[ --disable-help Disable help function],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(justify,
|
||||
[ --disable-justify Disable justify/unjustify function],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(mouse,
|
||||
[ --disable-mouse Disable mouse support (and -m flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse functions.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(operatingdir,
|
||||
[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable setting of the operating directory (chroot of sorts).])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(speller,
|
||||
[ --disable-speller Disable spell checker function],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the use(full|less) spelling functions.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(tabcomp,
|
||||
[ --disable-tabcomp Disable tab completion code for a smaller binary],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define to disable the tab completion code Chris worked so hard on!])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(wrapping,
|
||||
[ --disable-wrapping Disable all wrapping of text (and -w flag)],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable any and all text wrapping.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(wrapping-as-root,
|
||||
[ --disable-wrapping-as-root Disable wrapping of text as root by default],
|
||||
[if test x$enableval != xyes; then
|
||||
[if test x$enableval != xyes; then
|
||||
AC_DEFINE(DISABLE_ROOTWRAP, 1, [Define this to disable wrapping as root by default.])
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
[ --enable-color Enable color and syntax highlighting],
|
||||
@@ -164,13 +165,13 @@ AC_ARG_ENABLE(multibuffer,
|
||||
[ --enable-multibuffer Enable multiple file buffers],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.]) multibuffer_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(nanorc,
|
||||
[ --enable-nanorc Enable use of .nanorc file],
|
||||
[if test x$enableval = xyes; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use the .nanorc file.]) nanorc_support=yes
|
||||
fi])
|
||||
fi])
|
||||
|
||||
AC_ARG_ENABLE(all,
|
||||
[ --enable-all Enable ALL extra nano functionality (kitchen sink option)],
|
||||
@@ -184,9 +185,20 @@ AC_ARG_ENABLE(all,
|
||||
*** WARNING: Color support is far from perfect, but functional. ***
|
||||
*** Be careful with syntax in your .nanorc or nano may malfunction. ***
|
||||
***********************************************************************
|
||||
])
|
||||
])
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable UTF-8 support])
|
||||
AC_ARG_ENABLE(utf8,
|
||||
[ --enable-utf8 Enable UTF-8 support],
|
||||
[if test x$enableval = xyes; then
|
||||
enable_utf8=yes
|
||||
else
|
||||
enable_utf8=no
|
||||
fi],
|
||||
[enable_utf8=auto])
|
||||
AC_MSG_RESULT($enable_utf8)
|
||||
|
||||
AC_MSG_CHECKING([whether to use slang])
|
||||
CURSES_LIB_NAME=""
|
||||
AC_ARG_WITH(slang,
|
||||
@@ -198,61 +210,17 @@ AC_ARG_WITH(slang,
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
if test "$with_slang" != "yes"; then
|
||||
if test x$with_slang != xyes; then
|
||||
# Add additional search path
|
||||
LDFLAGS="-L$with_slang/lib $LDFLAGS"
|
||||
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
test -n "$tcap" && break
|
||||
done
|
||||
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
@@ -264,35 +232,22 @@ int main(void)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
test -n "$tcap" && break
|
||||
done
|
||||
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
@@ -304,16 +259,85 @@ int main(void)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLutf8_enable in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLutf8_enable(TRUE);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
CURSES_LIB_WIDE=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
# Reset libs if the above slang tests failed
|
||||
if test x$enable_utf8 != xno; then
|
||||
LIBS=$_libs
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang])
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
test -n "$tcap" && break
|
||||
done
|
||||
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap])
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
@@ -321,76 +345,107 @@ int main(void)
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
[AC_MSG_RESULT(no)
|
||||
|
||||
# We might need the math library
|
||||
AC_MSG_CHECKING([for SLtt_initialize in -lslang $tcap -lm])
|
||||
LIBS="$LIBS -lm"
|
||||
AC_TRY_RUN([
|
||||
#include <slcurses.h>
|
||||
int main(void)
|
||||
{
|
||||
SLtt_initialize(NULL);
|
||||
return 0;
|
||||
}],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG, 1, [Define to use the slang wrappers for curses instead of native curses.])
|
||||
slang_support=yes
|
||||
if test x$with_slang != xyes; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap -lm"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap -lm"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling]))],
|
||||
AC_MSG_WARN([*** Can not use slang when cross-compiling])),
|
||||
AC_MSG_ERROR([
|
||||
*** The header file slcurses.h was not found. If you wish to use
|
||||
*** slang support this header file is required. Please either
|
||||
*** install a version of slang that includes the slcurses.h file or
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
]))
|
||||
fi
|
||||
|
||||
test "${_libs+set}" = "set" && LIBS=$_libs
|
||||
if test "${_libs+set}" = "set"; then
|
||||
LIBS=$_libs
|
||||
fi
|
||||
|
||||
if test "$with_slang" != "yes"; then
|
||||
if test x$with_slang != xyes; then
|
||||
LDFLAGS=${_ldflags}
|
||||
fi
|
||||
;;
|
||||
esac], [AC_MSG_RESULT(no)])
|
||||
|
||||
dnl Checks for functions
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf isblank iswalnum iswblank iswspace strcasecmp strncasecmp strcasestr strnlen getline getdelim mblen mbtowc wctomb wcwidth)
|
||||
if test "x$ac_cv_func_snprintf" = "xno" -o "x$ac_cv_func_vsnprintf" = "xno"
|
||||
then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
AC_MSG_ERROR([
|
||||
dnl Checks for functions.
|
||||
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strnlen getline getdelim)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_FUNCS(iswalnum mblen mbtowc wctomb wcwidth iswspace iswblank)
|
||||
fi
|
||||
|
||||
if test x$ac_cv_func_snprintf = xno -o x$ac_cv_func_vsnprintf = xno; then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
|
||||
glib)
|
||||
glib)
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
|
||||
dnl Checks for library functions.
|
||||
|
||||
AC_TYPE_SIGNAL
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(getopt_long)
|
||||
|
||||
dnl Checks for libraries.
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_HEADERS(ncurses.h)
|
||||
AC_CHECK_LIB(ncursesw, wget_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE="yes"])
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_LIB(ncursesw, wget_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_HEADERS(curses.h)
|
||||
AC_CHECK_LIB(curses, wget_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE="yes"])
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_LIB(curses, wget_wch, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses CURSES_LIB_WIDE=yes])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
fi
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
AC_MSG_WARN([
|
||||
*** No curses lib available. Consider getting the official ncurses
|
||||
*** distribution from ftp://ftp.gnu.org/pub/gnu/ncurses if you get
|
||||
@@ -407,20 +462,38 @@ LIBS="$LIBS $CURSES_LIB"
|
||||
|
||||
AC_SUBST(CURSES_LIB)
|
||||
|
||||
if test "x$GLIB_CFLAGS" != "x"
|
||||
then
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
if test "x$GLIB_CFLAGS" != "x"; then
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
fi
|
||||
if test "x$GLIB_LIBS" != "x"
|
||||
then
|
||||
LDFLAGS="$LDFLAGS $GLIB_LIBS"
|
||||
if test "x$GLIB_LIBS" != "x"; then
|
||||
LDFLAGS="$LDFLAGS $GLIB_LIBS"
|
||||
fi
|
||||
|
||||
if test "x$CURSES_LIB_WIDE" = "xyes" -a "x$ac_cv_func_iswalnum" = "xyes" -a "x$ac_cv_func_mblen" = "xyes" -a "x$ac_cv_func_mbtowc" = "xyes" -a "x$ac_cv_func_wctomb" = "xyes" -a "x$ac_cv_func_wcwidth" = "xyes" && test "x$ac_cv_func_iswspace" = "xyes" -o "x$ac_cv_func_iswblank" = "xyes"
|
||||
then
|
||||
if test x$enable_utf8 != xno && \
|
||||
test x$CURSES_LIB_WIDE = xyes -a \
|
||||
x$ac_cv_func_iswalnum = xyes -a \
|
||||
x$ac_cv_func_mblen = xyes -a \
|
||||
x$ac_cv_func_mbtowc = xyes -a \
|
||||
x$ac_cv_func_wctomb = xyes -a \
|
||||
x$ac_cv_func_wcwidth = xyes && \
|
||||
test x$ac_cv_func_iswspace = xyes -o x$ac_cv_func_iswblank = xyes; then
|
||||
AC_DEFINE(NANO_WIDE, 1, [Define this if your system has sufficient wide character support (a wide curses library, iswalnum(), iswspace() or iswblank(), mblen(), mbtowc(), wctomb(), and wcwidth()).])
|
||||
else
|
||||
AC_MSG_WARN([Insufficient wide character support found. nano will not be able to support UTF-8.])
|
||||
if test x$enable_utf8 = xyes; then
|
||||
AC_MSG_ERROR([
|
||||
*** UTF-8 support was requested, but insufficient UTF-8 support was
|
||||
*** detected in your curses and/or C libraries. Please verify that your
|
||||
*** slang was built with UTF-8 support or your curses was built with
|
||||
*** wide character support, and that your C library was built with wide
|
||||
*** character support.])
|
||||
elif test x$enable_utf8 != xno; then
|
||||
AC_MSG_WARN([
|
||||
*** Insufficient UTF-8 support was detected in your curses and/or C
|
||||
*** libraries. If you want UTF-8 support, please verify that your slang
|
||||
*** was built with UTF-8 support or your curses was built with wide
|
||||
*** character support, and that your C library was built with wide
|
||||
*** character support.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.6. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.7. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.3/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.6" "March 11, 2005"
|
||||
.TH NANO 1 "version 1.3.7" "March 26, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -33,7 +33,11 @@ replace" and "go to line number".
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILINE\fP
|
||||
Places cursor at \fILINE\fP on startup.
|
||||
Places cursor at line number \fILINE\fP on startup, instead of the
|
||||
default of line 1.
|
||||
.TP
|
||||
.B \-?
|
||||
Same as \fB-h (\-\-help)\fP.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.6" "March 11, 2005"
|
||||
.TH NANORC 5 "version 1.3.7" "March 26, 2005"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -154,7 +154,7 @@ Disallow file modification.
|
||||
.TP
|
||||
\fBset whitespace "\fIstring\fP"\fP
|
||||
Set the two characters used to display the first characters of tabs and
|
||||
spaces. They cannot be control characters.
|
||||
spaces. They must be single-column characters.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the \fB-Y\fP
|
||||
|
||||
@@ -121,9 +121,9 @@
|
||||
## Disallow file modification; why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
## The two characters used to display the first characters of tabs and
|
||||
## spaces. 187 decimal (00BB hexadecimal) and 183 decimal (00B7
|
||||
## hexadecimal) seem to be good values for these.
|
||||
## The two single-column characters used to display the first characters
|
||||
## of tabs and spaces. 187 decimal (00BB hexadecimal) and 183 decimal
|
||||
## (00B7 hexadecimal) seem to be good values for these.
|
||||
# set whitespace " "
|
||||
|
||||
## Color setup
|
||||
@@ -140,10 +140,12 @@
|
||||
## color will use a transparent color. If you don't want this, be sure
|
||||
## to set the background color to black or white.
|
||||
##
|
||||
# syntax "c-file" "\.(c|h)$"
|
||||
# syntax "c-file" "\.(c|C|cc|cpp|h|H|hh|hpp)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color green "\<(float|double|char|int|short|long|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|switch|goto|continue|break|return)\>"
|
||||
# color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color green "\<(class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|default|switch|goto|continue|break|return)\>"
|
||||
# color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
# color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)"
|
||||
# color brightmagenta "'([^\]|(\\['abfnrtv\\]))'" "'\\(([0-7][0-7]?)|([0-3][0-7][0-7]))'" "'\\x[0-9A-Fa-f][0-9A-Fa-f]?'"
|
||||
##
|
||||
@@ -208,7 +210,11 @@
|
||||
## Here is an example for perl
|
||||
##
|
||||
# syntax "perl" "\.p[lm]$"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork)|get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join|keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek|seekdir|se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr|y|truncate|umask|un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>"
|
||||
# color red "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>"
|
||||
# color red "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>"
|
||||
# color red "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>"
|
||||
# color red "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
# color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
# color cyan start="[$@%]" end="( |\\W|-)"
|
||||
# color yellow "".*"|qq\|.*\|"
|
||||
@@ -257,7 +263,8 @@
|
||||
## highlight possible errors and parameters
|
||||
# color brightwhite "^ *(set|unset|syntax|color).*$"
|
||||
## set, unset and syntax
|
||||
# color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller|suspend|tabsize|tempfile|view|whitespace)"
|
||||
# color cyan "^ *(set|unset) +(autoindent|backup|backupdir|brackets|const|cut|fill|historylog|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nowrap|operatingdir|preserve|punct|quotestr|rebinddelete|regexp|smarthome|smooth|speller|suspend|tabsize|tempfile)\>"
|
||||
# color cyan "^ *(set|unset) +(view|whitespace)"
|
||||
# color green "^ *(set|unset|syntax)\>"
|
||||
## colors
|
||||
# color yellow "^ *color +(bright)?(white|black|red|blue|green|yellow|magenta|cyan)(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.3.6
|
||||
@set UPDATED 11 Mar 2005
|
||||
@set VERSION 1.3.7
|
||||
@set UPDATED 26 Mar 2005
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.6
|
||||
@subtitle version 1.3.7
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -94,7 +94,7 @@ internationalization support, and filename tab completion.
|
||||
@code{nano} +LINE [GNU long option] [option] [ @var{file ...} ]
|
||||
|
||||
The original goal for @code{nano} was a complete bug-for-bug compatible
|
||||
emulation of Pico, but nano's main goal is to be as compatible as
|
||||
emulation of Pico, but @code{nano}'s main goal is to be as compatible as
|
||||
possible while offering a superset of Pico's functionality. Also see
|
||||
@xref{Pico Compatibility}, for other differences.
|
||||
|
||||
@@ -106,6 +106,11 @@ Email bug reports to @email{nano@@nano-editor.org}.
|
||||
@code{nano} takes the following options from the command line:
|
||||
|
||||
@table @code
|
||||
@item +LINE
|
||||
Start at line number LINE instead of the default of line 1.
|
||||
|
||||
@item -?
|
||||
Same as @code{-h, --help}.
|
||||
|
||||
@item -A, --smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
@@ -240,9 +245,6 @@ keystroke (usually ^Z).
|
||||
|
||||
@item -a, -b, -e, -f, -g, -j
|
||||
Ignored, for compatibility with Pico.
|
||||
|
||||
@item +LINE
|
||||
Start at line number LINE instead of the default of line 1.
|
||||
@end table
|
||||
|
||||
@node Editor Basics, Online Help, Introduction, Top
|
||||
@@ -446,7 +448,8 @@ Building @code{nano} from source is fairly straightforward if you are
|
||||
familiar with compiling programs with autoconf support:
|
||||
|
||||
@itemize @bullet
|
||||
@item tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of nano)
|
||||
@item tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of
|
||||
@code{nano})
|
||||
@item cd nano-x.y.z/
|
||||
@item ./configure
|
||||
@item make
|
||||
@@ -499,9 +502,8 @@ Disables Native Language support. This will make the available GNU
|
||||
@code{nano} translations unusable.
|
||||
|
||||
@item --with-slang
|
||||
Compiling GNU @code{nano} with Slang is supported, and will make the
|
||||
binary notably smaller than if compiled with ncurses or other curses
|
||||
libraries.
|
||||
Compiling @code{nano} with Slang is supported, and will make the binary
|
||||
notably smaller than if compiled with ncurses or other curses libraries.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
24
po/ChangeLog
24
po/ChangeLog
@@ -1,3 +1,27 @@
|
||||
2005-04-09 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* zh_TW.po: Added Plural-Forms header and fix format specification
|
||||
typos.
|
||||
|
||||
2005-04-08 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* it.po: Updated Italian translation by Marco Colombo.
|
||||
* zh_TW.po: Updated Traditional Chinese translation by
|
||||
CHAO Wei-Lun.
|
||||
|
||||
2005-04-06 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* rw.po: New Kinyarwanda translation by Steve Murphy.
|
||||
* LINGUAS: Added "rw".
|
||||
|
||||
2005-04-05 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
* ro.po: Updated Romanian translation by
|
||||
Laurentiu Buzdugan.
|
||||
|
||||
2005-03-11 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru sr sv tr uk zh_TW
|
||||
ca cs da de es eu fi fr gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk zh_TW
|
||||
|
||||
2132
po/zh_TW.po
2132
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -278,7 +278,7 @@ char *make_mbchar(int chr, int *chr_mb_len)
|
||||
{
|
||||
char *chr_mb;
|
||||
|
||||
assert(chr_mb != NULL && chr_mb_len != NULL);
|
||||
assert(chr_mb_len != NULL);
|
||||
|
||||
#ifdef NANO_WIDE
|
||||
if (!ISSET(NO_UTF8)) {
|
||||
@@ -455,7 +455,7 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
{
|
||||
size_t pos_prev = pos;
|
||||
|
||||
assert(str != NULL && pos <= strlen(buf));
|
||||
assert(buf != NULL && pos <= strlen(buf));
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. Here is the naive, O(pos) way to do it. */
|
||||
|
||||
17
src/cut.c
17
src/cut.c
@@ -63,7 +63,6 @@ void cut_marked(void)
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we're not at the end of the current line, move all the text from
|
||||
* the current cursor position to the end of the current line,
|
||||
@@ -84,15 +83,16 @@ void cut_to_eol(void)
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current, data_len);
|
||||
else if (current->next != NULL) {
|
||||
/* If we're at the end of the line, and the next line isn't the
|
||||
* magicline, move all the text from the current position up to
|
||||
* the beginning of the next line, i.e, the newline at the
|
||||
* end, to the cutbuffer. */
|
||||
/* If we're at the end of the line, and it isn't the magicline,
|
||||
* move all the text from the current position up to the
|
||||
* beginning of the next line, i.e, the newline at the end, to
|
||||
* the cutbuffer. */
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, current, current_x,
|
||||
current->next, 0);
|
||||
placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text(void)
|
||||
@@ -122,13 +122,12 @@ void do_cut_text(void)
|
||||
* turn the mark off. */
|
||||
cut_marked();
|
||||
UNSET(MARK_ISSET);
|
||||
} else
|
||||
#endif
|
||||
if (ISSET(CUT_TO_END))
|
||||
} else if (ISSET(CUT_TO_END))
|
||||
/* Otherwise, if the CUT_TO_END flag is set, move all text up to
|
||||
* the end of the line into the cutbuffer. */
|
||||
cut_to_eol();
|
||||
else
|
||||
#endif
|
||||
/* Otherwise, move the entire line into the cutbuffer. */
|
||||
cut_line();
|
||||
|
||||
@@ -158,7 +157,7 @@ void do_cut_till_end(void)
|
||||
dump_buffer(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
/* Copy text from the cutbuffer into the current filestruct. */
|
||||
void do_uncut_text(void)
|
||||
|
||||
92
src/files.c
92
src/files.c
@@ -89,7 +89,7 @@ filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
|
||||
fileptr->prev = NULL;
|
||||
fileptr->next = fileage;
|
||||
fileptr->lineno = 1;
|
||||
if (*first_line_ins) {
|
||||
if (*first_line_ins == TRUE) {
|
||||
*first_line_ins = FALSE;
|
||||
/* If we're inserting into the first line of the file, then
|
||||
* we want to make sure that our edit buffer stays on the
|
||||
@@ -100,6 +100,7 @@ filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
|
||||
fileage = fileptr;
|
||||
} else {
|
||||
assert(prev != NULL);
|
||||
|
||||
fileptr->prev = prev;
|
||||
fileptr->next = NULL;
|
||||
fileptr->lineno = prev->lineno + 1;
|
||||
@@ -556,8 +557,7 @@ void do_insertfile(
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
&& !ISSET(MULTIBUFFER)
|
||||
#endif
|
||||
))
|
||||
{
|
||||
)) {
|
||||
statusbar(_("Cancelled"));
|
||||
break;
|
||||
} else {
|
||||
@@ -580,6 +580,7 @@ void do_insertfile(
|
||||
|
||||
if (tmp == NULL)
|
||||
continue;
|
||||
|
||||
free(answer);
|
||||
answer = tmp;
|
||||
|
||||
@@ -596,6 +597,15 @@ void do_insertfile(
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we don't have a file yet, go back to the statusbar
|
||||
* prompt. */
|
||||
if (i != 0
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
&& (i != -2 || !ISSET(MULTIBUFFER))
|
||||
#endif
|
||||
)
|
||||
continue;
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!ISSET(MULTIBUFFER)) {
|
||||
#endif
|
||||
@@ -982,15 +992,8 @@ char *get_full_path(const char *origpath)
|
||||
return NULL;
|
||||
|
||||
/* Get the current directory. */
|
||||
#if PATH_MAX != -1
|
||||
d_here = charalloc(PATH_MAX + 1);
|
||||
#else
|
||||
d_here = NULL;
|
||||
#endif
|
||||
d_here = getcwd(d_here, PATH_MAX + 1);
|
||||
#if PATH_MAX != -1
|
||||
align(&d_here);
|
||||
#endif
|
||||
|
||||
if (d_here != NULL) {
|
||||
const char *last_slash;
|
||||
@@ -998,6 +1001,8 @@ char *get_full_path(const char *origpath)
|
||||
bool path_only;
|
||||
struct stat fileinfo;
|
||||
|
||||
align(&d_here);
|
||||
|
||||
/* If the current directory isn't "/", tack a slash onto the end
|
||||
* of it. */
|
||||
if (strcmp(d_here, "/") != 0) {
|
||||
@@ -1054,26 +1059,24 @@ char *get_full_path(const char *origpath)
|
||||
} else {
|
||||
/* Get the full path and save it in d_there. */
|
||||
free(d_there);
|
||||
#if PATH_MAX != -1
|
||||
d_there = charalloc(PATH_MAX + 1);
|
||||
#else
|
||||
d_there = NULL;
|
||||
#endif
|
||||
d_there = getcwd(d_there, PATH_MAX + 1);
|
||||
#if PATH_MAX != -1
|
||||
align(&d_there);
|
||||
#endif
|
||||
|
||||
if (d_there == NULL)
|
||||
d_there = charalloc(PATH_MAX + 1);
|
||||
d_there = getcwd(d_there, PATH_MAX + 1);
|
||||
|
||||
if (d_there != NULL) {
|
||||
align(&d_there);
|
||||
|
||||
if (strcmp(d_there, "/") != 0) {
|
||||
/* Make sure d_there ends in a slash. */
|
||||
d_there = charealloc(d_there,
|
||||
strlen(d_there) + 2);
|
||||
strcat(d_there, "/");
|
||||
}
|
||||
} else
|
||||
/* If we couldn't get the full path, set path_only
|
||||
* to TRUE so that we clean up correctly, free all
|
||||
* allocated memory, and return NULL. */
|
||||
path_only = TRUE;
|
||||
else if (strcmp(d_there, "/") != 0) {
|
||||
/* Make sure d_there ends in a slash. */
|
||||
d_there = charealloc(d_there, strlen(d_there) + 2);
|
||||
strcat(d_there, "/");
|
||||
}
|
||||
|
||||
/* Finally, go back to the path specified in d_here,
|
||||
* where we were before. */
|
||||
@@ -1089,7 +1092,7 @@ char *get_full_path(const char *origpath)
|
||||
* d_there_file contains the filename portion of the answer. If
|
||||
* this is the case, tack d_there_file onto the end of
|
||||
* d_there, so that d_there contains the complete answer. */
|
||||
if (!path_only && d_there) {
|
||||
if (!path_only && d_there != NULL) {
|
||||
d_there = charealloc(d_there, strlen(d_there) +
|
||||
strlen(d_there_file) + 1);
|
||||
strcat(d_there, d_there_file);
|
||||
@@ -1340,6 +1343,7 @@ int write_file(const char *name, bool tmp, int append, bool
|
||||
/* The temp file name we write to on prepend. */
|
||||
|
||||
assert(name != NULL);
|
||||
|
||||
if (name[0] == '\0')
|
||||
return -1;
|
||||
if (!tmp)
|
||||
@@ -2429,7 +2433,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
/* Loop invariant: Microsoft sucks. */
|
||||
do {
|
||||
bool abort = FALSE;
|
||||
int j, col = 0, editline = 0, lineno;
|
||||
int j, col = 0, editline = 0, fileline;
|
||||
int filecols = 0;
|
||||
/* Used only if width == 0, to calculate the number of files
|
||||
* per row below. */
|
||||
@@ -2444,9 +2448,9 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
/* Compute the line number we're on now, so that we don't divide
|
||||
* by zero later. */
|
||||
lineno = selected;
|
||||
fileline = selected;
|
||||
if (width != 0)
|
||||
lineno /= width;
|
||||
fileline /= width;
|
||||
|
||||
switch (kbinput) {
|
||||
#ifndef DISABLE_MOUSE
|
||||
@@ -2463,7 +2467,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
|
||||
/* longest is the width of each column. There are
|
||||
* two spaces between each column. */
|
||||
selected = (lineno / editwinrows) * editwinrows *
|
||||
selected = (fileline / editwinrows) * editwinrows *
|
||||
width + mevent.y * width + mevent.x /
|
||||
(longest + 2);
|
||||
|
||||
@@ -2508,9 +2512,9 @@ char *do_browser(char *path, DIR *dir)
|
||||
case NANO_PREVPAGE_KEY:
|
||||
case NANO_PREVPAGE_FKEY:
|
||||
case '-': /* Pico compatibility. */
|
||||
if (selected >= (editwinrows + lineno % editwinrows) *
|
||||
if (selected >= (editwinrows + fileline % editwinrows) *
|
||||
width)
|
||||
selected -= (editwinrows + lineno % editwinrows) *
|
||||
selected -= (editwinrows + fileline % editwinrows) *
|
||||
width;
|
||||
else
|
||||
selected = 0;
|
||||
@@ -2518,7 +2522,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
case NANO_NEXTPAGE_KEY:
|
||||
case NANO_NEXTPAGE_FKEY:
|
||||
case ' ': /* Pico compatibility. */
|
||||
selected += (editwinrows - lineno % editwinrows) *
|
||||
selected += (editwinrows - fileline % editwinrows) *
|
||||
width;
|
||||
if (selected >= numents)
|
||||
selected = numents - 1;
|
||||
@@ -2756,14 +2760,15 @@ char *do_browser(char *path, DIR *dir)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Browser front end, checks to see if inpath has a dir in it and, if
|
||||
so, starts do_browser from there, else from the current dir */
|
||||
/* The file browser front end. We check to see if inpath has a dir in
|
||||
* it. If it does, we start do_browser() from there. Otherwise, we
|
||||
* start do_browser() from the current directory. */
|
||||
char *do_browse_from(const char *inpath)
|
||||
{
|
||||
struct stat st;
|
||||
char *path;
|
||||
/* This holds the tilde-expanded version of inpath. */
|
||||
DIR *dir;
|
||||
DIR *dir = NULL;
|
||||
|
||||
assert(inpath != NULL);
|
||||
|
||||
@@ -2779,15 +2784,12 @@ char *do_browse_from(const char *inpath)
|
||||
striponedir(path);
|
||||
if (stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
||||
free(path);
|
||||
#if PATH_MAX != -1
|
||||
|
||||
path = charalloc(PATH_MAX + 1);
|
||||
#else
|
||||
path = NULL;
|
||||
#endif
|
||||
path = getcwd(path, PATH_MAX + 1);
|
||||
#if PATH_MAX != -1
|
||||
align(&path);
|
||||
#endif
|
||||
|
||||
if (path != NULL)
|
||||
align(&path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2801,7 +2803,9 @@ char *do_browse_from(const char *inpath)
|
||||
}
|
||||
#endif
|
||||
|
||||
dir = opendir(path);
|
||||
if (path != NULL)
|
||||
dir = opendir(path);
|
||||
|
||||
if (dir == NULL) {
|
||||
beep();
|
||||
free(path);
|
||||
|
||||
@@ -370,9 +370,9 @@ void shortcut_init(bool unjustify)
|
||||
* point is that sc_init_one() takes 9 arguments, unless DISABLE_HELP is
|
||||
* defined, when the 4th one should not be there. */
|
||||
#ifndef DISABLE_HELP
|
||||
# define IFHELP(help, nextvar) help, nextvar
|
||||
#define IFHELP(help, nextvar) help, nextvar
|
||||
#else
|
||||
# define IFHELP(help, nextvar) nextvar
|
||||
#define IFHELP(help, nextvar) nextvar
|
||||
#endif
|
||||
|
||||
free_shortcutage(&main_list);
|
||||
|
||||
360
src/nano.c
360
src/nano.c
@@ -264,8 +264,11 @@ void mouse_init(void)
|
||||
* help_text should be NULL initially. */
|
||||
void help_init(void)
|
||||
{
|
||||
size_t allocsize = 1; /* Space needed for help_text. */
|
||||
const char *htx; /* Untranslated help message. */
|
||||
size_t allocsize = 0; /* Space needed for help_text. */
|
||||
const char *htx[3]; /* Untranslated help message. We break
|
||||
* it up into three chunks in case the
|
||||
* full string is too long for the
|
||||
* compiler to handle. */
|
||||
char *ptr;
|
||||
const shortcut *s;
|
||||
#ifndef NANO_SMALL
|
||||
@@ -279,120 +282,156 @@ void help_init(void)
|
||||
|
||||
/* First, set up the initial help text for the current function. */
|
||||
if (currshortcut == whereis_list || currshortcut == replace_list
|
||||
|| currshortcut == replace_list_2)
|
||||
htx = N_("Search Command Help Text\n\n "
|
||||
"Enter the words or characters you would like to search "
|
||||
"for, then hit Enter. If there is a match for the text you "
|
||||
"entered, the screen will be updated to the location of the "
|
||||
"nearest match for the search string.\n\n The previous "
|
||||
"search string will be shown in brackets after the search "
|
||||
"prompt. Hitting Enter without entering any text will "
|
||||
"perform the previous search. If you have selected text "
|
||||
"with the mark and then search to replace, only matches in "
|
||||
"the selected text will be replaced.\n\n The following "
|
||||
"function keys are available in Search mode:\n\n");
|
||||
else if (currshortcut == gotoline_list)
|
||||
htx = N_("Go To Line Help Text\n\n "
|
||||
|| currshortcut == replace_list_2) {
|
||||
htx[0] = N_("Search Command Help Text\n\n "
|
||||
"Enter the words or characters you would like to "
|
||||
"search for, and then press Enter. If there is a "
|
||||
"match for the text you entered, the screen will be "
|
||||
"updated to the location of the nearest match for the "
|
||||
"search string.\n\n The previous search string will be "
|
||||
"shown in brackets after the search prompt. Hitting "
|
||||
"Enter without entering any text will perform the "
|
||||
"previous search. ");
|
||||
htx[1] = N_("If you have selected text with the mark and then "
|
||||
"search to replace, only matches in the selected text "
|
||||
"will be replaced.\n\n The following function keys are "
|
||||
"available in Search mode:\n\n");
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == gotoline_list) {
|
||||
htx[0] = N_("Go To Line Help Text\n\n "
|
||||
"Enter the line number that you wish to go to and hit "
|
||||
"Enter. If there are fewer lines of text than the "
|
||||
"number you entered, you will be brought to the last line "
|
||||
"of the file.\n\n The following function keys are "
|
||||
"number you entered, you will be brought to the last "
|
||||
"line of the file.\n\n The following function keys are "
|
||||
"available in Go To Line mode:\n\n");
|
||||
else if (currshortcut == insertfile_list)
|
||||
htx = N_("Insert File Help Text\n\n "
|
||||
"Type in the name of a file to be inserted into the current "
|
||||
"file buffer at the current cursor location.\n\n "
|
||||
"If you have compiled nano with multiple file buffer "
|
||||
"support, and enable multiple buffers with the -F "
|
||||
"or --multibuffer command line flags, the Meta-F toggle, or "
|
||||
"a nanorc file, inserting a file will cause it to be "
|
||||
"loaded into a separate buffer (use Meta-< and > to switch "
|
||||
"between file buffers). If you need another blank buffer, "
|
||||
"do not enter any filename, or type in a nonexistent "
|
||||
"filename at the prompt and press Enter.\n\n The following "
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == insertfile_list) {
|
||||
htx[0] = N_("Insert File Help Text\n\n "
|
||||
"Type in the name of a file to be inserted into the "
|
||||
"current file buffer at the current cursor "
|
||||
"location.\n\n If you have compiled nano with multiple "
|
||||
"file buffer support, and enable multiple file buffers "
|
||||
"with the -F or --multibuffer command line flags, the "
|
||||
"Meta-F toggle, or a nanorc file, inserting a file "
|
||||
"will cause it to be loaded into a separate buffer "
|
||||
"(use Meta-< and > to switch between file buffers). ");
|
||||
htx[1] = N_("If you need another blank buffer, do not enter "
|
||||
"any filename, or type in a nonexistent filename at "
|
||||
"the prompt and press Enter.\n\n The following "
|
||||
"function keys are available in Insert File mode:\n\n");
|
||||
else if (currshortcut == writefile_list)
|
||||
htx = N_("Write File Help Text\n\n "
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == writefile_list) {
|
||||
htx[0] = N_("Write File Help Text\n\n "
|
||||
"Type the name that you wish to save the current file "
|
||||
"as and hit Enter to save the file.\n\n If you have "
|
||||
"as and press Enter to save the file.\n\n If you have "
|
||||
"selected text with the mark, you will be prompted to "
|
||||
"save only the selected portion to a separate file. To "
|
||||
"reduce the chance of overwriting the current file with "
|
||||
"just a portion of it, the current filename is not the "
|
||||
"default in this mode.\n\n The following function keys "
|
||||
"are available in Write File mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#ifndef DISABLE_BROWSER
|
||||
else if (currshortcut == browser_list)
|
||||
htx = N_("File Browser Help Text\n\n "
|
||||
else if (currshortcut == browser_list) {
|
||||
htx[0] = N_("File Browser Help Text\n\n "
|
||||
"The file browser is used to visually browse the "
|
||||
"directory structure to select a file for reading "
|
||||
"or writing. You may use the arrow keys or Page Up/"
|
||||
"Down to browse through the files, and S or Enter to "
|
||||
"choose the selected file or enter the selected "
|
||||
"directory. To move up one level, select the directory "
|
||||
"called \"..\" at the top of the file list.\n\n The "
|
||||
"following function keys are available in the file "
|
||||
"browser:\n\n");
|
||||
else if (currshortcut == gotodir_list)
|
||||
htx = N_("Browser Go To Directory Help Text\n\n "
|
||||
"directory. To move up one level, select the "
|
||||
"directory called \"..\" at the top of the file "
|
||||
"list.\n\n The following function keys are available "
|
||||
"in the file browser:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
} else if (currshortcut == gotodir_list) {
|
||||
htx[0] = N_("Browser Go To Directory Help Text\n\n "
|
||||
"Enter the name of the directory you would like to "
|
||||
"browse to.\n\n If tab completion has not been disabled, "
|
||||
"you can use the Tab key to (attempt to) automatically "
|
||||
"complete the directory name.\n\n The following function "
|
||||
"keys are available in Browser Go To Directory mode:\n\n");
|
||||
"browse to.\n\n If tab completion has not been "
|
||||
"disabled, you can use the Tab key to (attempt to) "
|
||||
"automatically complete the directory name.\n\n The "
|
||||
"following function keys are available in Browser Go "
|
||||
"To Directory mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
else if (currshortcut == spell_list)
|
||||
htx = N_("Spell Check Help Text\n\n "
|
||||
"The spell checker checks the spelling of all text "
|
||||
"in the current file. When an unknown word is "
|
||||
else if (currshortcut == spell_list) {
|
||||
htx[0] = N_("Spell Check Help Text\n\n "
|
||||
"The spell checker checks the spelling of all text in "
|
||||
"the current file. When an unknown word is "
|
||||
"encountered, it is highlighted and a replacement can "
|
||||
"be edited. It will then prompt to replace every "
|
||||
"instance of the given misspelled word in the "
|
||||
"current file, or, if you have selected text with the "
|
||||
"mark, in the selected text.\n\n The following other "
|
||||
"functions are available in Spell Check mode:\n\n");
|
||||
"instance of the given misspelled word in the current "
|
||||
"file, or, if you have selected text with the mark, in "
|
||||
"the selected text.\n\n The following other functions "
|
||||
"are available in Spell Check mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
else if (currshortcut == extcmd_list)
|
||||
htx = N_("External Command Help Text\n\n "
|
||||
"This menu allows you to insert the output of a command "
|
||||
"run by the shell into the current buffer (or a new "
|
||||
"buffer in multibuffer mode). If you need another blank "
|
||||
"buffer, do not enter any command.\n\n The following keys "
|
||||
"are available in this mode:\n\n");
|
||||
else if (currshortcut == extcmd_list) {
|
||||
htx[0] = N_("Execute Command Help Text\n\n "
|
||||
"This menu allows you to insert the output of a "
|
||||
"command run by the shell into the current buffer (or "
|
||||
"a new buffer in multiple file buffer mode). If you "
|
||||
"need another blank buffer, do not enter any "
|
||||
"command.\n\n The following keys are available in "
|
||||
"Execute Command mode:\n\n");
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
else {
|
||||
/* Default to the main help list. */
|
||||
htx = N_(" nano help text\n\n "
|
||||
"The nano editor is designed to emulate the functionality and "
|
||||
"ease-of-use of the UW Pico text editor. There are four main "
|
||||
"sections of the editor. The top line shows the program "
|
||||
"version, the current filename being edited, and whether "
|
||||
"or not the file has been modified. Next is the main editor "
|
||||
"window showing the file being edited. The status line is "
|
||||
"the third line from the bottom and shows important messages. "
|
||||
"The bottom two lines show the most commonly used shortcuts "
|
||||
"in the editor.\n\n "
|
||||
"The notation for shortcuts is as follows: Control-key "
|
||||
"sequences are notated with a caret (^) symbol and can be "
|
||||
"entered either by using the Control (Ctrl) key or pressing the "
|
||||
"Esc key twice. Escape-key sequences are notated with the Meta "
|
||||
"(M) symbol and can be entered using either the Esc, Alt or "
|
||||
"Meta key depending on your keyboard setup. Also, pressing Esc "
|
||||
"twice and then typing a three-digit decimal number from 000 to "
|
||||
"255 will enter the character with the corresponding value. "
|
||||
"The following keystrokes are available in the main editor "
|
||||
"window. Alternative keys are shown in parentheses:\n\n");
|
||||
htx[0] = N_(" nano help text\n\n "
|
||||
"The nano editor is designed to emulate the "
|
||||
"functionality and ease-of-use of the UW Pico text "
|
||||
"editor. There are four main sections of the editor. "
|
||||
"The top line shows the program version, the current "
|
||||
"filename being edited, and whether or not the file "
|
||||
"has been modified. Next is the main editor window "
|
||||
"showing the file being edited. The status line is "
|
||||
"the third line from the bottom and shows important "
|
||||
"messages. The bottom two lines show the most "
|
||||
"commonly used shortcuts in the editor.\n\n ");
|
||||
htx[1] = N_("The notation for shortcuts is as follows: "
|
||||
"Control-key sequences are notated with a caret (^) "
|
||||
"symbol and can be entered either by using the Control "
|
||||
"(Ctrl) key or pressing the Escape (Esc) key twice. "
|
||||
"Escape-key sequences are notated with the Meta (M) "
|
||||
"symbol and can be entered using either the Esc, Alt, "
|
||||
"or Meta key depending on your keyboard setup. ");
|
||||
htx[2] = N_("Also, pressing Esc twice and then typing a "
|
||||
"three-digit decimal number from 000 to 255 will enter "
|
||||
"the character with the corresponding value. The "
|
||||
"following keystrokes are available in the main editor "
|
||||
"window. Alternative keys are shown in "
|
||||
"parentheses:\n\n");
|
||||
}
|
||||
|
||||
htx = _(htx);
|
||||
htx[0] = _(htx[0]);
|
||||
if (htx[1] != NULL)
|
||||
htx[1] = _(htx[1]);
|
||||
if (htx[2] != NULL)
|
||||
htx[2] = _(htx[2]);
|
||||
|
||||
allocsize += strlen(htx);
|
||||
allocsize += strlen(htx[0]);
|
||||
if (htx[1] != NULL)
|
||||
allocsize += strlen(htx[1]);
|
||||
if (htx[2] != NULL)
|
||||
allocsize += strlen(htx[2]);
|
||||
|
||||
/* The space needed for the shortcut lists, at most COLS characters,
|
||||
* plus '\n'. */
|
||||
allocsize += (COLS < 21 ? 21 : COLS + 1) *
|
||||
length_of_list(currshortcut);
|
||||
allocsize += (COLS < 24 ? (24 * mb_cur_max()) :
|
||||
((COLS + 1) * mb_cur_max())) * length_of_list(currshortcut);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
@@ -411,10 +450,15 @@ void help_init(void)
|
||||
free(help_text);
|
||||
|
||||
/* Allocate space for the help text. */
|
||||
help_text = charalloc(allocsize);
|
||||
help_text = charalloc(allocsize + 1);
|
||||
|
||||
/* Now add the text we want. */
|
||||
strcpy(help_text, htx);
|
||||
strcpy(help_text, htx[0]);
|
||||
if (htx[1] != NULL)
|
||||
strcat(help_text, htx[1]);
|
||||
if (htx[2] != NULL)
|
||||
strcat(help_text, htx[2]);
|
||||
|
||||
ptr = help_text + strlen(help_text);
|
||||
|
||||
/* Now add our shortcut info. Assume that each shortcut has, at the
|
||||
@@ -537,7 +581,7 @@ void help_init(void)
|
||||
|
||||
/* If all went well, we didn't overwrite the allocated space for
|
||||
* help_text. */
|
||||
assert(strlen(help_text) < allocsize);
|
||||
assert(strlen(help_text) <= allocsize + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -926,11 +970,20 @@ void renumber(filestruct *fileptr)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
#define print1opt(shortflag, longflag, desc) print1opt_full(shortflag, longflag, desc)
|
||||
#else
|
||||
#define print1opt(shortflag, longflag, desc) print1opt_full(shortflag, desc)
|
||||
#endif
|
||||
|
||||
/* Print one usage string to the screen. This cuts down on duplicate
|
||||
* strings to translate and leaves out the parts that shouldn't be
|
||||
* strings to translate, and leaves out the parts that shouldn't be
|
||||
* translatable (the flag names). */
|
||||
void print1opt(const char *shortflag, const char *longflag, const char
|
||||
*desc)
|
||||
void print1opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
#endif
|
||||
, const char *desc)
|
||||
{
|
||||
printf(" %s\t", shortflag);
|
||||
if (strlen(shortflag) < 8)
|
||||
@@ -993,8 +1046,8 @@ void usage(void)
|
||||
#endif
|
||||
print1opt("-Z", "--restricted", N_("Restricted mode"));
|
||||
print1opt("-c", "--const", N_("Constantly show cursor position"));
|
||||
#ifndef NANO_SMALL
|
||||
print1opt("-d", "--rebinddelete", N_("Fix Backspace/Delete confusion problem"));
|
||||
#ifndef NANO_SMALL
|
||||
print1opt("-i", "--autoindent", N_("Automatically indent new lines"));
|
||||
print1opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
||||
#endif
|
||||
@@ -1021,7 +1074,8 @@ void usage(void)
|
||||
print1opt("-z", "--suspend", N_("Enable suspend"));
|
||||
|
||||
/* This is a special case. */
|
||||
printf(" %s\t\t\t%s\n","-a, -b, -e, -f, -g, -j", _("(ignored, for Pico compatibility)"));
|
||||
print1opt("-a, -b, -e,", "", "");
|
||||
print1opt("-f, -g, -j", "", _("(ignored, for Pico compatibility)"));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@@ -1180,6 +1234,7 @@ bool open_pipe(const char *command)
|
||||
nperror("fdopen");
|
||||
|
||||
read_file(f, "stdin");
|
||||
|
||||
/* If multibuffer mode is on, we could be here in view mode. If so,
|
||||
* don't set the modification flag. */
|
||||
if (!ISSET(VIEW_MODE))
|
||||
@@ -2196,6 +2251,9 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
/* Restore the terminal to its previous state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (old_mark_set) {
|
||||
size_t part_totsize;
|
||||
@@ -2880,17 +2938,20 @@ bool find_paragraph(size_t *const quote, size_t *const par)
|
||||
|
||||
/* Find the first line of the current or next paragraph. First, if
|
||||
* the current line isn't in a paragraph, move forward to the line
|
||||
* after the end of the next paragraph. If we end up on the same
|
||||
* line, or the line before that isn't in a paragraph, it means that
|
||||
* there aren't any paragraphs left, so get out. Otherwise, if the
|
||||
* current line is in a paragraph and it isn't the first line of
|
||||
* that paragraph, move back to the first line. */
|
||||
* after the last line of the next paragraph. If we end up on the
|
||||
* same line, or the line before that isn't in a paragraph, it means
|
||||
* that there aren't any paragraphs left, so get out. Otherwise,
|
||||
* move back to the last line of the paragraph. If the current line
|
||||
* is in a paragraph and it isn't the first line of that paragraph,
|
||||
* move back to the first line. */
|
||||
if (!inpar(current)) {
|
||||
filestruct *current_save = current;
|
||||
|
||||
do_para_end(FALSE);
|
||||
if (current == current_save || !inpar(current->prev))
|
||||
return FALSE;
|
||||
if (current->prev != NULL)
|
||||
current = current->prev;
|
||||
}
|
||||
if (!begpar(current))
|
||||
do_para_begin(FALSE);
|
||||
@@ -3103,12 +3164,15 @@ void do_justify(bool full_justify)
|
||||
if (break_pos == -1 || break_pos + indent_len == line_len)
|
||||
break;
|
||||
|
||||
break_pos += indent_len;
|
||||
/* Move forward to the character after the indentation and
|
||||
* just after the space. */
|
||||
break_pos += indent_len + 1;
|
||||
|
||||
assert(break_pos < line_len);
|
||||
assert(break_pos <= line_len);
|
||||
|
||||
/* Make a new line and copy the text after where we broke
|
||||
* this line to the beginning of the new line. */
|
||||
/* Make a new line, and copy the text after where we're
|
||||
* going to break this line to the beginning of the new
|
||||
* line. */
|
||||
splice_node(current, make_new_node(current), current->next);
|
||||
|
||||
/* If this paragraph is non-quoted, and autoindent isn't
|
||||
@@ -3121,35 +3185,30 @@ void do_justify(bool full_justify)
|
||||
)
|
||||
indent_len = 0;
|
||||
|
||||
current->next->data = charalloc(indent_len + line_len -
|
||||
/* Copy the text after where we're going to break the
|
||||
* current line to the next line. */
|
||||
current->next->data = charalloc(indent_len + 1 + line_len -
|
||||
break_pos);
|
||||
charcpy(current->next->data, indent_string, indent_len);
|
||||
strcpy(current->next->data + indent_len, current->data +
|
||||
break_pos + 1);
|
||||
break_pos);
|
||||
|
||||
par_len++;
|
||||
totlines++;
|
||||
totsize += indent_len;
|
||||
totsize += indent_len + 1;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Adjust the mark coordinates to compensate for the change
|
||||
* in the current line. */
|
||||
if (mark_beginbuf == current && mark_beginx > break_pos) {
|
||||
mark_beginbuf = current->next;
|
||||
mark_beginx -= break_pos + 1 - indent_len;
|
||||
mark_beginx -= break_pos - indent_len;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Break the line, and add the space back to where we broke
|
||||
* it. */
|
||||
/* Break the current line. */
|
||||
null_at(¤t->data, break_pos);
|
||||
|
||||
current->data = charealloc(current->data, break_pos + 2);
|
||||
current->data[break_pos] = ' ';
|
||||
current->data[break_pos + 1] = '\0';
|
||||
|
||||
totsize++;
|
||||
|
||||
/* Go to the next line. */
|
||||
par_len--;
|
||||
current_y++;
|
||||
@@ -3439,6 +3498,9 @@ void handle_sigwinch(int s)
|
||||
/* Restore the terminal to its previous state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
/* Do the equivalent of what both mutt and Minimum Profit do:
|
||||
* Reinitialize all the windows based on the new screen
|
||||
* dimensions. */
|
||||
@@ -3449,9 +3511,6 @@ void handle_sigwinch(int s)
|
||||
currshortcut = main_list;
|
||||
total_refresh();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
/* Reset all the input routines that rely on character sequences. */
|
||||
reset_kbinput();
|
||||
|
||||
@@ -3916,62 +3975,62 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
const struct option long_options[] = {
|
||||
{"help", 0, 0, 'h'},
|
||||
{"help", 0, NULL, 'h'},
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
{"multibuffer", 0, 0, 'F'},
|
||||
{"multibuffer", 0, NULL, 'F'},
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_SMALL
|
||||
{"historylog", 0, 0, 'H'},
|
||||
{"historylog", 0, NULL, 'H'},
|
||||
#endif
|
||||
{"ignorercfiles", 0, 0, 'I'},
|
||||
{"ignorercfiles", 0, NULL, 'I'},
|
||||
#endif
|
||||
{"morespace", 0, 0, 'O'},
|
||||
{"morespace", 0, NULL, 'O'},
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"quotestr", 1, 0, 'Q'},
|
||||
{"quotestr", 1, NULL, 'Q'},
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
{"regexp", 0, 0, 'R'},
|
||||
{"regexp", 0, NULL, 'R'},
|
||||
#endif
|
||||
{"tabsize", 1, 0, 'T'},
|
||||
{"version", 0, 0, 'V'},
|
||||
{"tabsize", 1, NULL, 'T'},
|
||||
{"version", 0, NULL, 'V'},
|
||||
#ifdef ENABLE_COLOR
|
||||
{"syntax", 1, 0, 'Y'},
|
||||
{"syntax", 1, NULL, 'Y'},
|
||||
#endif
|
||||
{"const", 0, 0, 'c'},
|
||||
{"rebinddelete", 0, 0, 'd'},
|
||||
{"nofollow", 0, 0, 'l'},
|
||||
{"const", 0, NULL, 'c'},
|
||||
{"rebinddelete", 0, NULL, 'd'},
|
||||
{"nofollow", 0, NULL, 'l'},
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", 0, 0, 'm'},
|
||||
{"mouse", 0, NULL, 'm'},
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
{"operatingdir", 1, 0, 'o'},
|
||||
{"operatingdir", 1, NULL, 'o'},
|
||||
#endif
|
||||
{"preserve", 0, 0, 'p'},
|
||||
{"preserve", 0, NULL, 'p'},
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 1, 0, 'r'},
|
||||
{"fill", 1, NULL, 'r'},
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
{"speller", 1, 0, 's'},
|
||||
{"speller", 1, NULL, 's'},
|
||||
#endif
|
||||
{"tempfile", 0, 0, 't'},
|
||||
{"view", 0, 0, 'v'},
|
||||
{"tempfile", 0, NULL, 't'},
|
||||
{"view", 0, NULL, 'v'},
|
||||
#ifndef DISABLE_WRAPPING
|
||||
{"nowrap", 0, 0, 'w'},
|
||||
{"nowrap", 0, NULL, 'w'},
|
||||
#endif
|
||||
{"nohelp", 0, 0, 'x'},
|
||||
{"suspend", 0, 0, 'z'},
|
||||
{"nohelp", 0, NULL, 'x'},
|
||||
{"suspend", 0, NULL, 'z'},
|
||||
#ifndef NANO_SMALL
|
||||
{"smarthome", 0, 0, 'A'},
|
||||
{"backup", 0, 0, 'B'},
|
||||
{"backupdir", 1, 0, 'E'},
|
||||
{"noconvert", 0, 0, 'N'},
|
||||
{"smooth", 0, 0, 'S'},
|
||||
{"restricted", 0, 0, 'Z'},
|
||||
{"autoindent", 0, 0, 'i'},
|
||||
{"cut", 0, 0, 'k'},
|
||||
{"smarthome", 0, NULL, 'A'},
|
||||
{"backup", 0, NULL, 'B'},
|
||||
{"backupdir", 1, NULL, 'E'},
|
||||
{"noconvert", 0, NULL, 'N'},
|
||||
{"smooth", 0, NULL, 'S'},
|
||||
{"restricted", 0, NULL, 'Z'},
|
||||
{"autoindent", 0, NULL, 'i'},
|
||||
{"cut", 0, NULL, 'k'},
|
||||
#endif
|
||||
{0, 0, 0, 0}
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -4340,6 +4399,9 @@ int main(int argc, char **argv)
|
||||
initscr();
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
/* Set up the global variables and the shortcuts. */
|
||||
global_init(FALSE);
|
||||
shortcut_init(FALSE);
|
||||
|
||||
39
src/nano.h
39
src/nano.h
@@ -46,15 +46,16 @@
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#define charcpy(dest, src, n) memcpy(dest, src, (n) * sizeof(char))
|
||||
|
||||
/* Other macros. */
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#undef regexec
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) safe_regexec(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
/* Set a default value for PATH_MAX, so we can use it in lines like
|
||||
* "path = getcwd(NULL, PATH_MAX + 1);". */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX -1
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG
|
||||
@@ -82,7 +83,7 @@
|
||||
#endif
|
||||
#define gettext_noop(string) (string)
|
||||
#define N_(string) gettext_noop(string)
|
||||
/* Mark a string that will be sent to gettext later. */
|
||||
/* Mark a string that will be sent to gettext() later. */
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
@@ -121,11 +122,6 @@
|
||||
#define getline ngetline
|
||||
#endif
|
||||
|
||||
/* Assume ERR is defined as -1. To avoid duplicate case values when
|
||||
* some key definitions are missing, we have to set all of these, and
|
||||
* all of the special sentinel values below, to different negative
|
||||
* values other than -1. */
|
||||
|
||||
#define VERMSG "GNU nano " VERSION
|
||||
|
||||
/* If we aren't using ncurses, turn the mouse support off, as it's
|
||||
@@ -239,24 +235,28 @@ typedef struct rcoption {
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
typedef struct colortype {
|
||||
int fg; /* fg color */
|
||||
int bg; /* bg color */
|
||||
int fg; /* Foreground color. */
|
||||
int bg; /* Background color. */
|
||||
int bright; /* Is this color A_BOLD? */
|
||||
int pairnum; /* Color pair number used for this fg/bg */
|
||||
regex_t start; /* Start (or all) of the regex string */
|
||||
regex_t *end; /* End of the regex string */
|
||||
int pairnum; /* Color pair number used for this
|
||||
* foreground/background. */
|
||||
regex_t start; /* Start (or all) of the regex
|
||||
* string. */
|
||||
regex_t *end; /* End (if any) of the regex string. */
|
||||
struct colortype *next;
|
||||
} colortype;
|
||||
|
||||
typedef struct exttype {
|
||||
regex_t val; /* The extensions that match this syntax. */
|
||||
regex_t val; /* The extensions that match this
|
||||
* syntax. */
|
||||
struct exttype *next;
|
||||
} exttype;
|
||||
|
||||
typedef struct syntaxtype {
|
||||
char *desc; /* Name of this syntax type */
|
||||
exttype *extensions; /* List of extensions that this applies to */
|
||||
colortype *color; /* color struct for this syntax */
|
||||
char *desc; /* Name of this syntax type. */
|
||||
exttype *extensions; /* List of extensions that this syntax
|
||||
* applies to. */
|
||||
colortype *color; /* Color struct for this syntax. */
|
||||
struct syntaxtype *next;
|
||||
} syntaxtype;
|
||||
#endif
|
||||
@@ -271,7 +271,7 @@ typedef struct historytype {
|
||||
typedef struct historyheadtype {
|
||||
struct historytype *next; /* Keep *next and *prev members
|
||||
* together. */
|
||||
struct historytype *prev; /* And in same order as in
|
||||
struct historytype *prev; /* And in the same order as in
|
||||
* historytype. */
|
||||
struct historytype *tail;
|
||||
struct historytype *current;
|
||||
@@ -517,8 +517,7 @@ typedef struct historyheadtype {
|
||||
/* Default width of a tab. */
|
||||
#define WIDTH_OF_TAB 8
|
||||
|
||||
/* Maximum number of search history strings saved, same value used for
|
||||
* replace history. */
|
||||
/* Maximum number of search/replace history strings saved. */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
#endif /* !NANO_H */
|
||||
|
||||
11
src/proto.h
11
src/proto.h
@@ -223,8 +223,8 @@ void cutbuffer_reset(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_SMALL
|
||||
void cut_marked(void);
|
||||
#endif
|
||||
void cut_to_eol(void);
|
||||
#endif
|
||||
void do_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_cut_till_end(void);
|
||||
@@ -382,8 +382,11 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
void copy_from_filestruct(filestruct *file_top, filestruct *file_bot);
|
||||
void renumber_all(void);
|
||||
void renumber(filestruct *fileptr);
|
||||
void print1opt(const char *shortflag, const char *longflag, const char
|
||||
*desc);
|
||||
void print1opt_full(const char *shortflag
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
, const char *longflag
|
||||
#endif
|
||||
, const char *desc);
|
||||
void usage(void);
|
||||
void version(void);
|
||||
int no_more_space(void);
|
||||
@@ -532,7 +535,7 @@ void free_history(historyheadtype *h);
|
||||
/* Public functions in utils.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags);
|
||||
#endif
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string);
|
||||
|
||||
@@ -650,7 +650,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
assert(FALSE);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "flag = %d\n", rcopts[i].flag);
|
||||
fprintf(stderr, "flag = %ld\n", rcopts[i].flag);
|
||||
#endif
|
||||
} else if (rcopts[i].flag != 0)
|
||||
UNSET(rcopts[i].flag);
|
||||
|
||||
23
src/utils.c
23
src/utils.c
@@ -36,11 +36,13 @@
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
/* Work around a potential segfault in glibc 2.2.3's regexec(). */
|
||||
int safe_regexec(const regex_t *preg, const char *string, size_t nmatch,
|
||||
regmatch_t pmatch[], int eflags)
|
||||
{
|
||||
if (string != NULL && *string != '\0')
|
||||
return regexec(preg, string, nmatch, pmatch, eflags);
|
||||
|
||||
return REG_NOMATCH;
|
||||
}
|
||||
#endif
|
||||
@@ -110,6 +112,7 @@ bool parse_num(const char *str, ssize_t *val)
|
||||
void align(char **strp)
|
||||
{
|
||||
assert(strp != NULL);
|
||||
|
||||
if (*strp != NULL)
|
||||
*strp = charealloc(*strp, strlen(*strp) + 1);
|
||||
}
|
||||
@@ -118,6 +121,7 @@ void align(char **strp)
|
||||
void null_at(char **data, size_t index)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
*data = charealloc(*data, index + 1);
|
||||
(*data)[index] = '\0';
|
||||
}
|
||||
@@ -127,6 +131,7 @@ void null_at(char **data, size_t index)
|
||||
void unsunder(char *str, size_t true_len)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
for (; true_len > 0; true_len--, str++) {
|
||||
if (*str == '\0')
|
||||
*str = '\n';
|
||||
@@ -138,6 +143,7 @@ void unsunder(char *str, size_t true_len)
|
||||
void sunder(char *str)
|
||||
{
|
||||
assert(str != NULL);
|
||||
|
||||
for (; *str != '\0'; str++) {
|
||||
if (*str == '\n')
|
||||
*str = '\0';
|
||||
@@ -217,7 +223,9 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
* line. In either case, we just say no match was found. */
|
||||
if ((start > haystack && *(start - 1) == '\0') || start < haystack)
|
||||
return NULL;
|
||||
|
||||
assert(haystack != NULL && needle != NULL && start != NULL);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
#ifndef NANO_SMALL
|
||||
@@ -267,18 +275,19 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
}
|
||||
|
||||
/* This is a wrapper for the perror() function. The wrapper takes care
|
||||
* of ncurses, calls perror (which writes to stderr), then refreshes the
|
||||
* screen. Note that nperror() causes the window to flicker once. */
|
||||
* of curses, calls perror() (which writes to stderr), and then
|
||||
* refreshes the screen. Note that nperror() causes the window to
|
||||
* flicker once. */
|
||||
void nperror(const char *s)
|
||||
{
|
||||
/* leave ncurses mode, go to the terminal */
|
||||
/* Leave curses mode and go to the terminal. */
|
||||
if (endwin() != ERR) {
|
||||
perror(s); /* print the error */
|
||||
total_refresh(); /* return to ncurses and repaint */
|
||||
perror(s); /* Print the error. */
|
||||
total_refresh(); /* Return to curses and refresh. */
|
||||
}
|
||||
}
|
||||
|
||||
/* Thanks BG, many ppl have been asking for this... */
|
||||
/* Thanks, BG, many people have been asking for this... */
|
||||
void *nmalloc(size_t howmuch)
|
||||
{
|
||||
void *r = malloc(howmuch);
|
||||
|
||||
269
src/winio.c
269
src/winio.c
@@ -1887,12 +1887,16 @@ void do_statusbar_cut_text(void)
|
||||
{
|
||||
assert(answer != NULL);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END))
|
||||
null_at(&answer, statusbar_x);
|
||||
else {
|
||||
#endif
|
||||
null_at(&answer, 0);
|
||||
statusbar_x = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -2418,6 +2422,7 @@ void nanoget_repaint(const char *buf, const char *inputbuf, size_t x)
|
||||
wmove(bottomwin, 0, COLS - wid + x_real - page_start);
|
||||
} else
|
||||
wmove(bottomwin, 0, COLS - 1);
|
||||
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
}
|
||||
|
||||
@@ -2472,8 +2477,6 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def,
|
||||
|
||||
currshortcut = s;
|
||||
|
||||
/* Get the input! */
|
||||
|
||||
nanoget_repaint(buf, answer, statusbar_x);
|
||||
|
||||
/* Refresh the edit window before getting input. */
|
||||
@@ -2501,123 +2504,123 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def,
|
||||
tabbed = FALSE;
|
||||
|
||||
switch (kbinput) {
|
||||
case NANO_TAB_KEY:
|
||||
case NANO_TAB_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
/* tab history completion */
|
||||
if (history_list != NULL) {
|
||||
if (!complete || last_kbinput != NANO_TAB_KEY) {
|
||||
history_list->current = (historytype *)history_list;
|
||||
history_list->len = strlen(answer);
|
||||
}
|
||||
/* Tab history completion. */
|
||||
if (history_list != NULL) {
|
||||
if (!complete || last_kbinput != NANO_TAB_KEY) {
|
||||
history_list->current =
|
||||
(historytype *)history_list;
|
||||
history_list->len = strlen(answer);
|
||||
}
|
||||
|
||||
if (history_list->len > 0) {
|
||||
complete = get_history_completion(history_list,
|
||||
answer);
|
||||
answer = mallocstrcpy(answer, complete);
|
||||
if (history_list->len > 0) {
|
||||
complete = get_history_completion(history_list,
|
||||
answer);
|
||||
answer = mallocstrcpy(answer, complete);
|
||||
answer_len = strlen(answer);
|
||||
statusbar_x = answer_len;
|
||||
}
|
||||
}
|
||||
#ifndef DISABLE_TABCOMP
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
if (allow_tabs) {
|
||||
answer = input_tab(answer, &statusbar_x, &tabbed,
|
||||
list);
|
||||
answer_len = strlen(answer);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case NANO_PREVLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
if (history_list != NULL) {
|
||||
/* If currentbuf is NULL, or if use_cb is 1,
|
||||
* currentbuf isn't NULL, and currentbuf is
|
||||
* different from answer, it means that we're
|
||||
* scrolling up at the top of the search history,
|
||||
* and we need to save the current answer in
|
||||
* currentbuf. Do this and reset use_cb to 0. */
|
||||
if (currentbuf == NULL || (use_cb == 1 &&
|
||||
strcmp(currentbuf, answer) != 0)) {
|
||||
currentbuf = mallocstrcpy(currentbuf, answer);
|
||||
use_cb = 0;
|
||||
}
|
||||
|
||||
/* If currentbuf isn't NULL, use_cb is 2, and
|
||||
* currentbuf is different from answer, it means
|
||||
* that we're scrolling up at the bottom of the
|
||||
* search history, and we need to make the string in
|
||||
* currentbuf the current answer. Do this, blow
|
||||
* away currentbuf since we don't need it anymore,
|
||||
* and reset use_cb to 0. */
|
||||
if (currentbuf != NULL && use_cb == 2 &&
|
||||
strcmp(currentbuf, answer) != 0) {
|
||||
answer = mallocstrcpy(answer, currentbuf);
|
||||
free(currentbuf);
|
||||
currentbuf = NULL;
|
||||
answer_len = strlen(answer);
|
||||
use_cb = 0;
|
||||
|
||||
/* Otherwise, get the older search from the history
|
||||
* list and save it in answer. If there is no older
|
||||
* search, blank out answer. */
|
||||
} else if ((history =
|
||||
get_history_older(history_list)) != NULL) {
|
||||
answer = mallocstrcpy(answer, history);
|
||||
answer_len = strlen(history);
|
||||
} else {
|
||||
answer = mallocstrcpy(answer, "");
|
||||
answer_len = 0;
|
||||
}
|
||||
statusbar_x = answer_len;
|
||||
}
|
||||
}
|
||||
#ifndef DISABLE_TABCOMP
|
||||
else
|
||||
#endif
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
if (allow_tabs) {
|
||||
answer = input_tab(answer, &statusbar_x, &tabbed, list);
|
||||
answer_len = strlen(answer);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case NANO_PREVLINE_KEY:
|
||||
break;
|
||||
case NANO_NEXTLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
if (history_list != NULL) {
|
||||
|
||||
/* if currentbuf is NULL, or if use_cb is 1, currentbuf
|
||||
isn't NULL, and currentbuf is different from answer,
|
||||
it means that we're scrolling up at the top of the
|
||||
search history, and we need to save the current
|
||||
answer in currentbuf; do this and reset use_cb to
|
||||
0 */
|
||||
if (currentbuf == NULL || (use_cb == 1 &&
|
||||
strcmp(currentbuf, answer) != 0)) {
|
||||
currentbuf = mallocstrcpy(currentbuf, answer);
|
||||
use_cb = 0;
|
||||
}
|
||||
|
||||
/* if currentbuf isn't NULL, use_cb is 2, and currentbuf
|
||||
is different from answer, it means that we're
|
||||
scrolling up at the bottom of the search history, and
|
||||
we need to make the string in currentbuf the current
|
||||
answer; do this, blow away currentbuf since we don't
|
||||
need it anymore, and reset use_cb to 0 */
|
||||
if (currentbuf != NULL && use_cb == 2 &&
|
||||
strcmp(currentbuf, answer) != 0) {
|
||||
answer = mallocstrcpy(answer, currentbuf);
|
||||
free(currentbuf);
|
||||
currentbuf = NULL;
|
||||
answer_len = strlen(answer);
|
||||
use_cb = 0;
|
||||
|
||||
/* else get older search from the history list and save
|
||||
it in answer; if there is no older search, blank out
|
||||
answer */
|
||||
} else if ((history =
|
||||
get_history_older(history_list)) != NULL) {
|
||||
answer = mallocstrcpy(answer, history);
|
||||
answer_len = strlen(history);
|
||||
} else {
|
||||
answer = mallocstrcpy(answer, "");
|
||||
answer_len = 0;
|
||||
}
|
||||
statusbar_x = answer_len;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case NANO_NEXTLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
if (history_list != NULL) {
|
||||
|
||||
/* get newer search from the history list and save it
|
||||
in answer */
|
||||
if ((history = get_history_newer(history_list)) != NULL) {
|
||||
answer = mallocstrcpy(answer, history);
|
||||
answer_len = strlen(history);
|
||||
|
||||
/* if there is no newer search, we're here */
|
||||
|
||||
/* if currentbuf isn't NULL and use_cb isn't 2, it means
|
||||
that we're scrolling down at the bottom of the search
|
||||
history and we need to make the string in currentbuf
|
||||
the current answer; do this, blow away currentbuf
|
||||
since we don't need it anymore, and set use_cb to
|
||||
1 */
|
||||
} else if (currentbuf != NULL && use_cb != 2) {
|
||||
answer = mallocstrcpy(answer, currentbuf);
|
||||
answer_len = strlen(answer);
|
||||
free(currentbuf);
|
||||
currentbuf = NULL;
|
||||
use_cb = 1;
|
||||
|
||||
/* otherwise, if currentbuf is NULL and use_cb isn't 2,
|
||||
it means that we're scrolling down at the bottom of
|
||||
the search history and the current answer (if it's
|
||||
not blank) needs to be saved in currentbuf; do this,
|
||||
blank out answer (if necessary), and set use_cb to
|
||||
2 */
|
||||
} else if (use_cb != 2) {
|
||||
if (answer[0] != '\0') {
|
||||
currentbuf = mallocstrcpy(currentbuf, answer);
|
||||
answer = mallocstrcpy(answer, "");
|
||||
if (history_list != NULL) {
|
||||
/* Get the newer search from the history list and
|
||||
* save it in answer. */
|
||||
if ((history =
|
||||
get_history_newer(history_list)) != NULL) {
|
||||
answer = mallocstrcpy(answer, history);
|
||||
answer_len = strlen(history);
|
||||
/* If currentbuf isn't NULL and use_cb isn't 2, it
|
||||
* means that we're scrolling down at the bottom of
|
||||
* the search history and we need to make the string
|
||||
* in currentbuf the current answer; do this, blow
|
||||
* away currentbuf since we don't need it anymore,
|
||||
* and set use_cb to 1. */
|
||||
} else if (currentbuf != NULL && use_cb != 2) {
|
||||
answer = mallocstrcpy(answer, currentbuf);
|
||||
answer_len = strlen(answer);
|
||||
free(currentbuf);
|
||||
currentbuf = NULL;
|
||||
use_cb = 1;
|
||||
/* Itherwise, if currentbuf is NULL and use_cb isn't
|
||||
* 2, it means that we're scrolling down at the
|
||||
* bottom of the search history and the current
|
||||
* answer (if it's not blank) needs to be saved in
|
||||
* currentbuf. Do this, blank out answer (if
|
||||
* necessary), and set use_cb to 2. */
|
||||
} else if (use_cb != 2) {
|
||||
if (answer[0] != '\0') {
|
||||
currentbuf = mallocstrcpy(currentbuf,
|
||||
answer);
|
||||
answer = mallocstrcpy(answer, "");
|
||||
}
|
||||
answer_len = 0;
|
||||
use_cb = 2;
|
||||
}
|
||||
answer_len = 0;
|
||||
use_cb = 2;
|
||||
statusbar_x = answer_len;
|
||||
}
|
||||
statusbar_x = answer_len;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
last_kbinput = kbinput;
|
||||
#endif
|
||||
@@ -2639,7 +2642,8 @@ int nanogetstr(bool allow_tabs, const char *buf, const char *def,
|
||||
* otherwise, the valid shortcut key caught. def is any editable text
|
||||
* we want to put up by default.
|
||||
*
|
||||
* New arg tabs tells whether or not to allow tab completion. */
|
||||
* The allow_tabs parameter tells whether or not to allow tab
|
||||
* completion. */
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *which_history,
|
||||
@@ -2647,7 +2651,7 @@ int statusq(bool allow_tabs, const shortcut *s, const char *def,
|
||||
const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *foo = charalloc(COLS - 3);
|
||||
char *foo = charalloc(((COLS - 4) * mb_cur_max()) + 1);
|
||||
int ret;
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool list = FALSE;
|
||||
@@ -2656,9 +2660,9 @@ int statusq(bool allow_tabs, const shortcut *s, const char *def,
|
||||
bottombars(s);
|
||||
|
||||
va_start(ap, msg);
|
||||
vsnprintf(foo, COLS - 4, msg, ap);
|
||||
vsnprintf(foo, (COLS - 4) * mb_cur_max(), msg, ap);
|
||||
va_end(ap);
|
||||
foo[COLS - 4] = '\0';
|
||||
null_at(&foo, actual_x(foo, COLS - 4));
|
||||
|
||||
ret = nanogetstr(allow_tabs, foo, def,
|
||||
#ifndef NANO_SMALL
|
||||
@@ -2689,9 +2693,9 @@ int statusq(bool allow_tabs, const shortcut *s, const char *def,
|
||||
#endif
|
||||
|
||||
#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 we've done tab completion, there might be a list of
|
||||
* filename matches on the edit window at this point. Make sure
|
||||
* that they're cleared off. */
|
||||
if (list)
|
||||
edit_refresh();
|
||||
#endif
|
||||
@@ -2730,7 +2734,6 @@ void titlebar(const char *path)
|
||||
assert(COLS >= 0);
|
||||
|
||||
wattron(topwin, A_REVERSE);
|
||||
|
||||
blank_titlebar();
|
||||
|
||||
if (COLS <= 5 || COLS - 5 < verlen)
|
||||
@@ -2752,7 +2755,7 @@ void titlebar(const char *path)
|
||||
|
||||
if (ISSET(MODIFIED))
|
||||
state = _("Modified");
|
||||
else if (path == NULL && ISSET(VIEW_MODE))
|
||||
else if (ISSET(VIEW_MODE))
|
||||
state = _("View");
|
||||
else {
|
||||
if (space > 0)
|
||||
@@ -2760,11 +2763,13 @@ void titlebar(const char *path)
|
||||
state = &hblank[COLS - statelen];
|
||||
}
|
||||
statelen = strnlenpt(state, COLS);
|
||||
|
||||
/* We need a space before state. */
|
||||
if ((ISSET(MODIFIED) || ISSET(VIEW_MODE)) && statelen < COLS)
|
||||
statelen++;
|
||||
|
||||
assert(space >= 0);
|
||||
|
||||
if (space == 0 || statelen >= space)
|
||||
goto the_end;
|
||||
|
||||
@@ -2778,8 +2783,11 @@ void titlebar(const char *path)
|
||||
newfie = TRUE;
|
||||
} else
|
||||
prefix = _("File:");
|
||||
|
||||
assert(statelen < space);
|
||||
|
||||
prefixlen = strnlenpt(prefix, space - statelen);
|
||||
|
||||
/* If newfie is FALSE, we need a space after prefix. */
|
||||
if (!newfie && prefixlen + statelen < space)
|
||||
prefixlen++;
|
||||
@@ -2791,6 +2799,7 @@ void titlebar(const char *path)
|
||||
else
|
||||
space = 0;
|
||||
/* space is now the room we have for the file name. */
|
||||
|
||||
if (!newfie) {
|
||||
size_t lenpt = strlenpt(path), start_col;
|
||||
|
||||
@@ -2811,7 +2820,7 @@ void titlebar(const char *path)
|
||||
|
||||
/* There is room for the whole filename, so we center it. */
|
||||
waddnstr(topwin, hblank, (space - exppathlen) / 3);
|
||||
waddnstr(topwin, prefix, prefixlen);
|
||||
waddnstr(topwin, prefix, actual_x(prefix, prefixlen));
|
||||
if (!newfie) {
|
||||
assert(strlenpt(prefix) + 1 == prefixlen);
|
||||
|
||||
@@ -2820,7 +2829,7 @@ void titlebar(const char *path)
|
||||
}
|
||||
} else {
|
||||
/* We will say something like "File: ...ename". */
|
||||
waddnstr(topwin, prefix, prefixlen);
|
||||
waddnstr(topwin, prefix, actual_x(prefix, prefixlen));
|
||||
if (space <= -3 || newfie)
|
||||
goto the_end;
|
||||
waddch(topwin, ' ');
|
||||
@@ -2834,11 +2843,13 @@ void titlebar(const char *path)
|
||||
free(exppath);
|
||||
|
||||
if (COLS <= 1 || statelen >= COLS - 1)
|
||||
mvwaddnstr(topwin, 0, 0, state, COLS);
|
||||
mvwaddnstr(topwin, 0, 0, state, actual_x(state, COLS));
|
||||
else {
|
||||
assert(COLS - statelen - 2 >= 0);
|
||||
|
||||
mvwaddch(topwin, 0, COLS - statelen - 2, ' ');
|
||||
mvwaddnstr(topwin, 0, COLS - statelen - 1, state, statelen);
|
||||
mvwaddnstr(topwin, 0, COLS - statelen - 1, state,
|
||||
actual_x(state, statelen));
|
||||
}
|
||||
|
||||
wattroff(topwin, A_REVERSE);
|
||||
@@ -3637,11 +3648,11 @@ int do_yesno(bool all, const char *msg)
|
||||
const char *allstr; /* And all, surprise! */
|
||||
|
||||
/* yesstr, nostr, and allstr are strings of any length. Each string
|
||||
* consists of all characters accepted as a valid character for that
|
||||
* value. The first value will be the one displayed in the
|
||||
* shortcuts. Translators: if possible, specify both the shortcuts
|
||||
* for your language and English. For example, in French: "OoYy"
|
||||
* for "Oui". */
|
||||
* consists of all single-byte characters accepted as valid
|
||||
* characters for that value. The first value will be the one
|
||||
* displayed in the shortcuts. Translators: if possible, specify
|
||||
* both the shortcuts for your language and English. For example,
|
||||
* in French: "OoYy" for "Oui". */
|
||||
yesstr = _("Yy");
|
||||
nostr = _("Nn");
|
||||
allstr = _("Aa");
|
||||
@@ -3694,8 +3705,6 @@ int do_yesno(bool all, const char *msg)
|
||||
if (kbinput == NANO_CANCEL_KEY)
|
||||
ok = -1;
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* Look, ma! We get to duplicate lots of code from
|
||||
* do_mouse()!! */
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
get_mouseinput(&mouse_x, &mouse_y, FALSE);
|
||||
|
||||
@@ -3828,10 +3837,10 @@ void do_cursorpos_void(void)
|
||||
/* Calculate the next line of help_text, starting at ptr. */
|
||||
size_t help_line_len(const char *ptr)
|
||||
{
|
||||
int help_cols = (COLS > 80) ? COLS - 8 : 72;
|
||||
int help_cols = (COLS > 24) ? COLS - 8 : 24;
|
||||
|
||||
/* Try to break the line at (COLS - 8) columns if we have more than
|
||||
* 80 columns, and at 72 columns otherwise. */
|
||||
* 24 columns, and at 24 columns otherwise. */
|
||||
size_t retval = break_line(ptr, help_cols, TRUE);
|
||||
size_t retval_save = retval;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user