Compare commits
95 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35d90259ed | ||
|
|
07e97d61c0 | ||
|
|
71348eeb1f | ||
|
|
9e7efa3202 | ||
|
|
df3afdce0d | ||
|
|
66989d6ece | ||
|
|
7c44b68e05 | ||
|
|
ad1daccecc | ||
|
|
4aacee6627 | ||
|
|
629edad237 | ||
|
|
834a69d5a4 | ||
|
|
f45c18daa0 | ||
|
|
0b88ce08cb | ||
|
|
c9f147aba3 | ||
|
|
e7034c6087 | ||
|
|
90bd712c88 | ||
|
|
9c35eb0def | ||
|
|
92c9dd255c | ||
|
|
2a42af1d62 | ||
|
|
16e4168993 | ||
|
|
d0dbb40ef6 | ||
|
|
91d392cd2b | ||
|
|
b9bfc9bc4f | ||
|
|
2dc0f6b2bf | ||
|
|
44e73dfc96 | ||
|
|
9239d742d6 | ||
|
|
43932bd17b | ||
|
|
805c26d1a6 | ||
|
|
d746d90cc3 | ||
|
|
429a5518ea | ||
|
|
bf9da287a0 | ||
|
|
423cbfd743 | ||
|
|
5577aec4e8 | ||
|
|
18f8be0058 | ||
|
|
f8163dc2e7 | ||
|
|
f0f63a82fb | ||
|
|
a547fd1e0e | ||
|
|
6306a11ad6 | ||
|
|
9541f2a1d3 | ||
|
|
d56bd79daf | ||
|
|
e49f123cc0 | ||
|
|
4c780be883 | ||
|
|
220e7fb132 | ||
|
|
756f220a26 | ||
|
|
cf7c9936ad | ||
|
|
9babaf3b38 | ||
|
|
340d6e50c2 | ||
|
|
dabc3cb0df | ||
|
|
e10debd14b | ||
|
|
f1d33d30ce | ||
|
|
8c81d23a7e | ||
|
|
8d458043d1 | ||
|
|
5286ccbaf9 | ||
|
|
ba96f7afac | ||
|
|
a2efc36799 | ||
|
|
e5935973f9 | ||
|
|
13415991e8 | ||
|
|
b7ea9d45bb | ||
|
|
0286ba436e | ||
|
|
c86f714a15 | ||
|
|
9b45ff54ac | ||
|
|
2b78429248 | ||
|
|
c87a411624 | ||
|
|
141c1274c4 | ||
|
|
11b0011b1f | ||
|
|
b4dc9e0944 | ||
|
|
81b1eea10f | ||
|
|
7dc14e81d7 | ||
|
|
4dbcc3cd9e | ||
|
|
1f2a072e33 | ||
|
|
0bf4e146a0 | ||
|
|
bbd96ea838 | ||
|
|
5027a18c2c | ||
|
|
99bf73fe66 | ||
|
|
d7c31c1123 | ||
|
|
6d690a39dc | ||
|
|
ed02216378 | ||
|
|
55d5455abd | ||
|
|
5d8f6250de | ||
|
|
7a6f0d9868 | ||
|
|
145a0450ea | ||
|
|
da721be17a | ||
|
|
234a34d273 | ||
|
|
84ff479b24 | ||
|
|
3206ab4fe0 | ||
|
|
f5d7a8b4fd | ||
|
|
d069ac02d1 | ||
|
|
d63d11be58 | ||
|
|
1a471392c5 | ||
|
|
f6a6b5aa86 | ||
|
|
95b0b5249a | ||
|
|
29d9025381 | ||
|
|
6925bbd360 | ||
|
|
18bd029981 | ||
|
|
7975ed86a7 |
@@ -224,3 +224,4 @@ distribution.
|
||||
If December 1997 seems to be old, you may fetch a more recent copy
|
||||
of this `ABOUT-NLS' file on most GNU archive sites.
|
||||
|
||||
$Id$
|
||||
|
||||
1
AUTHORS
1
AUTHORS
@@ -1,3 +1,4 @@
|
||||
$Id$
|
||||
This file lists people who have made significant contribution to the nano
|
||||
editor. Please see the ChangeLog for specific changes by author.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
39
BUGS
39
BUGS
@@ -11,6 +11,8 @@
|
||||
(14) [FIXED, mostly]
|
||||
- Doing a replacement of a substring of the replace string (e.g. replacing
|
||||
"ed" with "fred" causes an infinite loop. (15) [FIXED]
|
||||
- Cutting a file with marked text and both marker ends on the same line
|
||||
causes a random segfault (16) [FIXED]
|
||||
- Cutting more than one line resets the KEEP_CUTBUFFER flag in 0.9.3
|
||||
Error is in bitwise assignment (nano.h). (17) [FIXED]
|
||||
- The wrapping code does not work right for lines like the following:
|
||||
@@ -38,21 +40,42 @@
|
||||
- Wrapping a line with autoindent mode sometimes causes a segfault (19)[FIXED]
|
||||
- When inserting files, the display sometimes fails to display properly
|
||||
until a pageup/down occurs (22)[FIXED]
|
||||
- In search/replace code there is too much refreshing in bottomwin (26)
|
||||
[FIXED]
|
||||
- Using nano -t, user can not exit until a filename is given via ^O. (30)
|
||||
[FIXED]
|
||||
- Using -k cut text is not pasted properly. (34) [FIXED].
|
||||
- Using -k pasted text is not updated properly if it goes beyond editbot. (35)
|
||||
[FIXED]
|
||||
- Doing a cut with -k can screw up the filestruct, fault is in cutting
|
||||
code. (36) [FIXED]
|
||||
- Hitting enter on the magic line makes new lines, but they are not
|
||||
written out to disk when saved..... (37). [FIXED]
|
||||
- Page up and page down do not work the same way as Pico (# of lines). (38)
|
||||
[FIXED]
|
||||
- When doing a search and the marker is set, the screen does not always
|
||||
properly update the inverted text (39). [FIXED]
|
||||
- Searches for a string that only exist on one line multiple times will
|
||||
fail after finding the last occurance (discovered by Ken Tyler) (40). [FIXED]
|
||||
- Alt-Z is current broken to toggle suspend. I guess I still don't know
|
||||
signals very well =-) (41) [FIXED].
|
||||
- Unable to cut the entire file using the marker (discovered by Kev Tyler)
|
||||
(42). [FIXED]
|
||||
- The keypad does not work when nano runs in the Gnome terminal (43). [FIXED]
|
||||
- When reading in a file, if the file is a directory the contents of the
|
||||
file being edited are blown away (discovered by Chris Pimlot) (44). [FIXED]
|
||||
|
||||
** Open BUGS **
|
||||
|
||||
- Marked cutting sometimes leaves a newline in the file unintelligently,
|
||||
such as when all of a line is selected but the mark doesn't proceed to
|
||||
the new line. (8) { Is this an issue? compare to pico 3.5 }
|
||||
- no way to do a replace with the empty string. (11)
|
||||
- no way to do a replace with the empty string (11).
|
||||
- Spelling support is not elegant like pico's integration of the 'spell'
|
||||
program. Nano only uses ispell (for now) (12)
|
||||
- Cutting a file with marked text and both marker ends on the same line
|
||||
causes a random segfault (16)
|
||||
- In search/replace code there is too much refreshing in bottomwin (26)
|
||||
program. Nano only uses ispell (for now) (12).
|
||||
- In replace, there is no way to accept the default replace string. (27)
|
||||
- totsize problems still abound in do_justify (33)
|
||||
- Using -k cut text is not pasted properly. (34) [FIXED, mostly].
|
||||
- Using -k pasted text is not updated properly if it goes beyond editbot. (35)
|
||||
- totsize problems still abound in do_justify (33).
|
||||
- in certain terms, nano will leave a "ghost" of screen upon exit
|
||||
when called from inside mutt (among other settings) (45).
|
||||
|
||||
$Id$
|
||||
|
||||
182
ChangeLog
182
ChangeLog
@@ -1,3 +1,183 @@
|
||||
nano 0.9.19 - 10/02/2000
|
||||
- General
|
||||
- Added PDCurses support under cygwin, which allows building
|
||||
a nice stand-alone nano.exe for those poor Windows users.
|
||||
Extra check in configure.in for initscr() in -lcurses (as
|
||||
PDcurses has no tgetent), some #ifdef PDCURSES statements
|
||||
in main().
|
||||
- Changed web site and email to new nano-editor.org domain.
|
||||
- nano.c
|
||||
- Added (int) casts to remove compile warnings with -Wall.
|
||||
main()
|
||||
- Added check for _POSIX_VDISABLE around term variable definition.
|
||||
- search.c
|
||||
- Added initializations for last_search and last_replace (Rocco Corsi)
|
||||
|
||||
nano 0.9.18 - 09/18/2000
|
||||
- General
|
||||
- Changed _POSIX_VERSION checks in regex code to HAVE_REGEX_H,
|
||||
added check for regex.h in configure.in.
|
||||
- configure.in:
|
||||
- Added default case for cross-compiling to get rid of annoying
|
||||
AC_TRY_RUN warning.
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- Don't immediately abort if we're on filebot and the marker is
|
||||
set (fixes bug #42).
|
||||
- files.c:
|
||||
open_file()
|
||||
- Fix for bug #44 (Rocco Corsi).
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Added in FKEYs that for some reason were left out. *boggle*
|
||||
- nano.c:
|
||||
main()
|
||||
- Added check for _POSIX_VDISABLE and use raw mode if not
|
||||
available, allows nano to work with cygwin.
|
||||
- Added gettext calls to enable/disable strings (Jordi).
|
||||
- Revamped a great deal of the F-key and keypad key handling,
|
||||
because we not longer use keypad() (see below).
|
||||
- Removed keypad() call because nano was not working with the
|
||||
keypad in many terms, which is very bad.
|
||||
- Made insert key call do_insertfile().
|
||||
do_toggle()
|
||||
- Rewrote function to allow NOHELP toggle to wotk on systems
|
||||
without a working resizewin(). New function window_init().
|
||||
mouse_init()
|
||||
- Add keypad only if mouse support is on, otherwise mouse doesn't
|
||||
work. I guess you have to choose between having the mouse and
|
||||
having a working keypad for the time being (thank god for Meta-m).
|
||||
- winio.c:
|
||||
total_refresh()
|
||||
- Added titlebar() call.
|
||||
onekey()
|
||||
- Off by one error fix fix ;-) (Rocco Corsi).
|
||||
|
||||
- search.c:
|
||||
findnextstr()
|
||||
- Reset starting at current for search instead of begin.
|
||||
- es.po:
|
||||
- Translated new strings and minor updates (Jordi).
|
||||
- de.po
|
||||
- Revised translations by floki@bigfoot.com
|
||||
|
||||
nano-0.9.17 - 09/04/2000
|
||||
- General
|
||||
- New shortcuts to toggle certain options that are normally only
|
||||
flags via Alt/Meta. See Alt-C,E,I,K,M,P,X,Z. New struct called
|
||||
toggles in nano.h, toggle_init(), toggle_init_one() in global.c
|
||||
called from shortcut_init(), and do_toggle in nano.c. Also
|
||||
moved the signal code into a separate function in nano.c called
|
||||
signal_init(). Moved "struct sigaction act"into a static in
|
||||
nano.c.
|
||||
- Changed from Alt-key symbol (@) which is completely nonstandard
|
||||
to the *nix "Meta" symbol (M-). Changed help_init to show
|
||||
the M-key usage and the help text to explain keys whcih generate
|
||||
Meta. Moved the toggle Meta keystrokes to the first column
|
||||
instead of the third as they are the primary keystrokes for the
|
||||
functions. Thanks Mini editor team :->
|
||||
- Changed last_search and last_replace vars to statically
|
||||
allocated (hence nulled) and moved to search.c (Matt Kraai).
|
||||
- global.c:
|
||||
toggle_init()
|
||||
- Changed "No auto wrap" and "No help mode" to "Auto wrap" and
|
||||
"Help mode". See the change to do_toggle() below.
|
||||
- nano.c:
|
||||
do_mouse()
|
||||
- Patch for handling lines w/tabs and mouse better (Ben Roberts).
|
||||
do_wrap()
|
||||
- Made wrapping code less ambitious.
|
||||
do_toggle()
|
||||
- Added checks for no help and no wrap mode, and print opposite
|
||||
enable/disable message.
|
||||
do_suspend(), do_cont():
|
||||
- New functions, handle suspend signal in a Pico-like manner and
|
||||
work with Meta-Z.
|
||||
- winio.c:
|
||||
total_refresh()
|
||||
- Added edit_refresh() call to actually update the screen if messy.
|
||||
edit_refresh_clearok()
|
||||
- New function, does a total update for edit refresh, needed to fix
|
||||
lack of reversed text on searching with MARK_ISSET.
|
||||
onekey()
|
||||
- Off by one error fix (Rocco Corsi).
|
||||
|
||||
update_line()
|
||||
- Added check for binary data >= 1 and <= 26, and use ^+letter
|
||||
to display it. Should fix editing text files with binary
|
||||
data in them. Placing of the cursor seems to be a bit screwed
|
||||
though...
|
||||
- search.c:
|
||||
search_abort()
|
||||
- Now calls edit_refresh_clearok when MARK_ISSET to handle screen
|
||||
ugliness bug (reported by Ken Tyler).
|
||||
findnextstr():
|
||||
- Added reset for placewewant (Ben Roberts).
|
||||
- Fixed check for string that only occurs on the same line failing
|
||||
(discovered by Ken Tyler).
|
||||
|
||||
nano-0.9.16 - 08/09/2000
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- Fixed getting locked into cutbuffer on cutting first line of file.
|
||||
- Added check_statblank().
|
||||
- Check for fileptr == filebot, if so return, we shouldn't bother
|
||||
cutting the magic line.
|
||||
do_uncut_text()
|
||||
- Added check_statblank().
|
||||
- nano.c:
|
||||
main()
|
||||
- Changed tabsize long arg to actually accept an argument *sigh*.
|
||||
- po/Makefile.in.in:
|
||||
- Patch to handle $DESTDIR (orig by Dan Harnett contributed by
|
||||
Christian Weisgerber)
|
||||
- configure.in:
|
||||
- New (and severally revised =) slang test code (Albert Chin-A-Young)
|
||||
|
||||
nano-0.9.15 - 08/03/2000
|
||||
- Changed edit_update call to take arguments TOP, CENTER or BOTTOM.
|
||||
Affects many many functions. Removed functions edit_update_top and
|
||||
edit_update_bot.
|
||||
- Added global variable tabsize, we no longer screw with the curses
|
||||
library in order to implement -T (suggested by Christian Weisgerber).
|
||||
- configure.in:
|
||||
- Finally fixed check for slang to report "no" if not called
|
||||
with --with-slang or --without-slang
|
||||
- nano.c:
|
||||
splice_node()
|
||||
- New function, abstracts linking in nodes. Fixes bug #36.
|
||||
null_at()
|
||||
- New function, nulls a string at a given index and realigns it.
|
||||
delete_buffer()
|
||||
- Removed, same as free_filestruct().
|
||||
do_backspace()
|
||||
- Now calls page_up_center instead of page_up (as it should?)
|
||||
do_enter()
|
||||
- Fixed typo (?) in check for inptr->next. Caused lots of
|
||||
grief for editing lines at filebot.
|
||||
main()
|
||||
- Removed now useless usrtabsize variable (Christian Weisgerber).
|
||||
- search.c:
|
||||
replace_abort()
|
||||
- redundant, now just calls search abort until it does something
|
||||
different.
|
||||
- winio.c:
|
||||
edit_refresh()
|
||||
- Added check for current line "running" off the screen.
|
||||
Hopefully this will not cause any recursive lockups.
|
||||
(Who am I kidding, of course it will!)
|
||||
- Added check to stop infinite loop calling edit_update.
|
||||
edit_update()
|
||||
- Rewritten, hopefully this will remove a lot of the
|
||||
scrolling the cursor back and forth needlessly.
|
||||
- move.c:
|
||||
page_down()
|
||||
- do an edit_update() at last case. Made function more like
|
||||
Pico's version, only move down to two lines before editbot.
|
||||
page_up()
|
||||
- Made function more like Pico's version, only move down to two
|
||||
lines after edittop.
|
||||
|
||||
nano-0.9.14 - 07/27/2000
|
||||
- nano.h:
|
||||
- Set CUT_TO_END to a different bit than TEMP_OPT. Fixes bug #32.
|
||||
@@ -840,3 +1020,5 @@ nano 0.7.6 - 01/15/2000
|
||||
0.2 Read in data to buffer, bound keystrokes to stub functions,
|
||||
initial cursor movement on screen. Initial autoconf support.
|
||||
0.1 Initial program setup w/ncurses
|
||||
|
||||
$Id$
|
||||
|
||||
2
INSTALL
2
INSTALL
@@ -180,3 +180,5 @@ operates.
|
||||
script, and exit.
|
||||
|
||||
`configure' also accepts some other, not widely useful, options.
|
||||
|
||||
$Id$
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
## $Id$
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = cut.c \
|
||||
files.c \
|
||||
|
||||
40
NEWS
40
NEWS
@@ -1,3 +1,41 @@
|
||||
10/02/2000 - Nano 0.9.19 is the "Chris is getting married in less than
|
||||
a week and needs a distraction" release. There are only
|
||||
a few actual code changes, mainly portability and compiler
|
||||
warning fixes. Nano now also supports PDCurses, which
|
||||
enables easily-built nano executables for Windows NT
|
||||
and 95/98 for the brave. The official nano site has
|
||||
changed (again) as well, check out www.nano-editor.org for
|
||||
all the latest nano schtuff.
|
||||
|
||||
09/18/2000 - Nano 0.9.18 is unleashed. It has some new keyboard
|
||||
handling code, cygwin support out of the box, and
|
||||
a more portable handler for the NOHELP toggle. There
|
||||
is also a fix for a somewhat serious bug whereby trying
|
||||
to insert a directory instead of a normal file would
|
||||
destroy the contents of the editor. A must-see. Four
|
||||
stars.
|
||||
|
||||
09/04/2000 - Nano 0.9.17, the Labor Day release, is released after a
|
||||
quiet spell (almost an entire month since last release!)
|
||||
New features include better (not yet perfect) binary
|
||||
display support and toggle support for most of the program
|
||||
flags (M-c, M-i, M-z, M-x, M-p, M-w, M-m, M-k and M-e for
|
||||
-c, -i, -x, -p, -w, -k, and -R).
|
||||
|
||||
08/09/2000 - Nano 0.9.16, after some struggling, is release. This release
|
||||
should fix a few of the holes that 0.9.15 dug. The
|
||||
"cutting text on the first line" bug is fixed, as is the
|
||||
"cutting text on the last line" bug. Nice symmetry there
|
||||
huh? Also the --tabsize argument should now work as well
|
||||
as by using -T.
|
||||
|
||||
08/03/2000 - Nano 0.9.15 is the "I cant think of a release description"
|
||||
release. There are the usual gala of display bugfixes,
|
||||
a for the the nasty bug in -k mode that could create a
|
||||
loop in the file being edited, and some other code
|
||||
cleanup. Also, the -T option should now work regardless
|
||||
of the curses library used. Yay.
|
||||
|
||||
07/27/2000 - Nano 0.9.14 is officially the "13 is so unlucky it should
|
||||
be skipped as a version number" release. One typo
|
||||
caused unending problems (calling nano with either -t or
|
||||
@@ -243,3 +281,5 @@
|
||||
http://faculty.plattsburgh.edu/astyanax/nano. Please
|
||||
update your bookmarks, tell your friends, and all that
|
||||
jazz.
|
||||
|
||||
$Id$
|
||||
|
||||
6
README
6
README
@@ -39,7 +39,7 @@ How to compile and install nano
|
||||
|
||||
Web Page
|
||||
|
||||
http://www.asty.org/nano
|
||||
http://www.nano-editor.org
|
||||
|
||||
Mailing List and Bug Reports
|
||||
|
||||
@@ -54,7 +54,7 @@ Mailing List and Bug Reports
|
||||
with a subject of "subscribe", where <name> is the list you want to
|
||||
subscribe to.
|
||||
For general bug reports, send a description of the problem to
|
||||
nano@asty.org or directly to the development list.
|
||||
nano@nano-editor.org or directly to the development list.
|
||||
|
||||
Current Status
|
||||
|
||||
@@ -80,3 +80,5 @@ Current Status
|
||||
can guess, I'm not much of an emacs fan ;)
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
|
||||
$Id$
|
||||
|
||||
9
TODO
9
TODO
@@ -2,7 +2,7 @@ TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Current Version:
|
||||
- Implement Spelling [DONE, mostly...]
|
||||
- Implement Spelling [DONE]
|
||||
- Implement Help [DONE]
|
||||
- Internationalization [In progress, translators welcome!]
|
||||
- Allow nano to be resized in X. [DONE]
|
||||
@@ -11,9 +11,16 @@ Current Version:
|
||||
- Rewrite edit_refresh, if at all possible [DONE]
|
||||
- Implement justify function [DONE]
|
||||
- Cut to end of line [DONE]
|
||||
- Unjustify command (^U after ^J)
|
||||
- Built-in speller command [needed for version 1.0]
|
||||
- Better statusbar interaction (scrolling, tab completion for filename)
|
||||
[needed for version 1.0]
|
||||
|
||||
|
||||
For Next Version:
|
||||
- Undo/Redo key?
|
||||
- single line scroll up/down?
|
||||
- Color syntax highlighting? (certainly seems like there's a demand for it.)
|
||||
- .nanorc ?????
|
||||
|
||||
$Id$
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* $Id$ */
|
||||
|
||||
/* Define this if you have the wresize function in your ncurses-type library */
|
||||
#undef HAVE_WRESIZE
|
||||
|
||||
@@ -22,5 +24,3 @@
|
||||
/* Define to use the slang wrappers for curses instead of native curses */
|
||||
#undef USE_SLANG
|
||||
|
||||
/* Define this if you have a behaving TABSIZE global in your curses lib */
|
||||
#undef HAVE_TABSIZE
|
||||
|
||||
@@ -76,9 +76,6 @@
|
||||
/* Define to use the slang wrappers for curses instead of native curses */
|
||||
#undef USE_SLANG
|
||||
|
||||
/* Define this if you have a behaving TABSIZE global in your curses lib */
|
||||
#undef HAVE_TABSIZE
|
||||
|
||||
/* Define if you have the __argz_count function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
||||
@@ -157,6 +154,9 @@
|
||||
/* Define if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_H
|
||||
|
||||
/* Define if you have the <regex.h> header file. */
|
||||
#undef HAVE_REGEX_H
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
|
||||
117
configure.in
117
configure.in
@@ -1,6 +1,7 @@
|
||||
# $Id$
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(nano.c)
|
||||
AM_INIT_AUTOMAKE(nano, 0.9.14)
|
||||
AM_INIT_AUTOMAKE(nano, 0.9.19)
|
||||
AM_CONFIG_HEADER(config.h:config.h.in)
|
||||
ALL_LINGUAS="es de fr it id fi"
|
||||
|
||||
@@ -10,7 +11,7 @@ AC_ISC_POSIX
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h)
|
||||
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h regex.h)
|
||||
|
||||
dnl options
|
||||
AC_ARG_ENABLE(tiny,
|
||||
@@ -25,44 +26,78 @@ CURSES_LIB_NAME=""
|
||||
AC_ARG_WITH(slang,
|
||||
[ --with-slang[=DIR] Use the slang library instead of curses],
|
||||
[ case "$with_slang" in
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_CHECK_LIB(slang, SLcurses_newwin,
|
||||
[AC_DEFINE(USE_SLANG) slang_support=yes
|
||||
CURSES_LIB="-lslang" CURSES_LIB_NAME=slang]),
|
||||
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
|
||||
]))
|
||||
;;
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
|
||||
# Needed for AC_CHECK_HEADERS and AC_CHECK_LIB to look at
|
||||
# alternate readline path
|
||||
_ldflags=${LDFLAGS}
|
||||
_cppflags=${CPPFLAGS}
|
||||
|
||||
# Add additional search path
|
||||
LDFLAGS="-L$with_slang/lib $LDFLAGS"
|
||||
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
|
||||
if test "$with_slang" != "yes"; then
|
||||
# Add additional search path
|
||||
LDFLAGS="-L$with_slang/lib $LDFLAGS"
|
||||
CPPFLAGS="-I$with_slang/include $CPPFLAGS"
|
||||
fi
|
||||
|
||||
AC_CHECK_HEADER(slcurses.h,
|
||||
AC_CHECK_LIB(slang, SLcurses_newwin,
|
||||
[AC_DEFINE(USE_SLANG) slang_support=yes
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang"
|
||||
CURSES_LIB_NAME=slang],
|
||||
AC_MSG_ERROR([
|
||||
*** The slang library was not found or the version you have installed
|
||||
*** is incorrect.
|
||||
])),
|
||||
AC_MSG_CHECKING(for SLtt_initialize in -lslang)
|
||||
_libs=$LIBS
|
||||
LIBS="$LIBS -lslang"
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <slcurses.h>
|
||||
int main () { SLtt_initialize (NULL); return 0; }],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG)
|
||||
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 SLtt_initialize in -lslang $tcap)
|
||||
LIBS="$LIBS $tcap"
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <slcurses.h>
|
||||
int main () { SLtt_initialize (NULL); return 0; }],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG)
|
||||
slang_support=yes
|
||||
if test "$with_slang" != "yes"; then
|
||||
CURSES_LIB="-L${with_slang}/lib -lslang $tcap"
|
||||
else
|
||||
CURSES_LIB="-lslang $tcap"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang], [
|
||||
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 <stdio.h>
|
||||
#include <slcurses.h>
|
||||
int main () { SLtt_initialize (NULL); return 0; }],
|
||||
[AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(USE_SLANG)
|
||||
slang_support=yes
|
||||
if test "$with_slang" != "yes"; 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
|
||||
@@ -70,9 +105,13 @@ AC_ARG_WITH(slang,
|
||||
*** do not call the configure script with --with-slang
|
||||
]))
|
||||
|
||||
LDFLAGS=${_ldflags}
|
||||
test "${_libs+set}" = "set" && LIBS=$_libs
|
||||
|
||||
if test "$with_slang" != "yes"; then
|
||||
LDFLAGS=${_ldflags}
|
||||
fi
|
||||
;;
|
||||
esac])
|
||||
esac], AC_MSG_RESULT(no))
|
||||
|
||||
dnl Checks for functions
|
||||
AC_CHECK_FUNCS(snprintf vsnprintf)
|
||||
@@ -101,9 +140,7 @@ dnl Checks for libraries.
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_HEADERS(curses.h ncurses.h)
|
||||
AC_CHECK_LIB(ncurses, tgetent,[CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses
|
||||
dnl Only ncurses seems to have a working TABSIZE function.
|
||||
AC_DEFINE(HAVE_TABSIZE)])
|
||||
AC_CHECK_LIB(ncurses, tgetent,CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses)
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
@@ -111,6 +148,12 @@ then
|
||||
AC_CHECK_LIB(curses, tgetent, CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses)
|
||||
fi
|
||||
|
||||
# Fallback for PDCurses and less useful curses libs...
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, initscr, CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses)
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(termcap, tgetent, CURSES_LIB="-ltermcap" CURSES_LIB_NAME=termcap)
|
||||
|
||||
46
cut.c
46
cut.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* cut.c *
|
||||
* *
|
||||
@@ -97,8 +98,7 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
free(top->data);
|
||||
top->data = tmpstr;
|
||||
|
||||
bot->data[bot_x] = 0;
|
||||
align(&bot->data);
|
||||
null_at(bot->data, bot_x);
|
||||
next = bot->next;
|
||||
|
||||
/* We explicitly don't decrement totlines here because we don't snarf
|
||||
@@ -123,8 +123,8 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
|
||||
filebot = top;
|
||||
}
|
||||
}
|
||||
if (top->lineno < edittop->lineno)
|
||||
edit_update(top);
|
||||
if (top->lineno < edittop->lineno)
|
||||
edit_update(top, CENTER);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -136,6 +136,7 @@ int do_cut_text(void)
|
||||
int newsize, cuttingtoend = 0;
|
||||
#endif
|
||||
|
||||
check_statblank();
|
||||
if (fileptr == NULL || fileptr->data == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -149,6 +150,11 @@ int do_cut_text(void)
|
||||
fprintf(stderr, _("Blew away cutbuffer =)\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Must let cutbuffer get blown away first before we do this... */
|
||||
if (fileptr == filebot && !ISSET(MARK_ISSET))
|
||||
return 0;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
if (current_x == strlen(current->data))
|
||||
@@ -208,7 +214,7 @@ int do_cut_text(void)
|
||||
if (cuttingtoend)
|
||||
edit_refresh();
|
||||
else
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
|
||||
return 1;
|
||||
#else
|
||||
@@ -224,8 +230,8 @@ int do_cut_text(void)
|
||||
totsize--; /* get the newline */
|
||||
totlines--;
|
||||
fileptr->prev = NULL;
|
||||
edit_update(fileage);
|
||||
current = fileptr;
|
||||
edit_update(fileage, CENTER);
|
||||
} else {
|
||||
add_to_cutbuffer(fileptr);
|
||||
fileage = make_new_node(NULL);
|
||||
@@ -242,18 +248,8 @@ int do_cut_text(void)
|
||||
current = fileptr->next;
|
||||
totlines--;
|
||||
totsize--; /* get the newline */
|
||||
} else {
|
||||
/* we're deleteing the last line
|
||||
and replacing it with a dummy line,
|
||||
so totlines is the same */
|
||||
tmp = fileptr->prev;
|
||||
tmp->next = make_new_node(tmp);
|
||||
tmp = tmp->next;
|
||||
tmp->data = nmalloc(1);
|
||||
strcpy(tmp->data, "");
|
||||
current = tmp;
|
||||
filebot = tmp;
|
||||
}
|
||||
} /* No longer an else here, because we never get here anymore...
|
||||
No need to cut the magic line, as it's empty */
|
||||
|
||||
add_to_cutbuffer(fileptr);
|
||||
}
|
||||
@@ -285,6 +281,7 @@ int do_uncut_text(void)
|
||||
int i;
|
||||
|
||||
wrap_reset();
|
||||
check_statblank();
|
||||
if (cutbuffer == NULL || fileptr == NULL)
|
||||
return 0; /* AIEEEEEEEEEEEE */
|
||||
|
||||
@@ -356,7 +353,7 @@ int do_uncut_text(void)
|
||||
|
||||
current = newend;
|
||||
if (i <= newend->lineno)
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
}
|
||||
|
||||
/* If marked cut == 2, that means that we're doing a cut to end
|
||||
@@ -368,11 +365,8 @@ int do_uncut_text(void)
|
||||
tmp = make_new_node(current);
|
||||
tmp->data = nmalloc(strlen(¤t->data[current_x]) + 1);
|
||||
strcpy(tmp->data, ¤t->data[current_x]);
|
||||
tmp->next = current->next;
|
||||
current->next = tmp;
|
||||
tmp->prev = current;
|
||||
current->data[current_x] = 0;
|
||||
current->data = nrealloc(current->data, strlen(current->data) + 1);
|
||||
splice_node(current, tmp, current->next);
|
||||
null_at(current->data, current_x);
|
||||
current = current->next;
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
@@ -410,8 +404,8 @@ int do_uncut_text(void)
|
||||
|
||||
i = editbot->lineno;
|
||||
renumber(newbuf);
|
||||
if (i < newend->lineno)
|
||||
edit_update(fileptr);
|
||||
if (i < newend->lineno)
|
||||
edit_update(fileptr, CENTER);
|
||||
|
||||
dump_buffer_reverse(fileptr);
|
||||
|
||||
|
||||
34
faq.html
34
faq.html
@@ -118,7 +118,8 @@ will volunteer to maintain this FAQ someday, who knows...</font></blockquote>
|
||||
<a NAME="1.2"></a><font color="#330000">1.2. How do I contribute to it?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Your best bet is to send it to the nano
|
||||
email address, <a href="mailto:nano@asty.org">nano@asty.org</a> and if
|
||||
email address, <a
|
||||
href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if
|
||||
it is useful enough it will be included in future versions.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -183,7 +184,7 @@ nano was developed).</font></blockquote>
|
||||
of nano?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The current version of nano *should*
|
||||
be 0.9.14. Of course you should always check the nano hompage to
|
||||
be 0.9.19. Of course you should always check the nano hompage to
|
||||
see what the latest and greatest version is.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -191,7 +192,7 @@ see what the latest and greatest version is.</font></blockquote>
|
||||
without having to download the program!</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Jeez, demanding, aren't we?
|
||||
Okay, look <a href="http://www.asty.org/nano/dist/nano.1.html">here</a>.</font></blockquote>
|
||||
Okay, look <a href="http://www.nano-editor.org/dist/nano.1.html">here</a>.</font></blockquote>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
@@ -205,13 +206,13 @@ nano.</font></h2>
|
||||
at the following fine web and ftp sites:</font>
|
||||
<ul>
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.asty.org/nano/dist">http://www.asty.org/nano/dist</a></font></li>
|
||||
<font color="#330000"><a href="http://www.nano-editor.org/dist">http://www.nano-editor.org/dist</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.ewtoo.org/~astyanax/nano/dist">http://www.ewtoo.org/~astyanax/nano/dist</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://ftp.asty.org/pub/nano">ftp://ftp.asty.org/pub/nano</a></font></li>
|
||||
<font color="#330000"><a href="ftp://ftp.nano-editor.org/pub/nano">ftp://ftp.nano-editor.org/pub/nano</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://nano.sourceforge.net/pub/nano/">ftp://nano.sourceforge.net/pub/nano</a></font></li>
|
||||
@@ -225,13 +226,13 @@ packages.</font></h2>
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.asty.org/nano/dist/RPMS">http://www.asty.org/nano/dist/RPMS</a></font></li>
|
||||
<font color="#330000"><a href="http://www.nano-editor.org/dist/RPMS">http://www.nano-editor.org/dist/RPMS</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.ewtoo.org/~astyanax/nano/dist/RPMS">http://www.ewtoo.org/~astyanax/nano/dist/RPMS</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://ftp.asty.org/pub/nano/RPMS">ftp://ftp.asty.org/pub/nano/RPMS</a></font></li>
|
||||
<font color="#330000"><a href="ftp://ftp.nano-editor.org/pub/nano/RPMS">ftp://ftp.nano-editor.org/pub/nano/RPMS</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://nano.sourceforge.net/pub/nano/RPMS">ftp://nano.sourceforge.net/pub/nano/RPMS</a></font></li>
|
||||
@@ -300,7 +301,7 @@ isn't hard. Unpack the nano source with a command like:</font>
|
||||
<p><b><font color="#330000">tar -zxvf nano-x.y.z.tar.gz</font></b>
|
||||
<p><font color="#330000">If you get error messages about the -z option,
|
||||
try this:</font>
|
||||
<p><b><font color="#330000">gunzip -d nano-x.y.z.tar.gz | tar xvf -</font></b>
|
||||
<p><b><font color="#330000">gzip -dc nano-x.y.z.tar.gz | tar xvf -</font></b>
|
||||
<p><font color="#330000">(again, where x.y.z is the version number in question).
|
||||
Then you need to run configure with any options you might want (if any).</font>
|
||||
<p><font color="#330000">The average case is this:</font>
|
||||
@@ -347,7 +348,7 @@ keystroke here>!</font></h2>
|
||||
<blockquote><font color="#330000">If you aren't trying some bizarre keystroke
|
||||
combination with some bizarre $TERM entry, chances are you have found a
|
||||
bug. You are welcome to submit it to the nano-devel list or
|
||||
to <a href="mailto:nano@asty.org">nano@asty.org</a>.</font></blockquote>
|
||||
to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.3"></a><font color="#330000">4.3. Nano crashes when I resize
|
||||
@@ -406,7 +407,7 @@ my language!</font></h2>
|
||||
language to write one =-). Just grab the <b>nano.pot</b> file from
|
||||
the latest and greatest nano distribution (it's in the <b>po/</b> directory)
|
||||
and translate each line into your native language on the <b>msgstr</b>
|
||||
line. Then send it to the nano devel list or <a href="mailto:nano@asty.org">nano@asty.org</a>.</font></blockquote>
|
||||
line. Then send it to the nano devel list or <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="5.2"></a><font color="#330000">5.2. I don't like the translation
|
||||
@@ -426,14 +427,14 @@ or the devel list.</font></blockquote>
|
||||
of Pico?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">There are many reasons to use nano instead
|
||||
of Pico, a more complete list can be found at the <a href="http://www.asty.org/nano">nano
|
||||
of Pico, a more complete list can be found at the <a href="http://www.nano-edior.org">nano
|
||||
homepage</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.2"></a><font color="#330000">6.2. Why should I use Pico instead
|
||||
of nano?</font></h2>
|
||||
|
||||
<blockquote>Again, check out the <a href="http://www.asty.org/nano">nano
|
||||
<blockquote>Again, check out the <a href="http://www.nano-editor.org">nano
|
||||
homepage</a> for a good summary of reasons. It really is a matter
|
||||
of personal preference as to which editor you should use. If you're
|
||||
the type of person who likes using the original version of a program, then
|
||||
@@ -473,7 +474,7 @@ also licensed under the GPL.</font></blockquote>
|
||||
their license?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">You're really not asking the right person
|
||||
here. I (Chris) waited along time to see if UW would change their
|
||||
here. I (Chris) waited a long time to see if UW would change their
|
||||
license because of the amount of high quality software being released and
|
||||
developed under the GPL without being taken advantage of by malicious corporate
|
||||
entities or other baddies, but no such luck so far.</font></blockquote>
|
||||
@@ -510,8 +511,8 @@ a given list:</font><font color="#330000"></font>
|
||||
team a big load of cash (or just a thank you).</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">That's fine. Send it <a href="mailto:nano-devel@lists.sourceforge.net">our
|
||||
way</a>! Better yet, fix a <a href="http://www.asty.org/nano/dist/BUGS">bug</a>
|
||||
in the program or implement a <a href="http://www.asty.org/nano/dist/TODO">cool
|
||||
way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/BUGS">bug</a>
|
||||
in the program or implement a <a href="http://www.nano-editor.org/dist/TODO">cool
|
||||
feature</a> and send us that instead (though cash is fine too).</font></blockquote>
|
||||
|
||||
<h2>
|
||||
@@ -541,6 +542,7 @@ and you should know the answer.</font></blockquote>
|
||||
<a NAME="8"></a>8. ChangeLog</h1>
|
||||
|
||||
<blockquote>06/31/2000 - Initial framework.</blockquote>
|
||||
|
||||
<P>
|
||||
$Id$
|
||||
</body>
|
||||
</html>
|
||||
|
||||
6
files.c
6
files.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* files.c *
|
||||
* *
|
||||
@@ -227,7 +228,8 @@ int open_file(char *filename, int insert, int quiet)
|
||||
} else { /* File is A-OK */
|
||||
if (S_ISDIR(fileinfo.st_mode)) {
|
||||
statusbar(_("File \"%s\" is a directory"), filename);
|
||||
new_file();
|
||||
if (!insert)
|
||||
new_file();
|
||||
return -1;
|
||||
}
|
||||
if (!quiet)
|
||||
@@ -261,7 +263,7 @@ int do_insertfile(void)
|
||||
|
||||
/* If we've gone off the bottom, recenter, otherwise just redraw */
|
||||
if (current->lineno > editbot->lineno)
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
else
|
||||
edit_refresh();
|
||||
|
||||
|
||||
72
global.c
72
global.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* global.c *
|
||||
* *
|
||||
@@ -38,7 +39,7 @@ int center_x = 0, center_y = 0; /* Center of screen */
|
||||
WINDOW *edit; /* The file portion of the editor */
|
||||
WINDOW *topwin; /* Top line of screen */
|
||||
WINDOW *bottomwin; /* Bottom buffer */
|
||||
char *filename; /* Name of the file */
|
||||
char filename[PATH_MAX]; /* Name of the file */
|
||||
int editwinrows = 0; /* How many rows long is the edit
|
||||
window? */
|
||||
filestruct *current; /* Current buffer pointer */
|
||||
@@ -53,13 +54,15 @@ filestruct *editbot = NULL; /* Same for the bottom */
|
||||
filestruct *filebot = NULL; /* Last node in the file struct */
|
||||
filestruct *cutbuffer = NULL; /* A place to store cut text */
|
||||
|
||||
char *answer; /* Answer str to many questions */
|
||||
char answer[132]; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
int totsize = 0; /* Total number of bytes in the file */
|
||||
int placewewant = 0; /* The collum we'd like the cursor
|
||||
to jump to when we go to the
|
||||
next or previous line */
|
||||
|
||||
int tabsize = 8; /* Our internal tabsize variable */
|
||||
|
||||
char *hblank; /* A horizontal blank line */
|
||||
char *help_text; /* The text in the help window */
|
||||
|
||||
@@ -75,12 +78,15 @@ shortcut goto_list[GOTO_LIST_LEN];
|
||||
shortcut writefile_list[WRITEFILE_LIST_LEN];
|
||||
shortcut help_list[HELP_LIST_LEN];
|
||||
shortcut spell_list[SPELL_LIST_LEN];
|
||||
toggle toggles[TOGGLE_LEN];
|
||||
|
||||
/* Regular expressions */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
regex_t search_regexp; /* Global to store compiled search regexp */
|
||||
regmatch_t regmatches[10]; /* Match positions for parenthetical
|
||||
subexpressions, max of 10 */
|
||||
#endif
|
||||
|
||||
/* Initialize a struct *without* our lovely braces =( */
|
||||
void sc_init_one(shortcut * s, int key, char *desc, char *help, int alt,
|
||||
@@ -96,6 +102,56 @@ void sc_init_one(shortcut * s, int key, char *desc, char *help, int alt,
|
||||
s->func = func;
|
||||
}
|
||||
|
||||
/* Initialize the toggles in the same manner */
|
||||
void toggle_init_one(toggle * t, int val, char *desc, int flag)
|
||||
{
|
||||
t->val = val;
|
||||
t->desc = desc;
|
||||
t->flag = flag;
|
||||
}
|
||||
|
||||
void toggle_init(void)
|
||||
{
|
||||
#ifndef NANO_SMALL
|
||||
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
|
||||
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
|
||||
*toggle_cuttoend_msg, *toggle_regexp_msg, *toggle_wrap_msg;
|
||||
|
||||
toggle_const_msg = _("Constant cursor position");
|
||||
toggle_autoindent_msg = _("Auto indent");
|
||||
toggle_suspend_msg = _("Suspend");
|
||||
toggle_nohelp_msg = _("Help mode");
|
||||
toggle_picomode_msg = _("Pico messages");
|
||||
toggle_mouse_msg = _("Mouse support");
|
||||
toggle_cuttoend_msg = _("Cut to end");
|
||||
#ifdef HAVE_REGEX_H
|
||||
toggle_regexp_msg = _("Regular expressions");
|
||||
#endif
|
||||
toggle_wrap_msg = _("Auto wrap");
|
||||
|
||||
toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg,
|
||||
CONSTUPDATE);
|
||||
toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY, toggle_autoindent_msg,
|
||||
AUTOINDENT);
|
||||
toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg,
|
||||
SUSPEND);
|
||||
toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg,
|
||||
NO_HELP);
|
||||
toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg,
|
||||
PICO_MSGS);
|
||||
toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg,
|
||||
NO_WRAP);
|
||||
toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg,
|
||||
USE_MOUSE);
|
||||
toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
|
||||
CUT_TO_END);
|
||||
#ifdef HAVE_REGEX_H
|
||||
toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
|
||||
USE_REGEXP);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void shortcut_init(void)
|
||||
{
|
||||
char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg = "",
|
||||
@@ -147,10 +203,9 @@ void shortcut_init(void)
|
||||
nano_cancel_msg = _("Cancel the current function");
|
||||
#endif
|
||||
|
||||
|
||||
if (ISSET(PICO_MSGS))
|
||||
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
|
||||
nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
|
||||
else
|
||||
sc_init_one(&main_list[0], NANO_WRITEOUT_KEY, _("WriteOut"),
|
||||
nano_writeout_msg,
|
||||
@@ -170,7 +225,8 @@ void shortcut_init(void)
|
||||
|
||||
if (ISSET(PICO_MSGS))
|
||||
sc_init_one(&main_list[3], NANO_JUSTIFY_KEY, _("Justify"),
|
||||
nano_justify_msg, 0, 0, 0, NOVIEW, do_justify);
|
||||
nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
|
||||
NOVIEW, do_justify);
|
||||
else
|
||||
sc_init_one(&main_list[3], NANO_REPLACE_KEY, _("Replace"),
|
||||
nano_replace_msg,
|
||||
@@ -248,7 +304,8 @@ void shortcut_init(void)
|
||||
NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
|
||||
else
|
||||
sc_init_one(&main_list[23], NANO_JUSTIFY_KEY, _("Justify"),
|
||||
nano_justify_msg, 0, 0, 0, NOVIEW, do_justify);
|
||||
nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
|
||||
NOVIEW, do_justify);
|
||||
|
||||
sc_init_one(&main_list[24], NANO_ENTER_KEY, _("Enter"),
|
||||
nano_enter_msg,
|
||||
@@ -260,7 +317,7 @@ void shortcut_init(void)
|
||||
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
|
||||
else
|
||||
sc_init_one(&main_list[25], NANO_HELP_KEY, _("Get Help"),
|
||||
nano_help_msg, 0, 0, 0, VIEW, do_help);
|
||||
nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
|
||||
|
||||
|
||||
sc_init_one(&whereis_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
|
||||
@@ -337,4 +394,5 @@ void shortcut_init(void)
|
||||
sc_init_one(&spell_list[1], NANO_CANCEL_KEY, _("Cancel"),
|
||||
nano_cancel_msg, 0, 0, 0, VIEW, 0);
|
||||
|
||||
toggle_init();
|
||||
}
|
||||
|
||||
31
move.c
31
move.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* move.c *
|
||||
* *
|
||||
@@ -35,12 +36,12 @@
|
||||
void page_down_center(void)
|
||||
{
|
||||
if (editbot != filebot) {
|
||||
edit_update(editbot->next);
|
||||
edit_update(editbot->next, CENTER);
|
||||
center_cursor();
|
||||
} else {
|
||||
while (current != filebot)
|
||||
current = current->next;
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
}
|
||||
update_cursor();
|
||||
}
|
||||
@@ -54,15 +55,22 @@ int page_down(void)
|
||||
if (current == filebot)
|
||||
return 0;
|
||||
|
||||
if (editbot != filebot) {
|
||||
if (editbot != filebot || edittop == fileage) {
|
||||
current_y = 0;
|
||||
current = editbot;
|
||||
edit_update_top(current);
|
||||
} else
|
||||
current = editbot;
|
||||
|
||||
if (current->prev != NULL)
|
||||
current = current->prev;
|
||||
if (current->prev != NULL)
|
||||
current = current->prev;
|
||||
edit_update(current, TOP);
|
||||
} else {
|
||||
while (current != filebot) {
|
||||
current = current->next;
|
||||
current_y++;
|
||||
}
|
||||
edit_update(edittop, TOP);
|
||||
}
|
||||
|
||||
update_cursor();
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
@@ -121,7 +129,7 @@ int do_down(void)
|
||||
void page_up_center(void)
|
||||
{
|
||||
if (edittop != fileage) {
|
||||
edit_update(edittop);
|
||||
edit_update(edittop, CENTER);
|
||||
center_cursor();
|
||||
} else
|
||||
current_y = 0;
|
||||
@@ -132,6 +140,7 @@ void page_up_center(void)
|
||||
|
||||
int page_up(void)
|
||||
{
|
||||
filestruct *fileptr = edittop;
|
||||
wrap_reset();
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
@@ -140,7 +149,13 @@ int page_up(void)
|
||||
return 0;
|
||||
|
||||
current_y = 0;
|
||||
edit_update_bot(edittop);
|
||||
if (fileptr->next != NULL)
|
||||
fileptr = fileptr->next;
|
||||
if (fileptr->next != NULL)
|
||||
fileptr = fileptr->next;
|
||||
|
||||
current = edittop;
|
||||
edit_update(fileptr, BOTTOM);
|
||||
update_cursor();
|
||||
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
|
||||
11
nano.1
11
nano.1
@@ -2,7 +2,7 @@
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH NANO 1 "January 4, 2000"
|
||||
.TH NANO 1 "July 28, 2000"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
@@ -40,7 +40,7 @@ number".
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-T (\-\-tabsize)
|
||||
Set the size (width) of a tab, if supported by your curses library.
|
||||
Set the size (width) of a tab.
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Enable regular expression matching for search strings, as well as
|
||||
@@ -55,6 +55,9 @@ Display a summary of commandline options.
|
||||
.B \-c (\-\-const)
|
||||
Constantly show the cursor position.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indent new lines to the previous line's indentation. Useful when editing
|
||||
source code.
|
||||
@@ -91,13 +94,13 @@ Enable suspend ability.
|
||||
Places cursor at LINE on startup.
|
||||
.SH BUGS
|
||||
Please send any comments or bug reports to
|
||||
.B nano@asty.org.
|
||||
.B nano@nano-editor.org.
|
||||
The nano mailing list is available from
|
||||
.B nano-devel@lists.sourceforge.net.
|
||||
To subscribe, email to nano-devel-request@lists.sourceforge.net with a
|
||||
subject of "subscribe".
|
||||
.SH HOMEPAGE
|
||||
http://www.asty.org/nano
|
||||
http://www.nano-editor.org
|
||||
.SH AUTHOR
|
||||
Chris Allegretta <chrisa@asty.org>, et al. This manual page was
|
||||
originally written by Jordi Mallach <jordi@sindominio.net>, for the Debian
|
||||
|
||||
14
nano.1.html
14
nano.1.html
@@ -3,7 +3,7 @@ Content-type: text/html
|
||||
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
|
||||
</HEAD><BODY>
|
||||
<H1>NANO</H1>
|
||||
Section: User Commands (1)<BR>Updated: January 4, 2000<BR><A HREF="#index">Index</A>
|
||||
Section: User Commands (1)<BR>Updated: July 28, 2000<BR><A HREF="#index">Index</A>
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ number".
|
||||
<DT><B>-T (--tabsize)</B>
|
||||
|
||||
<DD>
|
||||
Set the size (width) of a tab, if supported by your curses library.
|
||||
Set the size (width) of a tab.
|
||||
<DT><B>-R (--regexp)</B>
|
||||
|
||||
<DD>
|
||||
@@ -77,6 +77,10 @@ Display a summary of commandline options.
|
||||
|
||||
<DD>
|
||||
Constantly show the cursor position.
|
||||
<DT><B>-k (--cut)</B>
|
||||
|
||||
<DD>
|
||||
Enable cut from cursor to end of line with ^K.
|
||||
<DT><B>-i (--autoindent)</B>
|
||||
|
||||
<DD>
|
||||
@@ -128,7 +132,7 @@ Places cursor at LINE on startup.
|
||||
<H2>BUGS</H2>
|
||||
|
||||
Please send any comments or bug reports to
|
||||
<B><A HREF="mailto:nano@asty.org">nano@asty.org</A>.</B>
|
||||
<B><A HREF="mailto:nano@nano-editor.org">nano@nano-editor.org</A>.</B>
|
||||
|
||||
The nano mailing list is available from
|
||||
<B><A HREF="mailto:nano-devel@lists.sourceforge.net">nano-devel@lists.sourceforge.net</A>.</B>
|
||||
@@ -138,7 +142,7 @@ subject of "subscribe".
|
||||
<A NAME="lbAG"> </A>
|
||||
<H2>HOMEPAGE</H2>
|
||||
|
||||
<A HREF="http://www.asty.org/nano">http://www.asty.org/nano</A>
|
||||
<A HREF="http://www.nano-editor.org">http://www.nano-editor.org</A>
|
||||
<A NAME="lbAH"> </A>
|
||||
<H2>AUTHOR</H2>
|
||||
|
||||
@@ -162,6 +166,6 @@ GNU/Linux system (but may be used by others).
|
||||
This document was created by
|
||||
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
|
||||
using the manual pages.<BR>
|
||||
Time: 04:20:00 GMT, July 07, 2000
|
||||
Time: 17:29:02 GMT, July 28, 2000
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
564
nano.c
564
nano.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* nano.c *
|
||||
* *
|
||||
@@ -58,13 +59,12 @@
|
||||
#endif
|
||||
|
||||
/* Former globals, now static */
|
||||
char *last_search = "\0"; /* Last string we searched for */
|
||||
char *last_replace = "\0"; /* Last replacement string */
|
||||
int fill = 0; /* Fill - where to wrap lines, basically */
|
||||
static char *alt_speller; /* Alternative spell command */
|
||||
struct termios oldterm; /* The user's original term settings */
|
||||
static char *help_text_init = "";
|
||||
/* Initial message, not including shortcuts */
|
||||
static struct sigaction act; /* For all out fun signal handlers */
|
||||
|
||||
/* What we do when we're all set to exit */
|
||||
RETSIGTYPE finish(int sigage)
|
||||
@@ -147,10 +147,6 @@ void global_init(void)
|
||||
for (i = 0; i <= COLS - 1; i++)
|
||||
hblank[i] = ' ';
|
||||
hblank[i] = 0;
|
||||
last_search = nmalloc(132);
|
||||
last_replace = nmalloc(132);
|
||||
answer = nmalloc(132);
|
||||
|
||||
}
|
||||
|
||||
void init_help_msg(void)
|
||||
@@ -170,9 +166,11 @@ void init_help_msg(void)
|
||||
"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. Alt-key "
|
||||
"sequences are notated with an at (@) symbol. The following "
|
||||
"keystrokes are available in the main editor window. "
|
||||
"sequences are notated with a caret (^) symbol and are entered "
|
||||
"with the Control (Ctrl) key. 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. The "
|
||||
"following keystrokes are available in the main editor window. "
|
||||
"Optional keys are shown in parentheses:\n\n");
|
||||
#endif
|
||||
|
||||
@@ -307,16 +305,21 @@ void align(char **strp)
|
||||
*strp = nrealloc(*strp, strlen(*strp) + 1);
|
||||
}
|
||||
|
||||
/* Null a string at a certain index and align it */
|
||||
void null_at(char *data, int index)
|
||||
{
|
||||
data[index] = 0;
|
||||
align(&data);
|
||||
}
|
||||
|
||||
void usage(void)
|
||||
{
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
printf(_("Usage: nano [GNU long option] [option] +LINE <file>\n\n"));
|
||||
printf(_("Option Long option Meaning\n"));
|
||||
#ifdef HAVE_TABSIZE
|
||||
printf(_
|
||||
(" -T --tabsize=[num] Set width of a tab to num\n"));
|
||||
#endif
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
printf(_
|
||||
(" -R --regexp Use regular expressions for search\n"));
|
||||
#endif
|
||||
@@ -334,7 +337,7 @@ void usage(void)
|
||||
printf(_
|
||||
(" -i --autoindent Automatically indent new lines\n"));
|
||||
printf(_
|
||||
(" -l --nofollow Don't follow symbolic links, overwrite.\n"));
|
||||
(" -l --nofollow Don't follow symbolic links, overwrite\n"));
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
printf(_(" -m --mouse Enable mouse\n"));
|
||||
@@ -362,9 +365,7 @@ void usage(void)
|
||||
#else
|
||||
printf(_("Usage: nano [option] +LINE <file>\n\n"));
|
||||
printf(_("Option Meaning\n"));
|
||||
#ifdef HAVE_TABSIZE
|
||||
printf(_(" -T [num] Set width of a tab to num\n"));
|
||||
#endif
|
||||
printf(_(" -R Use regular expressions for search\n"));
|
||||
printf(_(" -V Print version information and exit\n"));
|
||||
printf(_(" -c Constantly show cursor position\n"));
|
||||
@@ -374,7 +375,7 @@ void usage(void)
|
||||
#endif
|
||||
printf(_(" -i Automatically indent new lines\n"));
|
||||
printf(_
|
||||
(" -l Don't follow symbolic links, overwrite.\n"));
|
||||
(" -l Don't follow symbolic links, overwrite\n"));
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
printf(_(" -m Enable mouse\n"));
|
||||
@@ -398,7 +399,7 @@ void version(void)
|
||||
{
|
||||
printf(_(" nano version %s by Chris Allegretta (compiled %s, %s)\n"),
|
||||
VERSION, __TIME__, __DATE__);
|
||||
printf(_(" Email: nano@asty.org Web: http://www.asty.org/nano\n"));
|
||||
printf(_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org\n"));
|
||||
}
|
||||
|
||||
filestruct *make_new_node(filestruct * prevnode)
|
||||
@@ -417,6 +418,16 @@ filestruct *make_new_node(filestruct * prevnode)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* Splice a node into an existing filestruct */
|
||||
void splice_node(filestruct *begin, filestruct *new, filestruct *end)
|
||||
{
|
||||
new->next = end;
|
||||
new->prev = begin;
|
||||
begin->next = new;
|
||||
if (end != NULL)
|
||||
end->prev = new;
|
||||
}
|
||||
|
||||
int do_mark()
|
||||
{
|
||||
#ifdef NANO_SMALL
|
||||
@@ -510,15 +521,11 @@ int do_enter(filestruct * inptr)
|
||||
}
|
||||
*tmp = 0;
|
||||
|
||||
new->next = inptr->next;
|
||||
new->prev = inptr;
|
||||
inptr->next = new;
|
||||
if (new->next != NULL)
|
||||
new->next->prev = new;
|
||||
else {
|
||||
if (inptr->next == NULL) {
|
||||
filebot = new;
|
||||
editbot = new;
|
||||
}
|
||||
splice_node(inptr, new, inptr->next);
|
||||
|
||||
totsize++;
|
||||
renumber(current);
|
||||
@@ -532,7 +539,7 @@ int do_enter(filestruct * inptr)
|
||||
* where we think the cursor is.
|
||||
*/
|
||||
if (current_y == editwinrows - 1) {
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
reset_cursor();
|
||||
} else {
|
||||
current_y++;
|
||||
@@ -588,7 +595,7 @@ void do_next_word(void)
|
||||
current_x = i;
|
||||
placewewant = xplustabs();
|
||||
if (current->lineno >= editbot->lineno)
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
|
||||
}
|
||||
|
||||
@@ -610,13 +617,14 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
assert(strlenpt(inptr->data) > fill);
|
||||
|
||||
for (i = 0, i_tabs = 0; i < len; i++, i_tabs++) {
|
||||
if (!isspace(inptr->data[i])) {
|
||||
if (!isspace((int) inptr->data[i])) {
|
||||
last_word_end = current_word_end;
|
||||
|
||||
current_word_start = i;
|
||||
current_word_start_t = i_tabs;
|
||||
|
||||
while (!isspace(inptr->data[i]) && inptr->data[i]) {
|
||||
while (!isspace((int) inptr->data[i])
|
||||
&& inptr->data[i]) {
|
||||
i++;
|
||||
i_tabs++;
|
||||
if (inptr->data[i] < 32)
|
||||
@@ -633,8 +641,8 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
}
|
||||
|
||||
if (inptr->data[i] == NANO_CONTROL_I) {
|
||||
if (i_tabs % TABSIZE != 0);
|
||||
i_tabs += TABSIZE - (i_tabs % TABSIZE);
|
||||
if (i_tabs % tabsize != 0);
|
||||
i_tabs += tabsize - (i_tabs % tabsize);
|
||||
}
|
||||
|
||||
if (current_word_end_t > fill)
|
||||
@@ -670,11 +678,11 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
temp = nmalloc(sizeof(filestruct));
|
||||
|
||||
/* Category 1a: one word taking up the whole line with no beginning spaces. */
|
||||
if ((last_word_end == -1) && (!isspace(inptr->data[0]))) {
|
||||
if ((last_word_end == -1) && (!isspace((int) inptr->data[0]))) {
|
||||
for (i = current_word_end; i < len; i++) {
|
||||
if (!isspace(inptr->data[i]) && i < len) {
|
||||
if (!isspace((int) inptr->data[i]) && i < len) {
|
||||
current_word_start = i;
|
||||
while (!isspace(inptr->data[i]) && (i < len)) {
|
||||
while (!isspace((int) inptr->data[i]) && (i < len)) {
|
||||
i++;
|
||||
}
|
||||
last_word_end = current_word_end;
|
||||
@@ -711,8 +719,7 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
down = 1;
|
||||
}
|
||||
|
||||
inptr->data = nrealloc(inptr->data, current_x + 1);
|
||||
inptr->data[current_x] = 0;
|
||||
null_at(inptr->data, current_x);
|
||||
|
||||
if (ISSET(MARK_ISSET) && (mark_beginbuf == inptr)) {
|
||||
mark_beginbuf = temp;
|
||||
@@ -729,9 +736,9 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
nmalloc(strlen(&inptr->data[current_word_start]) + 1);
|
||||
strcpy(temp->data, &inptr->data[current_word_start]);
|
||||
|
||||
if (!isspace(input_char)) {
|
||||
if (!isspace((int) input_char)) {
|
||||
i = current_word_start - 1;
|
||||
while (isspace(inptr->data[i])) {
|
||||
while (isspace((int) inptr->data[i])) {
|
||||
i--;
|
||||
assert(i >= 0);
|
||||
}
|
||||
@@ -756,15 +763,13 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
|
||||
right = current_x - current_word_start;
|
||||
i = current_word_start - 1;
|
||||
if (isspace(input_char) && (current_x == current_word_start)) {
|
||||
if (isspace((int)input_char) && (current_x == current_word_start)) {
|
||||
current_x = current_word_start;
|
||||
|
||||
inptr->data =
|
||||
nrealloc(inptr->data, current_word_start + 1);
|
||||
inptr->data[current_word_start] = 0;
|
||||
null_at(inptr->data, current_word_start);
|
||||
} else {
|
||||
|
||||
while (isspace(inptr->data[i])) {
|
||||
while (isspace((int) inptr->data[i])) {
|
||||
i--;
|
||||
assert(i >= 0);
|
||||
}
|
||||
@@ -786,7 +791,7 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
current_x = current_word_start;
|
||||
i = current_word_start - 1;
|
||||
|
||||
while (isspace(inptr->data[i])) {
|
||||
while (isspace((int) inptr->data[i])) {
|
||||
i--;
|
||||
assert(i >= 0);
|
||||
inptr->data = nrealloc(inptr->data, i + 2);
|
||||
@@ -812,18 +817,6 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
free(temp->data);
|
||||
free(temp);
|
||||
|
||||
|
||||
/* The next line line may need to be wrapped as well. */
|
||||
current_y = old_y + 1;
|
||||
current_x = strlen(inptr->next->data);
|
||||
while (current_x >= 0) {
|
||||
if (isspace(inptr->next->data[current_x])
|
||||
&& (current_x < fill)) break;
|
||||
current_x--;
|
||||
}
|
||||
if (current_x >= 0)
|
||||
check_wrap(inptr->next, ' ');
|
||||
|
||||
current_x = old_x;
|
||||
current_y = old_y;
|
||||
}
|
||||
@@ -849,7 +842,7 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
/* totsize++; */
|
||||
|
||||
renumber(inptr);
|
||||
edit_update_top(edittop);
|
||||
edit_update(edittop, TOP);
|
||||
|
||||
|
||||
/* Move the cursor to the new line if appropriate. */
|
||||
@@ -862,7 +855,7 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
do_right();
|
||||
}
|
||||
|
||||
edit_update_top(edittop);
|
||||
edit_update(edittop, TOP);
|
||||
reset_cursor();
|
||||
edit_refresh();
|
||||
}
|
||||
@@ -884,7 +877,7 @@ void check_wrap(filestruct * inptr, char ch)
|
||||
/* Do not wrap if there are no words on or after wrap point. */
|
||||
int char_found = 0;
|
||||
|
||||
while (isspace(inptr->data[i]) && inptr->data[i])
|
||||
while (isspace((int)inptr->data[i]) && inptr->data[i])
|
||||
i++;
|
||||
|
||||
if (!inptr->data[i])
|
||||
@@ -892,7 +885,7 @@ void check_wrap(filestruct * inptr, char ch)
|
||||
|
||||
/* String must be at least 1 character long. */
|
||||
for (i = strlen(inptr->data) - 1; i >= 0; i--) {
|
||||
if (isspace(inptr->data[i])) {
|
||||
if (isspace((int) inptr->data[i])) {
|
||||
if (!char_found)
|
||||
continue;
|
||||
char_found = 2; /* 2 for yes do wrap. */
|
||||
@@ -914,15 +907,6 @@ void do_early_abort(void)
|
||||
blank_statusbar_refresh();
|
||||
}
|
||||
|
||||
void delete_buffer(filestruct * inptr)
|
||||
{
|
||||
if (inptr != NULL) {
|
||||
delete_buffer(inptr->next);
|
||||
free(inptr->data);
|
||||
free(inptr);
|
||||
}
|
||||
}
|
||||
|
||||
int do_backspace(void)
|
||||
{
|
||||
filestruct *previous, *tmp;
|
||||
@@ -955,7 +939,7 @@ int do_backspace(void)
|
||||
current = previous->next;
|
||||
else
|
||||
current = previous;
|
||||
page_up();
|
||||
page_up_center();
|
||||
} else {
|
||||
if (previous->next)
|
||||
current = previous->next;
|
||||
@@ -1112,7 +1096,7 @@ int do_spell(void)
|
||||
free_filestruct(fileage);
|
||||
global_init();
|
||||
open_file(temp, 0, 1);
|
||||
edit_update(fileage);
|
||||
edit_update(fileage, CENTER);
|
||||
set_modified();
|
||||
exit_spell(temp, foo);
|
||||
statusbar(_("Finished checking spelling"));
|
||||
@@ -1157,6 +1141,7 @@ int do_exit(void)
|
||||
void do_mouse(void)
|
||||
{
|
||||
MEVENT mevent;
|
||||
int foo = 0, tab_found = 0;
|
||||
|
||||
if (getmouse(&mevent) == ERR)
|
||||
return;
|
||||
@@ -1199,6 +1184,23 @@ void do_mouse(void)
|
||||
}
|
||||
}
|
||||
current_x = mevent.x;
|
||||
placewewant = current_x;
|
||||
while(foo < current_x) {
|
||||
if(current->data[foo] == NANO_CONTROL_I) {
|
||||
current_x -= tabsize - (foo % tabsize);
|
||||
tab_found = 1;
|
||||
} else if(current->data[foo] & 0x80)
|
||||
;
|
||||
else if(current->data[foo] < 32)
|
||||
current_x--;
|
||||
foo++;
|
||||
}
|
||||
/* This is where tab_found comes in. I can't figure out why,
|
||||
* but without it any line with a tab will place the cursor
|
||||
* one character behind. Whatever, this fixes it. */
|
||||
if(tab_found == 1)
|
||||
current_x++;
|
||||
|
||||
if (current_x > strlen(current->data))
|
||||
current_x = strlen(current->data);
|
||||
|
||||
@@ -1216,6 +1218,29 @@ RETSIGTYPE handle_hup(int signal)
|
||||
finish(1);
|
||||
}
|
||||
|
||||
/* What do we do when we catch the suspend signal */
|
||||
RETSIGTYPE do_suspend(int signal)
|
||||
{
|
||||
|
||||
act.sa_handler = SIG_DFL;
|
||||
sigemptyset(&act.sa_mask);
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
|
||||
endwin();
|
||||
fprintf(stderr,"\n\n\n\n\nUse \"fg\" to return to nano\n");
|
||||
raise(SIGTSTP);
|
||||
}
|
||||
|
||||
/* Restore the suspend handler when we come back into the prog */
|
||||
RETSIGTYPE do_cont(int signal)
|
||||
{
|
||||
|
||||
act.sa_handler = do_suspend;
|
||||
sigemptyset(&act.sa_mask);
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
initscr();
|
||||
total_refresh();
|
||||
}
|
||||
|
||||
void handle_sigwinch(int s)
|
||||
{
|
||||
@@ -1273,7 +1298,7 @@ void handle_sigwinch(int s)
|
||||
fix_editbot();
|
||||
|
||||
if (current_y > editwinrows - 1) {
|
||||
edit_update(editbot);
|
||||
edit_update(editbot, CENTER);
|
||||
}
|
||||
erase();
|
||||
|
||||
@@ -1286,6 +1311,71 @@ void handle_sigwinch(int s)
|
||||
#endif
|
||||
}
|
||||
|
||||
void signal_init(void)
|
||||
{
|
||||
|
||||
/* Trap SIGINT and SIGQUIT cuz we want them to do useful things. */
|
||||
memset(&act, 0, sizeof(struct sigaction));
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigaction(SIGINT, &act, NULL);
|
||||
|
||||
if (!ISSET(SUSPEND)) {
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
act.sa_handler = do_suspend;
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
|
||||
act.sa_handler = do_cont;
|
||||
sigaction (SIGCONT, &act, NULL);
|
||||
}
|
||||
|
||||
|
||||
/* Trap SIGHUP cuz we want to write the file out. */
|
||||
act.sa_handler = handle_hup;
|
||||
sigaction(SIGHUP, &act, NULL);
|
||||
|
||||
act.sa_handler = handle_sigwinch;
|
||||
sigaction(SIGWINCH, &act, NULL);
|
||||
|
||||
}
|
||||
|
||||
void window_init(void)
|
||||
{
|
||||
editwinrows = LINES - 5 + no_help();
|
||||
|
||||
/* Setup up the main text window */
|
||||
edit = newwin(editwinrows, COLS, 2, 0);
|
||||
|
||||
/* And the other windows */
|
||||
topwin = newwin(2, COLS, 0, 0);
|
||||
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);\
|
||||
|
||||
}
|
||||
|
||||
void mouse_init(void)
|
||||
{
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
if (ISSET(USE_MOUSE)) {
|
||||
keypad(edit, TRUE);
|
||||
keypad(bottomwin, TRUE);
|
||||
|
||||
mousemask(BUTTON1_RELEASED, NULL);
|
||||
mouseinterval(50);
|
||||
|
||||
}
|
||||
else {
|
||||
mousemask(0, NULL);
|
||||
keypad(edit, FALSE);
|
||||
keypad(bottomwin, FALSE);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int do_tab(void)
|
||||
{
|
||||
do_char('\t');
|
||||
@@ -1296,7 +1386,7 @@ int do_tab(void)
|
||||
int empty_line(const char *data)
|
||||
{
|
||||
while (*data) {
|
||||
if (!isspace(*data))
|
||||
if (!isspace((int) *data))
|
||||
return 0;
|
||||
|
||||
data++;
|
||||
@@ -1308,7 +1398,7 @@ int empty_line(const char *data)
|
||||
int no_spaces(const char *data)
|
||||
{
|
||||
while (*data) {
|
||||
if (isspace(*data))
|
||||
if (isspace((int) *data))
|
||||
return 0;
|
||||
|
||||
data++;
|
||||
@@ -1324,7 +1414,7 @@ void justify_format(char *data)
|
||||
|
||||
/* Skip first character regardless and leading whitespace. */
|
||||
for (i = 1; i < len; i++) {
|
||||
if (!isspace(data[i]))
|
||||
if (!isspace((int) data[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1332,7 +1422,7 @@ void justify_format(char *data)
|
||||
|
||||
/* No double spaces allowed unless following a period. Tabs -> space. No double tabs. */
|
||||
for (; i < len; i++) {
|
||||
if (isspace(data[i]) && isspace(data[i - 1])
|
||||
if (isspace((int) data[i]) && isspace((int) data[i - 1])
|
||||
&& (data[i - 2] != '.')) {
|
||||
memmove(data + i, data + i + 1, len - i);
|
||||
len--;
|
||||
@@ -1365,7 +1455,7 @@ int do_justify(void)
|
||||
* or 2) A line following an empty line.
|
||||
*/
|
||||
while (current->prev != NULL) {
|
||||
if (isspace(current->data[0]) || !current->data[0])
|
||||
if (isspace((int) current->data[0]) || !current->data[0])
|
||||
break;
|
||||
|
||||
current = current->prev;
|
||||
@@ -1386,7 +1476,7 @@ int do_justify(void)
|
||||
|
||||
set_modified();
|
||||
/* Put the whole paragraph into one big line. */
|
||||
while (current->next && !isspace(current->next->data[0])
|
||||
while (current->next && !isspace((int) current->next->data[0])
|
||||
&& current->next->data[0]) {
|
||||
filestruct *tmpnode = current->next;
|
||||
int len = strlen(current->data);
|
||||
@@ -1425,7 +1515,7 @@ int do_justify(void)
|
||||
else
|
||||
i = slen;
|
||||
for (; i > 0; i--) {
|
||||
if (isspace(current->data[i]) &&
|
||||
if (isspace((int) current->data[i]) &&
|
||||
((strlenpt(current->data) - strlen(current->data +i)) <=
|
||||
fill)) break;
|
||||
}
|
||||
@@ -1470,7 +1560,7 @@ int do_justify(void)
|
||||
|
||||
if ((current_y < 0) || (current_y >= editwinrows - 1)
|
||||
|| (initial_y <= 0)) {
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
center_cursor();
|
||||
} else {
|
||||
fix_editbot();
|
||||
@@ -1498,6 +1588,11 @@ void help_init(void)
|
||||
if (main_list[i].help != NULL)
|
||||
allocsize += strlen(main_list[i].help) + 15;
|
||||
|
||||
/* And for the toggle list, we also allocate space for extra text. */
|
||||
for (i = 0; i <= TOGGLE_LEN - 1; i++)
|
||||
if (toggles[i].desc != NULL)
|
||||
allocsize += strlen(toggles[i].desc) + 30;
|
||||
|
||||
allocsize += strlen(help_text_init);
|
||||
|
||||
if (help_text != NULL)
|
||||
@@ -1510,7 +1605,7 @@ void help_init(void)
|
||||
strcpy(help_text, help_text_init);
|
||||
|
||||
/* Now add our shortcut info */
|
||||
for (i = 0; i < MAIN_LIST_LEN; i++) {
|
||||
for (i = 0; i < MAIN_LIST_LEN - 1; i++) {
|
||||
sofar = snprintf(buf, BUFSIZ, "^%c ", main_list[i].val + 64);
|
||||
|
||||
if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64))
|
||||
@@ -1520,38 +1615,102 @@ void help_init(void)
|
||||
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
|
||||
|
||||
if (main_list[i].altval > 0)
|
||||
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(@%c) ",
|
||||
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(M-%c) ",
|
||||
main_list[i].altval - 32);
|
||||
else
|
||||
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
|
||||
|
||||
|
||||
if (main_list[i].help != NULL)
|
||||
snprintf(&buf[sofar], BUFSIZ - sofar, "%s", main_list[i].help);
|
||||
|
||||
|
||||
strcat(help_text, buf);
|
||||
strcat(help_text, "\n");
|
||||
}
|
||||
|
||||
/* And the toggles... */
|
||||
for (i = 0; i <= TOGGLE_LEN - 1; i++) {
|
||||
sofar = snprintf(buf, BUFSIZ,
|
||||
"M-%c ", toggles[i].val - 32 );
|
||||
|
||||
if (toggles[i].desc != NULL)
|
||||
snprintf(&buf[sofar], BUFSIZ - sofar, _("%s enable/disable"),
|
||||
toggles[i].desc);
|
||||
|
||||
strcat(help_text, buf);
|
||||
strcat(help_text, "\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void do_toggle(int which)
|
||||
{
|
||||
#ifndef NANO_SMALL
|
||||
char *enabled = _("enabled");
|
||||
char *disabled = _("disabled");
|
||||
|
||||
if (ISSET(toggles[which].flag))
|
||||
UNSET(toggles[which].flag);
|
||||
else
|
||||
SET(toggles[which].flag);
|
||||
|
||||
switch (toggles[which].val) {
|
||||
case TOGGLE_PICOMODE_KEY:
|
||||
shortcut_init();
|
||||
display_main_list();
|
||||
break;
|
||||
case TOGGLE_SUSPEND_KEY:
|
||||
signal_init();
|
||||
break;
|
||||
case TOGGLE_MOUSE_KEY:
|
||||
mouse_init();
|
||||
break;
|
||||
case TOGGLE_NOHELP_KEY:
|
||||
wclear(bottomwin);
|
||||
wrefresh(bottomwin);
|
||||
window_init();
|
||||
edit_refresh();
|
||||
display_main_list();
|
||||
break;
|
||||
}
|
||||
|
||||
if (!ISSET(toggles[which].flag)) {
|
||||
if (toggles[which].val == TOGGLE_NOHELP_KEY ||
|
||||
toggles[which].val == TOGGLE_WRAP_KEY)
|
||||
statusbar("%s %s", toggles[which].desc, enabled);
|
||||
else
|
||||
statusbar("%s %s", toggles[which].desc, disabled);
|
||||
} else {
|
||||
if (toggles[which].val == TOGGLE_NOHELP_KEY ||
|
||||
toggles[which].val == TOGGLE_WRAP_KEY)
|
||||
statusbar("%s %s", toggles[which].desc, disabled);
|
||||
else
|
||||
statusbar("%s %s", toggles[which].desc, enabled);
|
||||
}
|
||||
SET(DISABLE_CURPOS);
|
||||
|
||||
#else
|
||||
nano_small_msg();
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int optchr;
|
||||
int kbinput; /* Input from keyboard */
|
||||
long startline = 0; /* Line to try and start at */
|
||||
struct sigaction act; /* For our lovely signals */
|
||||
int keyhandled = 0; /* Have we handled the keystroke yet? */
|
||||
int tmpkey = 0, i;
|
||||
#ifdef HAVE_TABSIZE
|
||||
int usrtabsize = 0; /* User defined tab size */
|
||||
#endif
|
||||
int i;
|
||||
char *argv0;
|
||||
#ifdef _POSIX_VDISABLE
|
||||
struct termios term;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
int option_index = 0;
|
||||
struct option long_options[] = {
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
{"regexp", 0, 0, 'R'},
|
||||
#endif
|
||||
{"version", 0, 0, 'V'},
|
||||
@@ -1570,9 +1729,7 @@ int main(int argc, char *argv[])
|
||||
{"mouse", 0, 0, 'm'},
|
||||
{"pico", 0, 0, 'p'},
|
||||
{"nofollow", 0, 0, 'l'},
|
||||
#ifdef HAVE_TABSIZE
|
||||
{"tabsize", 0, 0, 'T'},
|
||||
#endif
|
||||
{"tabsize", 1, 0, 'T'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
#endif
|
||||
@@ -1594,20 +1751,14 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
switch (optchr) {
|
||||
#ifdef HAVE_TABSIZE
|
||||
case 'T':
|
||||
usrtabsize = atoi(optarg);
|
||||
if (usrtabsize <= 0) {
|
||||
tabsize = atoi(optarg);
|
||||
if (tabsize <= 0) {
|
||||
usage(); /* To stop bogus data for tab width */
|
||||
finish(1);
|
||||
}
|
||||
break;
|
||||
#else
|
||||
case 'T':
|
||||
usage(); /* Oops! You dont really have that option */
|
||||
finish(1);
|
||||
#endif
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
case 'R':
|
||||
SET(USE_REGEXP);
|
||||
break;
|
||||
@@ -1629,6 +1780,10 @@ int main(int argc, char *argv[])
|
||||
case 'k':
|
||||
SET(CUT_TO_END);
|
||||
break;
|
||||
#else
|
||||
case 'k':
|
||||
usage(); /* Oops! You dont really have that option */
|
||||
finish(1);
|
||||
#endif
|
||||
case 'l':
|
||||
UNSET(FOLLOW_SYMLINKS);
|
||||
@@ -1677,9 +1832,6 @@ int main(int argc, char *argv[])
|
||||
|| (!argv0 && strstr(argv[0], "pico")))
|
||||
SET(PICO_MSGS);
|
||||
|
||||
filename = nmalloc(PATH_MAX);
|
||||
strcpy(filename, "");
|
||||
|
||||
/* See if there's a non-option in argv (first non-option is the
|
||||
filename, if +LINE is not given) */
|
||||
if (argc == 1 || argc <= optind)
|
||||
@@ -1702,11 +1854,13 @@ int main(int argc, char *argv[])
|
||||
/* First back up the old settings so they can be restored, duh */
|
||||
tcgetattr(0, &oldterm);
|
||||
|
||||
#ifdef _POSIX_VDISABLE
|
||||
term = oldterm;
|
||||
term.c_cc[VINTR] = _POSIX_VDISABLE;
|
||||
term.c_cc[VQUIT] = _POSIX_VDISABLE;
|
||||
term.c_lflag &= ~IEXTEN;
|
||||
tcsetattr(0, TCSANOW, &term);
|
||||
#endif
|
||||
|
||||
/* now ncurses init stuff... */
|
||||
initscr();
|
||||
@@ -1721,44 +1875,21 @@ int main(int argc, char *argv[])
|
||||
shortcut_init();
|
||||
init_help_msg();
|
||||
help_init();
|
||||
|
||||
/* Trap SIGINT and SIGQUIT cuz we want them to do useful things. */
|
||||
memset(&act, 0, sizeof(struct sigaction));
|
||||
act.sa_handler = SIG_IGN;
|
||||
sigaction(SIGINT, &act, NULL);
|
||||
sigaction(SIGQUIT, &act, NULL);
|
||||
|
||||
if (!ISSET(SUSPEND))
|
||||
sigaction(SIGTSTP, &act, NULL);
|
||||
|
||||
/* Trap SIGHUP cuz we want to write the file out. */
|
||||
act.sa_handler = handle_hup;
|
||||
sigaction(SIGHUP, &act, NULL);
|
||||
|
||||
act.sa_handler = handle_sigwinch;
|
||||
sigaction(SIGWINCH, &act, NULL);
|
||||
signal_init();
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Main: set up windows\n"));
|
||||
#endif
|
||||
|
||||
/* Setup up the main text window */
|
||||
edit = newwin(editwinrows, COLS, 2, 0);
|
||||
window_init();
|
||||
mouse_init();
|
||||
|
||||
#ifdef PDCURSES
|
||||
/* Must have this for the arrow, et al, keys to even work in
|
||||
PDCurses+cygwin under Windows */
|
||||
keypad(edit, TRUE);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
if (ISSET(USE_MOUSE)) {
|
||||
mousemask(BUTTON1_RELEASED, NULL);
|
||||
mouseinterval(50);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* And the other windows */
|
||||
topwin = newwin(2, COLS, 0, 0);
|
||||
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);
|
||||
keypad(bottomwin, TRUE);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Main: bottom win\n"));
|
||||
@@ -1779,23 +1910,113 @@ int main(int argc, char *argv[])
|
||||
if (startline > 0)
|
||||
do_gotoline(startline);
|
||||
else
|
||||
edit_update(fileage);
|
||||
|
||||
#ifdef HAVE_TABSIZE
|
||||
if (usrtabsize > 0)
|
||||
TABSIZE = usrtabsize;
|
||||
#endif
|
||||
edit_update(fileage, CENTER);
|
||||
|
||||
edit_refresh();
|
||||
reset_cursor();
|
||||
|
||||
while (1) {
|
||||
|
||||
#ifndef _POSIX_VDISABLE
|
||||
/* We're going to have to do it the old way, i.e. on cygwin */
|
||||
raw();
|
||||
#endif
|
||||
|
||||
kbinput = wgetch(edit);
|
||||
if (kbinput == 27) { /* Grab Alt-key stuff first */
|
||||
switch (kbinput = wgetch(edit)) {
|
||||
/* Alt-O, suddenly very important ;) */
|
||||
case 79:
|
||||
kbinput = wgetch(edit);
|
||||
if (kbinput <= 'S' && kbinput >= 'P')
|
||||
kbinput = KEY_F(kbinput - 79);
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
fprintf(stderr, _("I got Alt-O-%c! (%d)\n"),
|
||||
kbinput, kbinput);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
case 91:
|
||||
|
||||
switch (kbinput = wgetch(edit)) {
|
||||
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
|
||||
kbinput = wgetch(edit);
|
||||
if (kbinput >= '1' && kbinput <= '5') {
|
||||
kbinput = KEY_F(kbinput - 48);
|
||||
wgetch(edit);
|
||||
}
|
||||
else if (kbinput >= '7' && kbinput <= '9') {
|
||||
kbinput = KEY_F(kbinput - 49);
|
||||
wgetch(edit);
|
||||
}
|
||||
else if (kbinput == 126)
|
||||
kbinput = KEY_HOME;
|
||||
|
||||
#ifdef DEBUG
|
||||
else {
|
||||
fprintf(stderr, _("I got Alt-[-1-%c! (%d)\n"),
|
||||
kbinput, kbinput);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
break;
|
||||
case '2': /* Alt-[-2-[0,1,3,4] = F9-F12 in many terms */
|
||||
kbinput = wgetch(edit);
|
||||
switch (kbinput) {
|
||||
case '0':
|
||||
kbinput = KEY_F(9);
|
||||
wgetch(edit);
|
||||
break;
|
||||
case '1':
|
||||
kbinput = KEY_F(10);
|
||||
wgetch(edit);
|
||||
break;
|
||||
case '3':
|
||||
kbinput = KEY_F(11);
|
||||
wgetch(edit);
|
||||
break;
|
||||
case '4':
|
||||
kbinput = KEY_F(12);
|
||||
wgetch(edit);
|
||||
break;
|
||||
case 126: /* Hack, make insert key do something
|
||||
usefile, like insert file */
|
||||
do_insertfile();
|
||||
keyhandled = 1;
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
default:
|
||||
fprintf(stderr, _("I got Alt-[-2-%c! (%d)\n"),
|
||||
kbinput, kbinput);
|
||||
break;
|
||||
#endif
|
||||
|
||||
}
|
||||
break;
|
||||
case '3': /* Alt-[-3 = Delete? */
|
||||
kbinput = NANO_DELETE_KEY;
|
||||
wgetch(edit);
|
||||
break;
|
||||
case '4': /* Alt-[-4 = End? */
|
||||
kbinput = NANO_END_KEY;
|
||||
wgetch(edit);
|
||||
break;
|
||||
case '5': /* Alt-[-5 = Page Up */
|
||||
kbinput = KEY_PPAGE;
|
||||
wgetch(edit);
|
||||
break;
|
||||
case '6': /* Alt-[-6 = Page Down */
|
||||
kbinput = KEY_NPAGE;
|
||||
wgetch(edit);
|
||||
break;
|
||||
case '[': /* Alt-[-[-[A-E], F1-F5 in linux console */
|
||||
kbinput = wgetch(edit);
|
||||
if (kbinput >= 'A' && kbinput <= 'E')
|
||||
kbinput = KEY_F(kbinput - 64);
|
||||
break;
|
||||
case 'A':
|
||||
kbinput = KEY_UP;
|
||||
break;
|
||||
@@ -1814,30 +2035,6 @@ int main(int argc, char *argv[])
|
||||
case 'F':
|
||||
kbinput = KEY_END;
|
||||
break;
|
||||
case 49: /* X window F-keys */
|
||||
tmpkey = wgetch(edit);
|
||||
kbinput = KEY_F(tmpkey) - 48;
|
||||
wgetch(edit); /* Junk character */
|
||||
break;
|
||||
case 53: /* page up */
|
||||
kbinput = KEY_PPAGE;
|
||||
if ((kbinput = wgetch(edit)) == 126)
|
||||
kbinput = KEY_PPAGE; /* Ignore extra tilde */
|
||||
else { /* I guess this could happen ;-) */
|
||||
ungetch(kbinput);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 54: /* page down */
|
||||
kbinput = KEY_NPAGE;
|
||||
if ((kbinput = wgetch(edit)) == 126)
|
||||
kbinput = KEY_NPAGE; /* Same thing here */
|
||||
else {
|
||||
ungetch(kbinput);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("I got Alt-[-%c! (%d)\n"),
|
||||
@@ -1852,9 +2049,19 @@ int main(int argc, char *argv[])
|
||||
for (i = 0; i <= MAIN_LIST_LEN - 1; i++)
|
||||
if (kbinput == main_list[i].altval ||
|
||||
kbinput == main_list[i].altval - 32) {
|
||||
kbinput = main_list[i].val;
|
||||
break;
|
||||
kbinput = main_list[i].val;
|
||||
break;
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
/* And for toggle switches */
|
||||
for (i = 0; i <= TOGGLE_LEN - 1 && !keyhandled; i++)
|
||||
if (kbinput == toggles[i].val ||
|
||||
kbinput == toggles[i].val - 32) {
|
||||
do_toggle(i);
|
||||
keyhandled = 1;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("I got Alt-%c! (%d)\n"), kbinput,
|
||||
kbinput);
|
||||
@@ -1864,7 +2071,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
/* Look through the main shortcut list to see if we've hit a
|
||||
shortcut key */
|
||||
for (i = 0; i < MAIN_LIST_LEN; i++) {
|
||||
for (i = 0; i < MAIN_LIST_LEN && !keyhandled; i++) {
|
||||
if (kbinput == main_list[i].val ||
|
||||
(main_list[i].misc1 && kbinput == main_list[i].misc1) ||
|
||||
(main_list[i].misc2 && kbinput == main_list[i].misc2)) {
|
||||
@@ -1875,6 +2082,19 @@ int main(int argc, char *argv[])
|
||||
keyhandled = 1;
|
||||
}
|
||||
}
|
||||
#ifndef _POSIX_VDISABLE
|
||||
/* Since we're in raw mode, we have to catch ^Q and ^S */
|
||||
if (kbinput == 17 || kbinput == 19)
|
||||
keyhandled = 1;
|
||||
|
||||
/* And catch ^Z by hand when triggered */
|
||||
if (kbinput == 26) {
|
||||
if (ISSET(SUSPEND))
|
||||
do_suspend(0);
|
||||
keyhandled = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Last gasp, stuff that's not in the main lists */
|
||||
if (!keyhandled)
|
||||
switch (kbinput) {
|
||||
@@ -1891,6 +2111,12 @@ int main(int argc, char *argv[])
|
||||
case 331: /* Stuff that we don't want to do squat */
|
||||
case -1:
|
||||
case 410: /* Must ignore this, it gets sent when we resize */
|
||||
#ifdef PDCURSES
|
||||
case 541: /* ???? */
|
||||
case 542: /* Control and alt in Windows *shrug* */
|
||||
case 544:
|
||||
#endif
|
||||
|
||||
break;
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
@@ -1905,8 +2131,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
do_char(kbinput);
|
||||
}
|
||||
if (ISSET(CONSTUPDATE))
|
||||
do_cursorpos();
|
||||
if (ISSET(CONSTUPDATE)) {
|
||||
if (ISSET(DISABLE_CURPOS))
|
||||
UNSET(DISABLE_CURPOS);
|
||||
else
|
||||
do_cursorpos();
|
||||
}
|
||||
|
||||
reset_cursor();
|
||||
wrefresh(edit);
|
||||
|
||||
34
nano.h
34
nano.h
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* nano.h *
|
||||
* *
|
||||
@@ -44,11 +45,6 @@
|
||||
#include <curses.h>
|
||||
#endif /* CURSES_H */
|
||||
|
||||
#ifndef HAVE_TABSIZE
|
||||
static int TABSIZE = 8;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_LIBINTL_H
|
||||
#include <libintl.h>
|
||||
#endif
|
||||
@@ -86,6 +82,14 @@ typedef struct shortcut {
|
||||
char *help; /* Help file entry text */
|
||||
} shortcut;
|
||||
|
||||
typedef struct toggle {
|
||||
int val; /* Sequence to toggle the key. Should only need 1 */
|
||||
char *desc; /* Description for when toggle is, uh, toggled,
|
||||
e.g. "Pico Messages", we'll append Enabled or
|
||||
Disabled */
|
||||
int flag; /* What flag actually gets toggled */
|
||||
} toggle;
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste it) */
|
||||
|
||||
#define MODIFIED (1<<0)
|
||||
@@ -106,6 +110,7 @@ typedef struct shortcut {
|
||||
#define REGEXP_COMPILED (1<<15)
|
||||
#define TEMP_OPT (1<<16)
|
||||
#define CUT_TO_END (1<<17)
|
||||
#define DISABLE_CURPOS (1<<18)
|
||||
|
||||
/* Control key sequences, chaning these would be very very bad */
|
||||
|
||||
@@ -221,6 +226,16 @@ know what you're doing */
|
||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
|
||||
|
||||
#define TOGGLE_CONST_KEY NANO_ALT_C
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
|
||||
#define TOGGLE_NOHELP_KEY NANO_ALT_X
|
||||
#define TOGGLE_PICOMODE_KEY NANO_ALT_P
|
||||
#define TOGGLE_MOUSE_KEY NANO_ALT_M
|
||||
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
|
||||
#define TOGGLE_REGEXP_KEY NANO_ALT_E
|
||||
#define TOGGLE_WRAP_KEY NANO_ALT_W
|
||||
|
||||
#define MAIN_LIST_LEN 26
|
||||
#define MAIN_VISIBLE 12
|
||||
#define WHEREIS_LIST_LEN 6
|
||||
@@ -230,7 +245,16 @@ know what you're doing */
|
||||
#define HELP_LIST_LEN 3
|
||||
#define SPELL_LIST_LEN 3
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#define TOGGLE_LEN 9
|
||||
#else
|
||||
#define TOGGLE_LEN 8
|
||||
#endif
|
||||
|
||||
#define VIEW 1
|
||||
#define NOVIEW 0
|
||||
|
||||
#define TOP 2
|
||||
#define CENTER 1
|
||||
#define BOTTOM 0
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
$Id$
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# $Id$
|
||||
# Makefile for program source directory in GNU NLS utilities package.
|
||||
# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
#
|
||||
@@ -111,9 +112,9 @@ install-data: install-data-@USE_NLS@
|
||||
install-data-no: all
|
||||
install-data-yes: all
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(datadir); \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(datadir); \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
|
||||
fi
|
||||
@catalogs='$(CATALOGS)'; \
|
||||
for cat in $$catalogs; do \
|
||||
@@ -125,27 +126,30 @@ install-data-yes: all
|
||||
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
|
||||
dir=$$destdir/$$lang/LC_MESSAGES; \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $$dir; \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$$dir; \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$$dir; \
|
||||
fi; \
|
||||
if test -r $$cat; then \
|
||||
$(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
$(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $$cat as" \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat \
|
||||
$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT); \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
|
||||
fi; \
|
||||
if test -r $$cat.m; then \
|
||||
$(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
$(INSTALL_DATA) $$cat.m $(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $$cat.m as" \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
if test -r $(srcdir)/$$cat.m ; then \
|
||||
$(INSTALL_DATA) $(srcdir)/$$cat.m \
|
||||
$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
|
||||
echo "installing $(srcdir)/$$cat as" \
|
||||
"$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
"$(DESTDIR)$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
|
||||
else \
|
||||
true; \
|
||||
fi; \
|
||||
@@ -153,12 +157,12 @@ install-data-yes: all
|
||||
done
|
||||
if test "$(PACKAGE)" = "gettext"; then \
|
||||
if test -r "$(MKINSTALLDIRS)"; then \
|
||||
$(MKINSTALLDIRS) $(gettextsrcdir); \
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
|
||||
else \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(gettextsrcdir); \
|
||||
$(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
|
||||
fi; \
|
||||
$(INSTALL_DATA) $(srcdir)/Makefile.in.in \
|
||||
$(gettextsrcdir)/Makefile.in.in; \
|
||||
$(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
|
||||
else \
|
||||
: ; \
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# $Id$
|
||||
# List of source files containing translatable strings.
|
||||
|
||||
# Package source files
|
||||
|
||||
351
po/cat-id-tbl.c
351
po/cat-id-tbl.c
@@ -28,71 +28,80 @@ const struct _msg_ent _msg_tbl[] = {
|
||||
{"File Name to write", 19},
|
||||
{"filename is %s", 20},
|
||||
{"File exists, OVERWRITE ?", 21},
|
||||
{"Invoke the help menu", 22},
|
||||
{"Write the current file to disk", 23},
|
||||
{"Exit from nano", 24},
|
||||
{"Goto a specific line number", 25},
|
||||
{"Justify the current paragraph", 26},
|
||||
{"Replace text within the editor", 27},
|
||||
{"Insert another file into the current one", 28},
|
||||
{"Search for text within the editor", 29},
|
||||
{"Move to the previous screen", 30},
|
||||
{"Move to the next screen", 31},
|
||||
{"Cut the current line and store it in the cutbuffer", 32},
|
||||
{"Uncut from the cutbuffer into the current line", 33},
|
||||
{"Show the posititon of the cursor", 34},
|
||||
{"Invoke the spell checker (if available)", 35},
|
||||
{"Move up one line", 36},
|
||||
{"Move down one line", 37},
|
||||
{"Move forward one character", 38},
|
||||
{"Move back one character", 39},
|
||||
{"Move to the beginning of the current line", 40},
|
||||
{"Move to the end of the current line", 41},
|
||||
{"Go to the first line of the file", 42},
|
||||
{"Go to the last line of the file", 43},
|
||||
{"Refresh (redraw) the current screen", 44},
|
||||
{"Mark text at the current cursor location", 45},
|
||||
{"Delete the character under the cursor", 46},
|
||||
{"Delete the character to the left of the cursor", 47},
|
||||
{"Insert a tab character", 48},
|
||||
{"Insert a carriage return at the cursor position", 49},
|
||||
{"Make the current search or replace case (in)sensitive", 50},
|
||||
{"Cancel the current function", 51},
|
||||
{"Get Help", 52},
|
||||
{"WriteOut", 53},
|
||||
{"Exit", 54},
|
||||
{"Goto Line", 55},
|
||||
{"Justify", 56},
|
||||
{"Replace", 57},
|
||||
{"Read File", 58},
|
||||
{"Where Is", 59},
|
||||
{"Prev Page", 60},
|
||||
{"Next Page", 61},
|
||||
{"Cut Text", 62},
|
||||
{"UnCut Txt", 63},
|
||||
{"Cur Pos", 64},
|
||||
{"To Spell", 65},
|
||||
{"Up", 66},
|
||||
{"Down", 67},
|
||||
{"Forward", 68},
|
||||
{"Back", 69},
|
||||
{"Home", 70},
|
||||
{"End", 71},
|
||||
{"Refresh", 72},
|
||||
{"Mark Text", 73},
|
||||
{"Delete", 74},
|
||||
{"Backspace", 75},
|
||||
{"Tab", 76},
|
||||
{"Enter", 77},
|
||||
{"First Line", 78},
|
||||
{"Last Line", 79},
|
||||
{"Case Sens", 80},
|
||||
{"Cancel", 81},
|
||||
{"No Replace", 82},
|
||||
{"Constant cursor position", 22},
|
||||
{"Auto indent", 23},
|
||||
{"Suspend", 24},
|
||||
{"Help mode", 25},
|
||||
{"Pico messages", 26},
|
||||
{"Mouse support", 27},
|
||||
{"Cut to end", 28},
|
||||
{"Regular expressions", 29},
|
||||
{"Auto wrap", 30},
|
||||
{"Invoke the help menu", 31},
|
||||
{"Write the current file to disk", 32},
|
||||
{"Exit from nano", 33},
|
||||
{"Goto a specific line number", 34},
|
||||
{"Justify the current paragraph", 35},
|
||||
{"Replace text within the editor", 36},
|
||||
{"Insert another file into the current one", 37},
|
||||
{"Search for text within the editor", 38},
|
||||
{"Move to the previous screen", 39},
|
||||
{"Move to the next screen", 40},
|
||||
{"Cut the current line and store it in the cutbuffer", 41},
|
||||
{"Uncut from the cutbuffer into the current line", 42},
|
||||
{"Show the posititon of the cursor", 43},
|
||||
{"Invoke the spell checker (if available)", 44},
|
||||
{"Move up one line", 45},
|
||||
{"Move down one line", 46},
|
||||
{"Move forward one character", 47},
|
||||
{"Move back one character", 48},
|
||||
{"Move to the beginning of the current line", 49},
|
||||
{"Move to the end of the current line", 50},
|
||||
{"Go to the first line of the file", 51},
|
||||
{"Go to the last line of the file", 52},
|
||||
{"Refresh (redraw) the current screen", 53},
|
||||
{"Mark text at the current cursor location", 54},
|
||||
{"Delete the character under the cursor", 55},
|
||||
{"Delete the character to the left of the cursor", 56},
|
||||
{"Insert a tab character", 57},
|
||||
{"Insert a carriage return at the cursor position", 58},
|
||||
{"Make the current search or replace case (in)sensitive", 59},
|
||||
{"Cancel the current function", 60},
|
||||
{"Get Help", 61},
|
||||
{"WriteOut", 62},
|
||||
{"Exit", 63},
|
||||
{"Goto Line", 64},
|
||||
{"Justify", 65},
|
||||
{"Replace", 66},
|
||||
{"Read File", 67},
|
||||
{"Where Is", 68},
|
||||
{"Prev Page", 69},
|
||||
{"Next Page", 70},
|
||||
{"Cut Text", 71},
|
||||
{"UnCut Txt", 72},
|
||||
{"Cur Pos", 73},
|
||||
{"To Spell", 74},
|
||||
{"Up", 75},
|
||||
{"Down", 76},
|
||||
{"Forward", 77},
|
||||
{"Back", 78},
|
||||
{"Home", 79},
|
||||
{"End", 80},
|
||||
{"Refresh", 81},
|
||||
{"Mark Text", 82},
|
||||
{"Delete", 83},
|
||||
{"Backspace", 84},
|
||||
{"Tab", 85},
|
||||
{"Enter", 86},
|
||||
{"First Line", 87},
|
||||
{"Last Line", 88},
|
||||
{"Case Sens", 89},
|
||||
{"Cancel", 90},
|
||||
{"No Replace", 91},
|
||||
{"\
|
||||
\n\
|
||||
Buffer written to 'nano.save'\n", 83},
|
||||
{"Key illegal in VIEW mode", 84},
|
||||
Buffer written to 'nano.save'\n", 92},
|
||||
{"Key illegal in VIEW mode", 93},
|
||||
{"\
|
||||
nano help text\n\
|
||||
\n\
|
||||
@@ -105,114 +114,122 @@ 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. Alt-key sequences are notated with an at (@) \
|
||||
symbol. The following keystrokes are available in the main editor window. \
|
||||
Optional keys are shown in parentheses:\n\
|
||||
\n", 85},
|
||||
{"free_node(): free'd a node, YAY!\n", 86},
|
||||
{"free_node(): free'd last node.\n", 87},
|
||||
with a caret (^) symbol and are entered with the Control (Ctrl) key. \
|
||||
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. The \
|
||||
following keystrokes are available in the main editor window. Optional keys \
|
||||
are shown in parentheses:\n\
|
||||
\n", 94},
|
||||
{"free_node(): free'd a node, YAY!\n", 95},
|
||||
{"free_node(): free'd last node.\n", 96},
|
||||
{"\
|
||||
Usage: nano [GNU long option] [option] +LINE <file>\n\
|
||||
\n", 88},
|
||||
{"Option\t\tLong option\t\tMeaning\n", 89},
|
||||
{" -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n", 90},
|
||||
{" -R\t\t--regexp\t\tUse regular expressions for search\n", 91},
|
||||
{" -V \t\t--version\t\tPrint version information and exit\n", 92},
|
||||
{" -c \t\t--const\t\t\tConstantly show cursor position\n", 93},
|
||||
{" -h \t\t--help\t\t\tShow this message\n", 94},
|
||||
{" -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n", 95},
|
||||
{" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 96},
|
||||
{" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite.\n", 97},
|
||||
{" -m \t\t--mouse\t\t\tEnable mouse\n", 98},
|
||||
\n", 97},
|
||||
{"Option\t\tLong option\t\tMeaning\n", 98},
|
||||
{" -T \t\t--tabsize=[num]\t\tSet width of a tab to num\n", 99},
|
||||
{" -R\t\t--regexp\t\tUse regular expressions for search\n", 100},
|
||||
{" -V \t\t--version\t\tPrint version information and exit\n", 101},
|
||||
{" -c \t\t--const\t\t\tConstantly show cursor position\n", 102},
|
||||
{" -h \t\t--help\t\t\tShow this message\n", 103},
|
||||
{" -k \t\t--cut\t\t\tLet ^K cut from cursor to end of line\n", 104},
|
||||
{" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 105},
|
||||
{" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite\n", 106},
|
||||
{" -m \t\t--mouse\t\t\tEnable mouse\n", 107},
|
||||
{"\
|
||||
-r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 99},
|
||||
{" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 100},
|
||||
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 101},
|
||||
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 102},
|
||||
{" -v \t\t--view\t\t\tView (read only) mode\n", 103},
|
||||
{" -w \t\t--nowrap\t\tDon't wrap long lines\n", 104},
|
||||
{" -x \t\t--nohelp\t\tDon't show help window\n", 105},
|
||||
{" -z \t\t--suspend\t\tEnable suspend\n", 106},
|
||||
{" +LINE\t\t\t\t\tStart at line number LINE\n", 107},
|
||||
-r [#cols] \t--fill=[#cols]\t\tSet fill cols to (wrap lines at) #cols\n", 108},
|
||||
{" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 109},
|
||||
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 110},
|
||||
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 111},
|
||||
{" -v \t\t--view\t\t\tView (read only) mode\n", 112},
|
||||
{" -w \t\t--nowrap\t\tDon't wrap long lines\n", 113},
|
||||
{" -x \t\t--nohelp\t\tDon't show help window\n", 114},
|
||||
{" -z \t\t--suspend\t\tEnable suspend\n", 115},
|
||||
{" +LINE\t\t\t\t\tStart at line number LINE\n", 116},
|
||||
{"\
|
||||
Usage: nano [option] +LINE <file>\n\
|
||||
\n", 108},
|
||||
{"Option\t\tMeaning\n", 109},
|
||||
{" -T [num]\tSet width of a tab to num\n", 110},
|
||||
{" -R\t\tUse regular expressions for search\n", 111},
|
||||
{" -V \t\tPrint version information and exit\n", 112},
|
||||
{" -c \t\tConstantly show cursor position\n", 113},
|
||||
{" -h \t\tShow this message\n", 114},
|
||||
{" -k \t\tLet ^K cut from cursor to end of line\n", 115},
|
||||
{" -i \t\tAutomatically indent new lines\n", 116},
|
||||
{" -l \t\tDon't follow symbolic links, overwrite.\n", 117},
|
||||
{" -m \t\tEnable mouse\n", 118},
|
||||
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 119},
|
||||
{" -s [prog] \tEnable alternate speller\n", 120},
|
||||
{" -p \t\tMake bottom 2 lines more Pico-like\n", 121},
|
||||
{" -t \t\tAuto save on exit, don't prompt\n", 122},
|
||||
{" -v \t\tView (read only) mode\n", 123},
|
||||
{" -w \t\tDon't wrap long lines\n", 124},
|
||||
{" -x \t\tDon't show help window\n", 125},
|
||||
{" -z \t\tEnable suspend\n", 126},
|
||||
{" +LINE\t\tStart at line number LINE\n", 127},
|
||||
{" nano version %s by Chris Allegretta (compiled %s, %s)\n", 128},
|
||||
{" Email: nano@asty.org\tWeb: http://www.asty.org/nano\n", 129},
|
||||
{"Mark Set", 130},
|
||||
{"Mark UNset", 131},
|
||||
{"check_wrap called with inptr->data=\"%s\"\n", 132},
|
||||
{"current->data now = \"%s\"\n", 133},
|
||||
{"After, data = \"%s\"\n", 134},
|
||||
{"Error deleting tempfile, ack!", 135},
|
||||
{"Could not create a temporary filename: %s", 136},
|
||||
{"Could not invoke spell program \"%s\"", 137},
|
||||
{"Could not invoke \"ispell\"", 138},
|
||||
{"Finished checking spelling", 139},
|
||||
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 140},
|
||||
{"Cannot resize top win", 141},
|
||||
{"Cannot move top win", 142},
|
||||
{"Cannot resize edit win", 143},
|
||||
{"Cannot move edit win", 144},
|
||||
{"Cannot resize bottom win", 145},
|
||||
{"Cannot move bottom win", 146},
|
||||
{"Main: set up windows\n", 147},
|
||||
{"Main: bottom win\n", 148},
|
||||
{"Main: open file\n", 149},
|
||||
{"I got Alt-[-%c! (%d)\n", 150},
|
||||
{"I got Alt-%c! (%d)\n", 151},
|
||||
{"Case Sensitive Regexp Search%s%s", 152},
|
||||
{"Regexp Search%s%s", 153},
|
||||
{"Case Sensitive Search%s%s", 154},
|
||||
{"Search%s%s", 155},
|
||||
{" (to replace)", 156},
|
||||
{"Search Cancelled", 157},
|
||||
{"Search Wrapped", 158},
|
||||
{"Replaced %d occurences", 159},
|
||||
{"Replaced 1 occurence", 160},
|
||||
{"Replace Cancelled", 161},
|
||||
{"Replace with [%s]", 162},
|
||||
{"Replace with", 163},
|
||||
{"Replace this instance?", 164},
|
||||
{"Enter line number", 165},
|
||||
{"Aborted", 166},
|
||||
{"Come on, be reasonable", 167},
|
||||
{"Only %d lines available, skipping to last line", 168},
|
||||
{"actual_x_from_start for xplus=%d returned %d\n", 169},
|
||||
{"input '%c' (%d)\n", 170},
|
||||
{"New Buffer", 171},
|
||||
{" File: ...", 172},
|
||||
{"Modified", 173},
|
||||
{"Moved to (%d, %d) in edit buffer\n", 174},
|
||||
{"current->data = \"%s\"\n", 175},
|
||||
{"I got \"%s\"\n", 176},
|
||||
{"Yes", 177},
|
||||
{"All", 178},
|
||||
{"No", 179},
|
||||
{"do_cursorpos: linepct = %f, bytepct = %f\n", 180},
|
||||
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 181},
|
||||
{"Dumping file buffer to stderr...\n", 182},
|
||||
{"Dumping cutbuffer to stderr...\n", 183},
|
||||
{"Dumping a buffer to stderr...\n", 184},
|
||||
\n", 117},
|
||||
{"Option\t\tMeaning\n", 118},
|
||||
{" -T [num]\tSet width of a tab to num\n", 119},
|
||||
{" -R\t\tUse regular expressions for search\n", 120},
|
||||
{" -V \t\tPrint version information and exit\n", 121},
|
||||
{" -c \t\tConstantly show cursor position\n", 122},
|
||||
{" -h \t\tShow this message\n", 123},
|
||||
{" -k \t\tLet ^K cut from cursor to end of line\n", 124},
|
||||
{" -i \t\tAutomatically indent new lines\n", 125},
|
||||
{" -l \t\tDon't follow symbolic links, overwrite\n", 126},
|
||||
{" -m \t\tEnable mouse\n", 127},
|
||||
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 128},
|
||||
{" -s [prog] \tEnable alternate speller\n", 129},
|
||||
{" -p \t\tMake bottom 2 lines more Pico-like\n", 130},
|
||||
{" -t \t\tAuto save on exit, don't prompt\n", 131},
|
||||
{" -v \t\tView (read only) mode\n", 132},
|
||||
{" -w \t\tDon't wrap long lines\n", 133},
|
||||
{" -x \t\tDon't show help window\n", 134},
|
||||
{" -z \t\tEnable suspend\n", 135},
|
||||
{" +LINE\t\tStart at line number LINE\n", 136},
|
||||
{" nano version %s by Chris Allegretta (compiled %s, %s)\n", 137},
|
||||
{" Email: nano@nano-editor.org\tWeb: http://www.nano-editor.org\n", 138},
|
||||
{"Mark Set", 139},
|
||||
{"Mark UNset", 140},
|
||||
{"check_wrap called with inptr->data=\"%s\"\n", 141},
|
||||
{"current->data now = \"%s\"\n", 142},
|
||||
{"After, data = \"%s\"\n", 143},
|
||||
{"Error deleting tempfile, ack!", 144},
|
||||
{"Could not create a temporary filename: %s", 145},
|
||||
{"Could not invoke spell program \"%s\"", 146},
|
||||
{"Could not invoke \"ispell\"", 147},
|
||||
{"Finished checking spelling", 148},
|
||||
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 149},
|
||||
{"Cannot resize top win", 150},
|
||||
{"Cannot move top win", 151},
|
||||
{"Cannot resize edit win", 152},
|
||||
{"Cannot move edit win", 153},
|
||||
{"Cannot resize bottom win", 154},
|
||||
{"Cannot move bottom win", 155},
|
||||
{"%s enable/disable", 156},
|
||||
{"enabled", 157},
|
||||
{"disabled", 158},
|
||||
{"Main: set up windows\n", 159},
|
||||
{"Main: bottom win\n", 160},
|
||||
{"Main: open file\n", 161},
|
||||
{"I got Alt-O-%c! (%d)\n", 162},
|
||||
{"I got Alt-[-1-%c! (%d)\n", 163},
|
||||
{"I got Alt-[-2-%c! (%d)\n", 164},
|
||||
{"I got Alt-[-%c! (%d)\n", 165},
|
||||
{"I got Alt-%c! (%d)\n", 166},
|
||||
{"Case Sensitive Regexp Search%s%s", 167},
|
||||
{"Regexp Search%s%s", 168},
|
||||
{"Case Sensitive Search%s%s", 169},
|
||||
{"Search%s%s", 170},
|
||||
{" (to replace)", 171},
|
||||
{"Search Cancelled", 172},
|
||||
{"Search Wrapped", 173},
|
||||
{"Replaced %d occurences", 174},
|
||||
{"Replaced 1 occurence", 175},
|
||||
{"Replace Cancelled", 176},
|
||||
{"Replace with [%s]", 177},
|
||||
{"Replace with", 178},
|
||||
{"Replace this instance?", 179},
|
||||
{"Enter line number", 180},
|
||||
{"Aborted", 181},
|
||||
{"Come on, be reasonable", 182},
|
||||
{"Only %d lines available, skipping to last line", 183},
|
||||
{"actual_x_from_start for xplus=%d returned %d\n", 184},
|
||||
{"input '%c' (%d)\n", 185},
|
||||
{"New Buffer", 186},
|
||||
{" File: ...", 187},
|
||||
{"Modified", 188},
|
||||
{"Moved to (%d, %d) in edit buffer\n", 189},
|
||||
{"current->data = \"%s\"\n", 190},
|
||||
{"I got \"%s\"\n", 191},
|
||||
{"Yes", 192},
|
||||
{"All", 193},
|
||||
{"No", 194},
|
||||
{"do_cursorpos: linepct = %f, bytepct = %f\n", 195},
|
||||
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 196},
|
||||
{"Dumping file buffer to stderr...\n", 197},
|
||||
{"Dumping cutbuffer to stderr...\n", 198},
|
||||
{"Dumping a buffer to stderr...\n", 199},
|
||||
};
|
||||
|
||||
int _msg_tbl_length = 184;
|
||||
int _msg_tbl_length = 199;
|
||||
|
||||
580
po/nano.pot
580
po/nano.pot
File diff suppressed because it is too large
Load Diff
24
proto.h
24
proto.h
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* proto.h *
|
||||
* *
|
||||
@@ -21,7 +22,11 @@
|
||||
/* Externs */
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
||||
#include "nano.h"
|
||||
|
||||
extern int center_x, center_y, editwinrows;
|
||||
@@ -29,10 +34,11 @@ extern int current_x, current_y, posible_max, totlines;
|
||||
extern int placewewant;
|
||||
extern int mark_beginx, samelinewrap;
|
||||
extern int totsize, temp_opt;
|
||||
extern int fill, flags;
|
||||
extern int fill, flags,tabsize;
|
||||
|
||||
extern WINDOW *edit, *topwin, *bottomwin;
|
||||
extern char *filename, *answer, *last_search, *last_replace;
|
||||
extern char filename[PATH_MAX];
|
||||
extern char answer[132];
|
||||
extern char *hblank, *help_text;
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *editbot, *filebot;
|
||||
@@ -42,9 +48,14 @@ extern shortcut main_list[MAIN_LIST_LEN], whereis_list[WHEREIS_LIST_LEN];
|
||||
extern shortcut replace_list[REPLACE_LIST_LEN], goto_list[GOTO_LIST_LEN];
|
||||
extern shortcut writefile_list[WRITEFILE_LIST_LEN], help_list[HELP_LIST_LEN];
|
||||
extern shortcut spell_list[SPELL_LIST_LEN];
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
extern int use_regexp, regexp_compiled;
|
||||
extern regex_t search_regexp;
|
||||
extern regmatch_t regmatches[10];
|
||||
#endif
|
||||
|
||||
extern toggle toggles[TOGGLE_LEN];
|
||||
|
||||
/* Programs we want available */
|
||||
|
||||
@@ -79,10 +90,8 @@ void blank_bottombars(void);
|
||||
void check_wrap(filestruct * inptr, char ch);
|
||||
void dump_buffer(filestruct * inptr);
|
||||
void align(char **strp);
|
||||
void edit_refresh(void);
|
||||
void edit_update(filestruct * fileptr);
|
||||
void edit_update_top(filestruct * fileptr);
|
||||
void edit_update_bot(filestruct * fileptr);
|
||||
void edit_refresh(void), edit_refresh_clearok(void);
|
||||
void edit_update(filestruct * fileptr, int topmidbot);
|
||||
void update_cursor(void);
|
||||
void delete_node(filestruct * fileptr);
|
||||
void set_modified(void);
|
||||
@@ -107,6 +116,9 @@ void *nrealloc(void *ptr, size_t howmuch);
|
||||
void die(char *msg, ...);
|
||||
void new_file(void);
|
||||
void new_magicline(void);
|
||||
void splice_node(filestruct *begin, filestruct *new, filestruct *end);
|
||||
void null_at(char *data, int index);
|
||||
void page_up_center(void);
|
||||
|
||||
int do_writeout_void(void), do_exit(void), do_gotoline_void(void);
|
||||
int do_insertfile(void), do_search(void), page_up(void), page_down(void);
|
||||
|
||||
58
search.c
58
search.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* search.c *
|
||||
* *
|
||||
@@ -33,9 +34,12 @@
|
||||
#define _(string) (string)
|
||||
#endif
|
||||
|
||||
static char last_search[132] = ""; /* Last string we searched for */
|
||||
static char last_replace[132] = ""; /* Last replacement string */
|
||||
|
||||
/* Regular expression helper functions */
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
void regexp_init(const char *regexp)
|
||||
{
|
||||
regcomp(&search_regexp, regexp, ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE);
|
||||
@@ -91,13 +95,13 @@ int search_init(int replacing)
|
||||
return -1;
|
||||
} else if (i == -2) { /* Same string */
|
||||
strncpy(answer, last_search, 132);
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
regexp_init(answer);
|
||||
#endif
|
||||
} else if (i == 0) { /* They entered something new */
|
||||
strncpy(last_search, answer, 132);
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
regexp_init(answer);
|
||||
#endif
|
||||
@@ -157,39 +161,35 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle)
|
||||
current_x++;
|
||||
|
||||
if (past_editbot)
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
placewewant = xplustabs();
|
||||
reset_cursor();
|
||||
} else { /* We're at EOF, go back to the top, once */
|
||||
|
||||
fileptr = fileage;
|
||||
|
||||
while (fileptr != current && fileptr != begin &&
|
||||
while (fileptr != begin->next &&
|
||||
(found = strstrwrapper(fileptr->data, needle)) == NULL)
|
||||
fileptr = fileptr->next;
|
||||
|
||||
if (fileptr == begin) {
|
||||
if (fileptr == begin->next) {
|
||||
if (!quiet)
|
||||
statusbar(_("\"%s\" not found"), needle);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
if (fileptr != current) { /* We found something */
|
||||
else { /* We found something */
|
||||
current = fileptr;
|
||||
current_x = 0;
|
||||
for (tmp = fileptr->data; tmp != found; tmp++)
|
||||
current_x++;
|
||||
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
reset_cursor();
|
||||
|
||||
if (!quiet)
|
||||
statusbar(_("Search Wrapped"));
|
||||
} else { /* Nada */
|
||||
|
||||
if (!quiet)
|
||||
statusbar(_("\"%s\" not found"), needle);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return fileptr;
|
||||
@@ -200,8 +200,10 @@ void search_abort(void)
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
wrefresh(bottomwin);
|
||||
if (ISSET(MARK_ISSET))
|
||||
edit_refresh_clearok();
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(REGEXP_COMPILED))
|
||||
regexp_cleanup();
|
||||
#endif
|
||||
@@ -244,17 +246,13 @@ void print_replaced(int num)
|
||||
|
||||
void replace_abort(void)
|
||||
{
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
reset_cursor();
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
if (ISSET(REGEXP_COMPILED))
|
||||
regexp_cleanup();
|
||||
#endif
|
||||
/* Identicle to search_abort, so we'll call it here. If it
|
||||
does something different later, we can change it back. For now
|
||||
it's just a waste to duplicat code */
|
||||
search_abort();
|
||||
}
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, int create_flag)
|
||||
{
|
||||
/* split personality here - if create_flag is null, just calculate
|
||||
@@ -324,7 +322,7 @@ char *replace_line()
|
||||
int search_match_count;
|
||||
|
||||
/* Calculate size of new line */
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
search_match_count = regmatches[0].rm_eo -
|
||||
regmatches[0].rm_so;
|
||||
@@ -352,7 +350,7 @@ char *replace_line()
|
||||
/* Replacement Text */
|
||||
if (!ISSET(USE_REGEXP))
|
||||
strcat(copy, last_replace);
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
else
|
||||
(void)replace_regexp(copy + current_x, 1);
|
||||
#endif
|
||||
@@ -491,7 +489,7 @@ int do_replace(void)
|
||||
current = begin;
|
||||
current_x = beginx;
|
||||
renumber_all();
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
print_replaced(numreplaced);
|
||||
replace_abort();
|
||||
return 1;
|
||||
@@ -525,7 +523,7 @@ int do_gotoline(long defline)
|
||||
if (!strcmp(answer, "$")) {
|
||||
current = filebot;
|
||||
current_x = 0;
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
goto_abort();
|
||||
return 1;
|
||||
}
|
||||
@@ -543,14 +541,14 @@ int do_gotoline(long defline)
|
||||
filebot->lineno);
|
||||
current = filebot;
|
||||
current_x = 0;
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
} else {
|
||||
for (fileptr = fileage; fileptr != NULL && i < line; i++)
|
||||
fileptr = fileptr->next;
|
||||
|
||||
current = fileptr;
|
||||
current_x = 0;
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
}
|
||||
|
||||
goto_abort();
|
||||
|
||||
3
utils.c
3
utils.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* utils.c *
|
||||
* *
|
||||
@@ -81,7 +82,7 @@ char *strcasestr(char *haystack, char *needle)
|
||||
|
||||
char *strstrwrapper(char *haystack, char *needle)
|
||||
{
|
||||
#ifdef _POSIX_VERSION
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
int result=regexec(&search_regexp, haystack, 10, regmatches, 0);
|
||||
if (!result)
|
||||
|
||||
107
winio.c
107
winio.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* winio.c *
|
||||
* *
|
||||
@@ -48,7 +49,7 @@ int do_first_line(void)
|
||||
current = fileage;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -57,7 +58,7 @@ int do_last_line(void)
|
||||
current = filebot;
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
edit_update(current);
|
||||
edit_update(current, CENTER);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -73,9 +74,9 @@ int xpt(filestruct * fileptr, int index)
|
||||
tabs++;
|
||||
|
||||
if (fileptr->data[i] == NANO_CONTROL_I) {
|
||||
if (tabs % TABSIZE == 0);
|
||||
if (tabs % tabsize == 0);
|
||||
else
|
||||
tabs += TABSIZE - (tabs % TABSIZE);
|
||||
tabs += tabsize - (tabs % tabsize);
|
||||
} else if (fileptr->data[i] & 0x80)
|
||||
/* Make 8 bit chars only 1 collumn! */
|
||||
;
|
||||
@@ -106,10 +107,10 @@ int actual_x_from_start(filestruct * fileptr, int xplus, int start)
|
||||
|
||||
for (i = start; tot <= xplus && fileptr->data[i] != 0; i++, tot++)
|
||||
if (fileptr->data[i] == NANO_CONTROL_I) {
|
||||
if (tot % TABSIZE == 0)
|
||||
if (tot % tabsize == 0)
|
||||
tot++;
|
||||
else
|
||||
tot += TABSIZE - (tot % TABSIZE);
|
||||
tot += tabsize - (tot % tabsize);
|
||||
} else if (fileptr->data[i] & 0x80)
|
||||
tot++; /* Make 8 bit chars only 1 column (again) */
|
||||
else if (fileptr->data[i] < 32)
|
||||
@@ -140,9 +141,9 @@ int strlenpt(char *buf)
|
||||
tabs++;
|
||||
|
||||
if (buf[i] == NANO_CONTROL_I) {
|
||||
if (tabs % TABSIZE == 0);
|
||||
if (tabs % tabsize == 0);
|
||||
else
|
||||
tabs += TABSIZE - (tabs % TABSIZE);
|
||||
tabs += tabsize - (tabs % tabsize);
|
||||
} else if (buf[i] & 0x80)
|
||||
/* Make 8 bit chars only 1 collumn! */
|
||||
;
|
||||
@@ -461,7 +462,7 @@ void onekey(char *keystroke, char *desc)
|
||||
{
|
||||
char description[80];
|
||||
|
||||
snprintf(description, 12, " %-11s", desc);
|
||||
snprintf(description, 12, " %-10s", desc);
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
waddstr(bottomwin, keystroke);
|
||||
wattroff(bottomwin, A_REVERSE);
|
||||
@@ -773,12 +774,17 @@ void update_line(filestruct * fileptr, int index)
|
||||
virt_cur_x++;
|
||||
if (i < mark_beginx)
|
||||
virt_mark_beginx++;
|
||||
} while (pos % TABSIZE);
|
||||
} while (pos % tabsize);
|
||||
/* must decrement once to account for tab-is-one-character */
|
||||
if (i < current_x)
|
||||
virt_cur_x--;
|
||||
if (i < mark_beginx)
|
||||
virt_mark_beginx--;
|
||||
}
|
||||
else if (realdata[i] >= 1 && realdata[i] <= 26) {
|
||||
/* Treat control characters as ^letter */
|
||||
fileptr->data[pos++] = '^';
|
||||
fileptr->data[pos++] = realdata[i] + 64;
|
||||
} else {
|
||||
fileptr->data[pos++] = realdata[i];
|
||||
}
|
||||
@@ -822,7 +828,8 @@ void center_cursor(void)
|
||||
/* Refresh the screen without changing the position of lines */
|
||||
void edit_refresh(void)
|
||||
{
|
||||
int lines = 0, i = 0;
|
||||
static int noloop = 0;
|
||||
int lines = 0, i = 0, currentcheck = 0;
|
||||
filestruct *temp, *hold = current;
|
||||
|
||||
if (current == NULL)
|
||||
@@ -833,9 +840,21 @@ void edit_refresh(void)
|
||||
while (lines <= editwinrows - 1 && lines <= totlines && temp != NULL) {
|
||||
hold = temp;
|
||||
update_line(temp, current_x);
|
||||
if (temp == current)
|
||||
currentcheck = 1;
|
||||
|
||||
temp = temp->next;
|
||||
lines++;
|
||||
}
|
||||
/* If noloop == 1, then we already did an edit_update without finishing
|
||||
this function. So we don't run edit_update again */
|
||||
if (!currentcheck && !noloop) /* Then current has run off the screen... */
|
||||
{
|
||||
edit_update(current, CENTER);
|
||||
noloop = 1;
|
||||
}
|
||||
else if (noloop)
|
||||
noloop = 0;
|
||||
|
||||
if (lines <= editwinrows - 1)
|
||||
while (lines <= editwinrows - 1) {
|
||||
@@ -848,11 +867,21 @@ void edit_refresh(void)
|
||||
editbot = temp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as above, but touch the window first so everything is redrawn.
|
||||
*/
|
||||
void edit_refresh_clearok(void)
|
||||
{
|
||||
clearok(edit, TRUE);
|
||||
edit_refresh();
|
||||
clearok(edit, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Nice generic routine to update the edit buffer given a pointer to the
|
||||
* file struct =)
|
||||
*/
|
||||
void edit_update(filestruct * fileptr)
|
||||
void edit_update(filestruct * fileptr, int topmidbot)
|
||||
{
|
||||
int i = 0;
|
||||
filestruct *temp;
|
||||
@@ -861,10 +890,14 @@ void edit_update(filestruct * fileptr)
|
||||
return;
|
||||
|
||||
temp = fileptr;
|
||||
while (i <= editwinrows / 2 && temp->prev != NULL) {
|
||||
i++;
|
||||
temp = temp->prev;
|
||||
}
|
||||
if (topmidbot == 2)
|
||||
;
|
||||
else if (topmidbot == 0)
|
||||
for (i = 0; i <= editwinrows - 1 && temp->prev != NULL; i++)
|
||||
temp = temp->prev;
|
||||
else
|
||||
for (i = 0; i <= editwinrows / 2 && temp->prev != NULL; i++)
|
||||
temp = temp->prev;
|
||||
|
||||
edittop = temp;
|
||||
fix_editbot();
|
||||
@@ -872,37 +905,6 @@ void edit_update(filestruct * fileptr)
|
||||
edit_refresh();
|
||||
}
|
||||
|
||||
/* Now we want to update the screen using this struct as the top of the edit buffer */
|
||||
void edit_update_top(filestruct * fileptr)
|
||||
{
|
||||
int i;
|
||||
filestruct *temp = fileptr;
|
||||
|
||||
if (fileptr == NULL)
|
||||
return;
|
||||
|
||||
i = 0;
|
||||
while (i <= editwinrows / 2 && temp->next != NULL) {
|
||||
i++;
|
||||
temp = temp->next;
|
||||
}
|
||||
edit_update(temp);
|
||||
}
|
||||
|
||||
/* And also for the bottom... */
|
||||
void edit_update_bot(filestruct * fileptr)
|
||||
{
|
||||
int i;
|
||||
filestruct *temp = fileptr;
|
||||
|
||||
i = 0;
|
||||
while (i <= editwinrows / 2 - 1 && temp->prev != NULL) {
|
||||
i++;
|
||||
temp = temp->prev;
|
||||
}
|
||||
edit_update(temp);
|
||||
}
|
||||
|
||||
/* This function updates current based on where current_y is, reset_cursor
|
||||
does the opposite */
|
||||
void update_cursor(void)
|
||||
@@ -1087,7 +1089,8 @@ int total_refresh(void)
|
||||
clearok(edit, FALSE);
|
||||
clearok(topwin, FALSE);
|
||||
clearok(bottomwin, FALSE);
|
||||
|
||||
edit_refresh();
|
||||
titlebar();
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1191,7 +1194,8 @@ int do_help(void)
|
||||
for (i = 1; i < page; i++) {
|
||||
row = 0;
|
||||
j = 0;
|
||||
while (row < editwinrows && *ptr != '\0') {
|
||||
|
||||
while (row < editwinrows - 2 && *ptr != '\0') {
|
||||
if (*ptr == '\n' || j == COLS - 5) {
|
||||
j = 0;
|
||||
row++;
|
||||
@@ -1201,6 +1205,10 @@ int do_help(void)
|
||||
}
|
||||
}
|
||||
|
||||
if (i > 1) {
|
||||
|
||||
}
|
||||
|
||||
i = 0;
|
||||
j = 0;
|
||||
while (i < editwinrows && *ptr != '\0') {
|
||||
@@ -1229,7 +1237,6 @@ int do_help(void)
|
||||
continue;
|
||||
}
|
||||
} while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY);
|
||||
|
||||
if (no_help_flag) {
|
||||
werase(bottomwin);
|
||||
wrefresh(bottomwin);
|
||||
|
||||
Reference in New Issue
Block a user