Compare commits
108 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
a1a55c79c8 | ||
|
|
2ece167f56 | ||
|
|
0e5faca531 | ||
|
|
939fdbd64d | ||
|
|
293849eb69 | ||
|
|
1013e14a87 | ||
|
|
63aa0f7f16 | ||
|
|
cf037ba969 | ||
|
|
45dfda97d8 | ||
|
|
c9b1dba4a3 | ||
|
|
a417ddca91 | ||
|
|
461b2a9dfe | ||
|
|
962c3c9c21 | ||
|
|
05597197f3 | ||
|
|
f4e75e1256 | ||
|
|
d8346ffb84 | ||
|
|
90d6895e94 | ||
|
|
f1171c3c0e | ||
|
|
723845c0cc | ||
|
|
1d7110d657 | ||
|
|
edebbe6039 | ||
|
|
065bb1e1a0 | ||
|
|
231d3d6979 | ||
|
|
acb6234263 | ||
|
|
8f6c069543 | ||
|
|
fcf32bf3d1 | ||
|
|
aa44841315 | ||
|
|
a299b039c4 | ||
|
|
3088555a15 | ||
|
|
8d7ac1b004 | ||
|
|
82bd1b34f2 | ||
|
|
d19e9916cb | ||
|
|
ed0cb890fb | ||
|
|
fa8f7bf0dc | ||
|
|
6a2273d781 | ||
|
|
627de19ce0 | ||
|
|
7539a829c4 | ||
|
|
a966d991e6 | ||
|
|
635fae3ed0 | ||
|
|
2a4ef924c8 | ||
|
|
a4d2162091 | ||
|
|
6967eec4cb | ||
|
|
7ecc435f5a | ||
|
|
1e328fbd72 |
@@ -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.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
59
BUGS
59
BUGS
@@ -1,13 +1,7 @@
|
||||
- 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 }
|
||||
- Certains are not lined up properly when there are tabs in them at
|
||||
certain col values. (9) [FIXED]
|
||||
- edit_refresh() and update_line() do not handle selecting text when the
|
||||
cursor is beyond COLS (10) [FIXED]
|
||||
- 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)
|
||||
- Moving to the end of a line when close to a multiple of COLS and at
|
||||
least COLS * 2 does not make the screen jump early like it would for
|
||||
if we were around COLS (bugs in edit_refresh, update_line) (13)
|
||||
@@ -17,19 +11,14 @@
|
||||
(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)
|
||||
- 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:
|
||||
* *
|
||||
Error is in do_wrap, must be rewritten (18).
|
||||
- Wrapping a line with autoindent mode sometimes causes a segfault (19).
|
||||
Error is in do_wrap, must be rewritten. (18) [FIXED]
|
||||
- Nano fails to follow symlinks, even though -l isn't being used (20).
|
||||
[Bug in global flag init, FIXED]
|
||||
- When using --help or --version, the SIGINT character gets lost. (21) [FIXED]
|
||||
- When inserting files, the display sometimes fails to display properly
|
||||
until a pageup/down occurs (22).
|
||||
- edit_refresh() and update_line() (and related functions), have
|
||||
trouble when a tab is the character that is the boundry at COLS (23) [FIXED]
|
||||
- there is an off-by-one error in keeping track of totsize. It is caused
|
||||
@@ -37,4 +26,48 @@
|
||||
but we do not, in fact, display this newline. This should go away
|
||||
implicitly when the "Magic Line" returns, but it is noted here for
|
||||
documentation's sake. (24) [FIXED]
|
||||
- totsize becomes incorrect after word-wrapping (25)
|
||||
- In replace with completely adjacent strings, every other search string
|
||||
will be missed (try replace ':' in a string like ':::::::::') (28) [FIXED]
|
||||
- If nano opens a read-only file with the --tempfile option, and a change
|
||||
is made to the buffer, and a write is attempted, nano will not give you
|
||||
a dialog about not being able to write the file, and it will not let the
|
||||
user exit (29, discovered by Joshua Jensen) [FIXED]
|
||||
- Using nano -k, marked text is not cut properly. (31) [FIXED]
|
||||
- Invoking -t or -k has the effect of invoking both option. (32) [FIXED]
|
||||
- totsize becomes incorrect after word-wrapping (25) [FIXED]
|
||||
- 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]
|
||||
** 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)
|
||||
- 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) [FIXED?]
|
||||
- In replace, there is no way to accept the default replace string. (27)
|
||||
- totsize problems still abound in do_justify (33)
|
||||
- Alt-Z is current broken to toggle suspend. I guess I still don't know
|
||||
signals very well =-) (41).
|
||||
|
||||
$Id$
|
||||
|
||||
188
ChangeLog
188
ChangeLog
@@ -1,3 +1,189 @@
|
||||
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.
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- Added check for MARK_ISSET when using CUT_TO_END. Fixes bug #31.
|
||||
- Simplified check for freeing cutbuffer. Added checks for doing
|
||||
multiple cuts with -k, now sets marked_cut to 2 for later
|
||||
processing by do_uncut_text().
|
||||
do_uncut_text()
|
||||
- Added handler for uncutting with -k cuts.
|
||||
- files.c:
|
||||
write_file()
|
||||
- Removed (redundant) check for writing out files with -t.
|
||||
do_writeout()
|
||||
- Changed check for filename to filename[0]. Added some code,
|
||||
overall fixes bug #30 =-)
|
||||
- nano.c:
|
||||
do_justify() & do_wrap():
|
||||
- totsize-related fixes (Rob)
|
||||
- de.po
|
||||
- Revised translations by floki@bigfoot.com
|
||||
|
||||
nano-0.9.13 - 07/23/2000
|
||||
- Implemented Pico's -k mode. New flag CUT_TO_END, option (-k, --cut),
|
||||
affects do_cut_text in cut.c. Not available with SMALL_NANO because it
|
||||
depends on the marker code which is not available with that setting.
|
||||
- Changed static temp_opt to flag TEMP_OPT. Fixed bug #29 (using
|
||||
-t with an unwritable file causes users to get locked into editor).
|
||||
- move.c
|
||||
page_down()
|
||||
- Don't edit_refresh() if the bottom of the file is in the edit
|
||||
buffer. (Adam)
|
||||
- nano.c:
|
||||
main():
|
||||
- TABSIZE now set before first call to edit_refresh (Bill Soudan)
|
||||
- Different ^C kill code (patch by Christian Weisgerber).
|
||||
die():
|
||||
- More intelligent emergency-save filename selection (Rob)
|
||||
do_spell():
|
||||
- Changed exit semantincs a bit so that aspell wouldn't get
|
||||
all screwy (bug disovered by Joshua Jensen.
|
||||
- files.c:
|
||||
read_file():
|
||||
- Added init of buf variable, hopefully this will stop the
|
||||
"bleeding" of text seen with mutt and using i18n.
|
||||
write_file():
|
||||
- Added code to check to see if using -l and the file is not
|
||||
in fact a link. This should fix the behavior where a file
|
||||
that does not have write permission but could be removed and
|
||||
rewritten is saved without error. Please test this feature
|
||||
and give feedback.
|
||||
- search.c:
|
||||
search_init():
|
||||
- Added " (to replace)" statement to end of search string if
|
||||
we are doing a replace. Manually converted all the translations
|
||||
from '%s' to '%s%s' to ensure they still work with the new code.
|
||||
Also put in the translation for " (replace)" in the .po's. Hope
|
||||
I didn't step on your toes doing this Jordi. (Chris)
|
||||
do_search(), do_replace():
|
||||
- Removed call to search_abort()/replace_abort() before call to
|
||||
the opposite function.
|
||||
- Fixed bug #28.
|
||||
findnextstr()
|
||||
- do not center string found if it is currently visable. (Adam)
|
||||
- fr.po:
|
||||
- French update by Clement Laforet <clem_laf@wanadoo.fr>.
|
||||
- es.po:
|
||||
- Updated strings to 0.9.13 (Jordi).
|
||||
|
||||
nano-0.9.12 - 07/07/2000
|
||||
- all:
|
||||
- New regexp search feature by Bill Soudan. New flags USE_REGEXP
|
||||
@@ -770,3 +956,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 \
|
||||
@@ -14,7 +15,8 @@ man_MANS = nano.1
|
||||
nano_LDADD = @INTLLIBS@
|
||||
|
||||
EXTRA_DIST = AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README \
|
||||
TODO install-sh missing mkinstalldirs nano.1 nano.1.html
|
||||
TODO install-sh missing mkinstalldirs nano.1 nano.1.html \
|
||||
faq.html
|
||||
|
||||
SUBDIRS = po intl
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ nano_SOURCES = cut.c files.c global.c move.c nano.c nano.h proto.h
|
||||
man_MANS = nano.1
|
||||
nano_LDADD = @INTLLIBS@
|
||||
|
||||
EXTRA_DIST = AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README TODO install-sh missing mkinstalldirs nano.1 nano.1.html
|
||||
EXTRA_DIST = AUTHORS BUGS COPYING ChangeLog INSTALL NEWS README TODO install-sh missing mkinstalldirs nano.1 nano.1.html faq.html
|
||||
|
||||
|
||||
SUBDIRS = po intl
|
||||
|
||||
42
NEWS
42
NEWS
@@ -1,3 +1,43 @@
|
||||
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
|
||||
-k caused both flags to be used). The -k code is also now
|
||||
closer in functionality to Pico's -k mode, please
|
||||
note that this code is not finished yet. Working on this
|
||||
code has made me realize that there is not enough
|
||||
abstraction in the code, and I will be working on that
|
||||
for the next release. Until then, have fun with this
|
||||
version.
|
||||
|
||||
07/23/2000 - Nano 0.9.13 has a few new bits and bobs, most notably the
|
||||
-k option from Pico (cut to end of line). The majority
|
||||
of changes in this release are bugfixes however, including
|
||||
the usual display fixes and fixes for writing to symbolic
|
||||
links and un-writeable files. Barring any other major
|
||||
changes, this should be the feature set for nano 1.0,
|
||||
whenever it might be released =-)
|
||||
|
||||
07/07/2000 - Nano 0.9.12 (The "lucky day" release) is bursting with new
|
||||
features, bug fixes, and yummy fruit flavor. For
|
||||
changes, the alternate replace keystroke ^W^T is now
|
||||
@@ -224,3 +264,5 @@
|
||||
http://faculty.plattsburgh.edu/astyanax/nano. Please
|
||||
update your bookmarks, tell your friends, and all that
|
||||
jazz.
|
||||
|
||||
$Id$
|
||||
|
||||
2
README
2
README
@@ -80,3 +80,5 @@ Current Status
|
||||
can guess, I'm not much of an emacs fan ;)
|
||||
|
||||
Chris Allegretta (chrisa@asty.org)
|
||||
|
||||
$Id$
|
||||
|
||||
14
TODO
14
TODO
@@ -1,14 +1,22 @@
|
||||
TODO file (? means the feature may be implemented, but not definitely)
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
Current Version:
|
||||
- Implement Spelling [DONE, mostly...]
|
||||
- Implement Help [DONE]
|
||||
- Internationalization [In progress, translators welcome!]
|
||||
- Allow nano to be resized in X. [DONE]
|
||||
- Color syntax highlighting? (certainly seems like there's a demand for it.)
|
||||
- On page up/down, put the cursor on the first line (like Pico), not the
|
||||
center line [DONE]
|
||||
- Rewrite edit_refresh, if at all possible [DONE]
|
||||
- Implement justify function [DONE]
|
||||
- Cut to end of line [DONE]
|
||||
- Unjustify command (^U after ^J)
|
||||
|
||||
For Next Version:
|
||||
- Undo/Redo key?
|
||||
- single line scroll up/down?
|
||||
- Rewrite edit_refresh, if at all possible [In progress]
|
||||
- Implement justify function [DONE]
|
||||
- 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
|
||||
|
||||
|
||||
106
configure.in
106
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.12-cvs)
|
||||
AM_INIT_AUTOMAKE(nano, 0.9.16-cvs)
|
||||
AM_CONFIG_HEADER(config.h:config.h.in)
|
||||
ALL_LINGUAS="es de fr it id fi"
|
||||
|
||||
@@ -25,44 +26,75 @@ 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_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 +102,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 +137,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"
|
||||
|
||||
88
cut.c
88
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
|
||||
|
||||
@@ -133,22 +133,47 @@ int do_cut_text(void)
|
||||
filestruct *tmp, *fileptr = current;
|
||||
#ifndef NANO_SMALL
|
||||
char *tmpstr;
|
||||
int newsize;
|
||||
int newsize, cuttingtoend = 0;
|
||||
#endif
|
||||
|
||||
check_statblank();
|
||||
if (fileptr == NULL || fileptr->data == NULL)
|
||||
return 0;
|
||||
|
||||
tmp = fileptr->next;
|
||||
|
||||
if (!ISSET(KEEP_CUTBUFFER) || ISSET(MARK_ISSET)) {
|
||||
if (!ISSET(KEEP_CUTBUFFER)) {
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, _("Blew away cutbuffer =)\n"));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Must let cutbuffer get blown away first before we do this... */
|
||||
if (fileptr == filebot)
|
||||
return 0;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
if (current_x == strlen(current->data))
|
||||
{
|
||||
do_delete();
|
||||
SET(KEEP_CUTBUFFER);
|
||||
marked_cut = 2;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
SET(MARK_ISSET);
|
||||
SET(KEEP_CUTBUFFER);
|
||||
|
||||
mark_beginx = strlen(current->data);
|
||||
mark_beginbuf = current;
|
||||
cuttingtoend = 1;
|
||||
}
|
||||
}
|
||||
if (ISSET(MARK_ISSET)) {
|
||||
if (current->lineno == mark_beginbuf->lineno) {
|
||||
tmp = copy_node(current);
|
||||
@@ -183,9 +208,14 @@ int do_cut_text(void)
|
||||
|
||||
placewewant = xplustabs();
|
||||
UNSET(MARK_ISSET);
|
||||
|
||||
marked_cut = 1;
|
||||
set_modified();
|
||||
edit_update(current);
|
||||
if (cuttingtoend)
|
||||
edit_refresh();
|
||||
else
|
||||
edit_update(current, CENTER);
|
||||
|
||||
return 1;
|
||||
#else
|
||||
if (0) {
|
||||
@@ -200,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);
|
||||
@@ -218,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);
|
||||
}
|
||||
@@ -261,6 +281,7 @@ int do_uncut_text(void)
|
||||
int i;
|
||||
|
||||
wrap_reset();
|
||||
check_statblank();
|
||||
if (cutbuffer == NULL || fileptr == NULL)
|
||||
return 0; /* AIEEEEEEEEEEEE */
|
||||
|
||||
@@ -272,7 +293,7 @@ int do_uncut_text(void)
|
||||
|
||||
/* Hook newbuf into fileptr */
|
||||
#ifndef NANO_SMALL
|
||||
if (marked_cut == 1) {
|
||||
if (marked_cut) {
|
||||
/* If there's only one line in the cutbuffer */
|
||||
if (cutbuffer->next == NULL) {
|
||||
tmpstr =
|
||||
@@ -288,7 +309,6 @@ int do_uncut_text(void)
|
||||
|
||||
placewewant = xplustabs();
|
||||
update_cursor();
|
||||
renumber(current);
|
||||
} else { /* yuck -- no kidding! */
|
||||
tmp = current->next;
|
||||
/* New beginning */
|
||||
@@ -331,13 +351,27 @@ int do_uncut_text(void)
|
||||
|
||||
i = editbot->lineno;
|
||||
|
||||
renumber(current);
|
||||
|
||||
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
|
||||
and we don't want anything else on the line, so we have to
|
||||
screw up all the work we just did and separate the line. There
|
||||
must be a better way to do this, but not at 1AM on a work night. */
|
||||
|
||||
if (marked_cut == 2 && current_x != strlen(current->data)) {
|
||||
tmp = make_new_node(current);
|
||||
tmp->data = nmalloc(strlen(¤t->data[current_x]) + 1);
|
||||
strcpy(tmp->data, ¤t->data[current_x]);
|
||||
splice_node(current, tmp, current->next);
|
||||
null_at(current->data, current_x);
|
||||
current = current->next;
|
||||
current_x = 0;
|
||||
placewewant = 0;
|
||||
}
|
||||
renumber(current->prev);
|
||||
dump_buffer(fileage);
|
||||
dump_buffer(cutbuffer);
|
||||
set_modified();
|
||||
@@ -370,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);
|
||||
|
||||
|
||||
547
faq.html
Normal file
547
faq.html
Normal file
@@ -0,0 +1,547 @@
|
||||
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.16 i586) [Netscape]">
|
||||
</head>
|
||||
<body text="#000000" bgcolor="#FFFFFF" link="#0000EF" vlink="#51188E" alink="#FF0000">
|
||||
|
||||
<h1>
|
||||
<font color="#CC0000">The nano FAQ</font></h1>
|
||||
<h2>
|
||||
<font color="#330000">Table of Contents</font></h2>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#1">1. General</a></font></h2>
|
||||
|
||||
<blockquote><font color="#330000"><a href="#1.1">1.1 About this FAQ.</a></font>
|
||||
<br><font color="#330000"><a href="#1.2">1.2. How do I contribute to it?</a></font>
|
||||
<br><font color="#330000"><a href="#1.3">1.3. What is nano?</a></font>
|
||||
<br><font color="#330000"><a href="#1.4">1.4. What is the history behind
|
||||
nano?</a></font>
|
||||
<br><font color="#330000"><a href="#1.5">1.5. Why the name change from
|
||||
TIP?</a></font>
|
||||
<br><font color="#330000"><a href="#1.6">1.6 What is the current version
|
||||
of nano?</a></font>
|
||||
<br><font color="#330000"><a href="#1.7">1.7. I want to read the man page
|
||||
without having to download the program!</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#2">2. Where to get nano</a></font></h2>
|
||||
|
||||
<blockquote><font color="#330000"><a href="#2.1">2.1. FTP and WWW sites
|
||||
that carry nano.</a></font>
|
||||
<br><font color="#330000"><a href="#2.2">2.2. Redhat and derivatives (.rpm)
|
||||
packages.</a></font>
|
||||
<br><font color="#330000"><a href="#2.3">2.3. Debian (.deb) packages.</a></font>
|
||||
<br><font color="#330000"><a href="#2.4">2.4. By CVS (for the brave).</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#3">3. Installation and Configuration</a></font></h2>
|
||||
|
||||
<blockquote><font color="#330000"><a href="#3.1">3.1. How do install the
|
||||
RPM or DEB package?</a></font>
|
||||
<br><font color="#330000"><a href="#3.2">3.2. Compiling from source: WHAT
|
||||
THE HECK DO I DO NOW?</a></font>
|
||||
<br><font color="#330000"><a href="#3.2">3.3. Why does everything go into
|
||||
/usr/local?</a></font>
|
||||
<br><font color="#330000"><a href="#3.4">3.4. I get errors about 'bindtextdomain',
|
||||
'gettext' and/or 'gettextdomain'. What can I do about it?</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#4">4. Running</a></font></h2>
|
||||
|
||||
<blockquote><font color="#330000"><a href="#4.1">4.1. Ack! My backspace/delete/enter/double
|
||||
bucky/meta key doesn't seem to work! What can I do?</a></font>
|
||||
<br><font color="#330000"><a href="#4.2">4.2. Nano crashes when I type
|
||||
<insert keystroke here>!</a></font>
|
||||
<br><font color="#330000"><a href="#4.3">4.3. Nano crashes when I resize
|
||||
my window. How can I fix that?</a></font>
|
||||
<br><font color="#330000"><a href="#4.4">4.4. Why does nano show ^\ and
|
||||
^_ in the shortcut list instead of ^G and ^J?</a></font>
|
||||
<br><a href="#4.5">4.5 How do I make nano my default editor (in Pine, mutt,
|
||||
etc.)?</a></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#5">5. Internationalization</a></font></h2>
|
||||
|
||||
<blockquote><font color="#330000"><a href="#5.1">5.1. There's no translation
|
||||
for my language!</a></font>
|
||||
<br><font color="#330000"><a href="#5.2">5.2. I don't like the translation
|
||||
for <x> in my language. How can I fix it?</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#6">6. Advocacy and Licensing</a></font></h2>
|
||||
|
||||
<blockquote><font color="#330000"><a href="#6.1">6.1. Why should I use
|
||||
nano instead of Pico?</a></font>
|
||||
<br><font color="#330000"><a href="#6.2">6.2. Why should I use Pico instead
|
||||
of nano?</a></font>
|
||||
<br><font color="#330000"><a href="#6.3">6.3. What is so bad about the
|
||||
PINE license?</a></font>
|
||||
<br><font color="#330000"><a href="#6.4">6.4. Okay, well what mail program
|
||||
should I use then?</a></font>
|
||||
<br><font color="#330000"><a href="#6.5">6.5. Why doesn't UW simply change
|
||||
their license?</a></font>
|
||||
<br><font color="#330000"><a href="#6.6">6.6. What if tomorrow UW changes
|
||||
the license to be truly Free Software?</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<font color="#330000"><a href="#7">7. Miscellaneous</a></font></h2>
|
||||
|
||||
<blockquote><font color="#330000"><a href="#7.1">7.1. Nano related mailing
|
||||
lists.</a></font>
|
||||
<br><font color="#330000"><a href="#7.2">7.2. I want to send the development
|
||||
team a big load of cash (or just a thank you).</a></font>
|
||||
<br><font color="#330000"><a href="#7.3">7.3. How do I submit a patch?</a></font>
|
||||
<br><font color="#330000"><a href="#7.4">7.4. How do I join the development
|
||||
team?</a></font>
|
||||
<br><font color="#330000"><a href="#7.5">7.5. Can I have CVS write access?</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a href="#8">8. ChangeLog</a></h2>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<br>
|
||||
<h1>
|
||||
<a NAME="1"></a><font color="#330000">1. General</font></h1>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.1"></a><font color="#330000">1.1 About this FAQ.</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">This FAQ was written and is maintained
|
||||
by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>,
|
||||
who also happens to be the creator of nano. Maybe someone else
|
||||
will volunteer to maintain this FAQ someday, who knows...</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<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
|
||||
it is useful enough it will be included in future versions.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.3"></a><font color="#330000">1.3. What is nano?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Nano is designed to be a free replacement
|
||||
for the Pico text editor, part of the PINE email suite from <a href="http://www.washington.edu/pine">The
|
||||
University of Washington</a>. It aims to "emulate Pico as closely
|
||||
as possible and perhaps include extra functionality WITHOUT breaking compatibility
|
||||
with Pico.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.4"></a><font color="#330000">1.4. What is the history behind
|
||||
nano?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Funny you should ask!</font>
|
||||
<p><b><font color="#330000">In the beginning...</font></b>
|
||||
<p><font color="#330000">For years Pine was THE program used to read email
|
||||
on a Unix system. The Pico text editor is the portion of the program
|
||||
one would use to compose his or her mail messages. Many beginners
|
||||
to Unix flocked to Pico and Pine because of their well organized, easy
|
||||
to use interfaces. With the proliferation of Linux in the mid to
|
||||
late 90's, many University students became intimately familiar with the
|
||||
strengths (and weaknesses) of Pine and Pico.</font>
|
||||
<p><b><font color="#330000">Then came debian...</font></b>
|
||||
<p><font color="#330000">The <a href="http://www.debian.org">debian GNU/Linux</a>
|
||||
distribution, known for its strict standards in distributing truly "free"
|
||||
software (i.e. had no restrictions on redistribution), would not include
|
||||
a binary package for Pine or Pico. Many people had a serious dilemma:
|
||||
they loved these programs, but they were not truly free software in the
|
||||
<a href="http://www.gnu.org/philosophy/free-sw.html">GNU</a>
|
||||
sense of the word.</font>
|
||||
<p><b><font color="#330000">The event...</font></b>
|
||||
<p><font color="#330000">It was in late 1999 when Chris Allegretta (our
|
||||
hero) was yet again complaining to himself about the less-than-perfect
|
||||
license Pico was distributed under, the 10000 makefiles that came with
|
||||
it and how just a few small improvements could make it the Best Editor
|
||||
in the World (TM). Having been a convert from Slackware to debian,
|
||||
he missed having a simple binary package that included Pine and Pico, and
|
||||
had grown tired of downloading them himself.</font>
|
||||
<p><font color="#330000">Finally something snapped inside and Chris coded
|
||||
and hacked like a madman for many hours straight one weekend to make a
|
||||
(barely usable) Pico clone, at the time called TIP (Tip Isn't Pico).
|
||||
The program could not be invoked without a filename, could not save files,
|
||||
had no help menu, spell checker, and so forth. But over time it improved,
|
||||
and with the help of a few great coders it matured to the almost stable
|
||||
state it is today.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.5"></a><font color="#330000">1.5. Why the name change from TIP?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">On January 10, 2000, TIP was officially
|
||||
renamed to nano because of a namespace conflict with another program called
|
||||
'tip'. The original 'tip' program "establishes a full duplex terminal
|
||||
connection to a remote host", and was included with many older Unix systems
|
||||
(and newer ones like Solaris). The conflict was not noticed at first because
|
||||
there is no 'tip' utility included with most Linux distributions (where
|
||||
nano was developed).</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.6"></a><font color="#330000">1.6 What is the current version
|
||||
of nano?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The current version of nano *should*
|
||||
be 0.9.16. Of course you should always check the nano hompage to
|
||||
see what the latest and greatest version is.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="1.7"></a><font color="#330000">1.7. I want to read the man page
|
||||
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>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
<a NAME="2"></a><font color="#330000">2. Where to get nano</font></h1>
|
||||
|
||||
<h2>
|
||||
<a NAME="2.1"></a><font color="#330000">2.1. FTP and WWW sites that carry
|
||||
nano.</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The nano distribution can be downloaded
|
||||
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>
|
||||
|
||||
<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>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://nano.sourceforge.net/pub/nano/">ftp://nano.sourceforge.net/pub/nano</a></font></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="2.2"></a><font color="#330000">2.2. Redhat and derivatives (.rpm)
|
||||
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>
|
||||
|
||||
<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>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://nano.sourceforge.net/pub/nano/RPMS">ftp://nano.sourceforge.net/pub/nano/RPMS</a></font></li>
|
||||
</ul>
|
||||
<font color="#330000">Additionally, check out the Redhat contribs section
|
||||
at:</font>
|
||||
<ul>
|
||||
<li>
|
||||
<font color="#330000"><a href="http://metalab.unc.edu/pub/Linux/distributions/redhat/contrib/libc6/i386">http://metalab.unc.edu/pub/Linux/distributions/redhat/contrib/libc6/i386</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="ftp://metalab.unc.edu/pub/Linux/distributions/redhat/contrib/libc6/i386">ftp://metalab.unc.edu/pub/Linux/distributions/redhat/contrib/libc6/i386</a></font></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="2.3"></a><font color="#330000">2.3. Debian (.deb) packages.</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">For debian users, you can check out the
|
||||
current nano packages for:</font>
|
||||
<ul>
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.debian.org/Packages/frozen/editors/nano.html">frozen</a></font></li>
|
||||
|
||||
<li>
|
||||
<font color="#330000"><a href="http://www.debian.org/Packages/unstable/editors/nano.html">unstable</a></font></li>
|
||||
</ul>
|
||||
<font color="#330000">Note that versions < 0.9.10 are probably not for
|
||||
those wanting to get serious work done, so until the frozen/stable distributions
|
||||
have an updated version of nano, you are best off using the one in unstable
|
||||
for now.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="2.4"></a><font color="#330000">2.4. By CVS (for the brave).</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">For the 'bleeding edge' current version
|
||||
of nano, you can use CVS to download the current source code. <b>Note:</b>
|
||||
believe it or not, by downloading code that has not yet stabilized into
|
||||
an official release, there could quite possibly be bugs, in fact the code
|
||||
may not even compile! Anyway, see <a href="https://sourceforge.net/cvs/?group_id=1304">the
|
||||
nano CVS page</a> for info on anonymous CVS access to the nano source.</font></blockquote>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
<a NAME="3"></a><font color="#330000">3. Installation and Configuration</font></h1>
|
||||
|
||||
<h2>
|
||||
<a NAME="3.1"></a><font color="#330000">3.1. How do install the RPM or
|
||||
DEB package?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">It's simple really! As root, type
|
||||
<b>rpm
|
||||
-Uvh nano-x.y.z-1.i386.rpm</b> if you have a Redhat-ish system or
|
||||
<b>dpkg
|
||||
-i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where
|
||||
<b>x.y.z</b>
|
||||
is the release of nano. There are other programs to install programs,
|
||||
and if you wish to use those, knock yourself out.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="3.2"></a><font color="#330000">3.2. Compiling from source: WHAT
|
||||
THE HECK DO I DO NOW?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Okay, take a deep breath, this really
|
||||
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">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>
|
||||
<p><b><font color="#330000">./configure</font></b>
|
||||
<br><b><font color="#330000">make</font></b>
|
||||
<br><font color="#330000"><b>make install </b>(as root, of course)</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="3.3"></a><font color="#330000">3.3. Why does everything go into
|
||||
/usr/local?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Well, that's what the <b>configure</b>
|
||||
script defaults to. If you wish to change this, simply do this:</font>
|
||||
<p><b><font color="#330000">./configure --prefix=/usr</font></b>
|
||||
<p><font color="#330000">to put nano into /usr/bin when you run <b>make
|
||||
install</b>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="3.4"></a><font color="#330000">3.4. I get errors about 'bindtextdomain',
|
||||
'gettext' and/or 'gettextdomain'. What can I do about it?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Try doing a <b>./configure --with-included-gettext</b>
|
||||
and see if that solves your problem. You make need to do a <b>make
|
||||
clean ; make</b> to get it to work fully.</font></blockquote>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
<a NAME="4"></a><font color="#330000">4. Running</font></h1>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.1"></a><font color="#330000">4.1. Ack! My backspace/delete/enter/double
|
||||
bucky/meta key doesn't seem to work! What can I do?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Try setting your $TERM variable to 'vt100'.
|
||||
Nano doesn't yet support every term entry under the sun.</font>
|
||||
<p><font color="#330000">Bourne shell users (like bash): <b>export TERM=vt100</b></font>
|
||||
<br><font color="#330000">C Shell users (tcsh and csh): <b>setenv TERM
|
||||
vt100</b></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.2"></a><font color="#330000">4.2. Nano crashes when I type <insert
|
||||
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>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.3"></a><font color="#330000">4.3. Nano crashes when I resize
|
||||
my window. How can I fix that?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Older versions of nano had this problem,
|
||||
please upgrade to a newer version (at least 0.9.9 would be great, 0.9.
|
||||
12 is recommended).</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.4"></a><font color="#330000">4.4. Why does nano show ^\ and
|
||||
^_ in the shortcut list instead of ^G and ^J?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The help (^G) and justify (^J) functions
|
||||
were among the last to be written. To show the improvements that
|
||||
nano had over Pico (goto line # and replace), ^_ and ^\ were put on the
|
||||
shortcut list. If you use the <b>-p</b> option to nano you
|
||||
will get the same shortcuts at the bottom as Pico.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="4.5"></a>4.5 How do I make nano my default editor (in Pine, mutt,
|
||||
etc)?</h2>
|
||||
|
||||
<blockquote>You need to make nano your $EDITOR. If you want this
|
||||
to be saved, you should put a line like this in your <b>.bashrc</b> if
|
||||
you use bash:
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b>
|
||||
<p>or if you use tcsh put this in your <b>.cshrc</b> file:
|
||||
<p><b>setenv EDITOR /usr/local/bin/nano</b>
|
||||
<p>Change /usr/local/bin/nano to wherever nano is installed in your system.
|
||||
Type which nano to find out. This will not take effect until the next time
|
||||
you login. So log out and back in again.
|
||||
<p>Then on top that if you use Pine you must go into setup (type <b>S</b>
|
||||
at the main menu), then configure (type <b>C</b>). Hit enter on the
|
||||
lines that say:
|
||||
<p><b>[ ] enable-alternate-editor-cmd</b>
|
||||
<br><b>[ ] enable-alternate-editor-implicitly</b>
|
||||
<p>Then exit (<b>E</b>) and select Yes (<b>Y</b>).
|
||||
<p>Mutt users should see an effect immediately the next time you log in,
|
||||
no further configuration is needed. However, if you want to let people
|
||||
know you use nano to compose your email messages, you can put a line like
|
||||
this in your <b>.muttrc</b>:
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b>
|
||||
<p>Again, replace x.y.z with the version of nano you use.
|
||||
<br> </blockquote>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
<a NAME="5"></a><font color="#330000">5. Internationalization</font></h1>
|
||||
|
||||
<h2>
|
||||
<a NAME="5.1"></a><font color="#330000">5.1. There's no translation for
|
||||
my language!</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">So, uh, get someone who speaks your native
|
||||
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>
|
||||
|
||||
<h2>
|
||||
<a NAME="5.2"></a><font color="#330000">5.2. I don't like the translation
|
||||
for <x> in my language. How can I fix it?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The best way would probably be to e-mail
|
||||
the person listed in the <b><your_language>.po</b> file with your suggested
|
||||
corrections and they can in turn forward it to the nano email address,
|
||||
or the devel list.</font></blockquote>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
<a NAME="6"></a><font color="#330000">6. Advocacy and Licensing</font></h1>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.1"></a><font color="#330000">6.1. Why should I use nano instead
|
||||
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
|
||||
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
|
||||
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
|
||||
Pico is the editor for you. If you're looking for a few more
|
||||
features and a 'better' license as far as adding your own changes (sacrificing
|
||||
mailer integration and a little stability), nano is the way to go.</blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.3"></a><font color="#330000">6.3. What is so bad about the PINE
|
||||
license?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Technically there is nothing "wrong"
|
||||
with the U of W license for Pine and Pico. However, it is not
|
||||
considered truly "free" according to the <a href="http://www.debian.org/social_contract#guidelines">Debian
|
||||
Free Software Guidelines</a>. The only real problem as far as I'm
|
||||
aware as that there are limitations on the redistribution of programs based
|
||||
on the Pine and Pico source. So at a real nitty gritty level,
|
||||
these programs are not considered Free Software. This is why Pico
|
||||
isn't distributed in binary form in debian, and hence one of the main reasons
|
||||
nano was started.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.4"></a><font color="#330000">6.4. Okay, well what mail program
|
||||
should I use then?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Well, there is nothing stopping you from
|
||||
using Pine with nano (or Pine with Pico for that matter). But if
|
||||
you want to use programs that are considered Free Software, you may want
|
||||
to look into <a href="http://www.mutt.org">mutt</a>. It is a full-screen,
|
||||
console based mail program that actually has a lot more flexibility than
|
||||
Pine, but has a keymap included in the distribution that allows you to
|
||||
use the same keystrokes as Pine would to send and receive mail. It's
|
||||
also licensed under the GPL.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.5"></a><font color="#330000">6.5. Why doesn't UW simply change
|
||||
their license?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">You're really not asking the right person
|
||||
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>
|
||||
|
||||
<h2>
|
||||
<a NAME="6.6"></a><font color="#330000">6.6. What if tomorrow UW changes
|
||||
the license to be truly Free Software?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Honestly nothing would make me happier
|
||||
than to see that happen. Nano would continue to be developed independently
|
||||
until such time as Pico had all the features nano did or the projects merged.
|
||||
That just does not seem very likely given that there has been no sign of
|
||||
any changes in the past few years in a positive direction.</font></blockquote>
|
||||
|
||||
<hr WIDTH="100%">
|
||||
<h1>
|
||||
<a NAME="7"></a><font color="#330000">7. Miscellaneous</font></h1>
|
||||
|
||||
<h2>
|
||||
<a NAME="7.1"></a><font color="#330000">7.1. Nano related mailing lists.</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">There are two mailing lists for nano
|
||||
hosted at <a href="http://www.sourceforge.net">SourceForge</a>, nano-announce
|
||||
and nano-devel. Nano-announce is a very low traffic list where new
|
||||
versions of nano are announced (surprise!) Nano-devel is a sometimes
|
||||
low, sometimes very high traffic list for dicussing the present and future
|
||||
development of nano. Here are links to where you can sign up for
|
||||
a given list:</font><font color="#330000"></font>
|
||||
<p><font color="#330000">nano-announce - <a href="http://lists.sourceforge.net/mailman/listinfo/nano-announce">http://lists.sourceforge.net/mailman/listinfo/nano-announce</a></font>
|
||||
<br><font color="#330000">nano-devel - <a href="http://lists.sourceforge.net/mailman/listinfo/nano-devel">http://lists.sourceforge.net/mailman/listinfo/nano-devel</a></font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="7.2"></a><font color="#330000">7.2. I want to send the development
|
||||
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
|
||||
feature</a> and send us that instead (though cash is fine too).</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="7.3"></a><font color="#330000">7.3. How do I submit a patch?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">See Section <a href="#7.2">7.2</a>.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="7.4"></a><font color="#330000">7.4. How do I join the development
|
||||
team?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">The easiest way is to consistently send
|
||||
in good patches that add some needed functionality, fix a bug or two and/or
|
||||
make the program more optimized/efficient. Then ask nicely and you
|
||||
will probably be added to the SourceForge development list and be given
|
||||
CVS write after awhile. There is a lot of responsibility that goes
|
||||
along with being a team member, so don't think it's just something to add
|
||||
to your resume.</font></blockquote>
|
||||
|
||||
<h2>
|
||||
<a NAME="7.5"></a><font color="#330000">7.5. Can I have CVS write access?</font></h2>
|
||||
|
||||
<blockquote><font color="#330000">Re-read Section </font><a href="#7.4">7.4</a><font color="#330000">
|
||||
and you should know the answer.</font></blockquote>
|
||||
|
||||
<h1>
|
||||
<a NAME="8"></a>8. ChangeLog</h1>
|
||||
|
||||
<blockquote>06/31/2000 - Initial framework.</blockquote>
|
||||
<P>
|
||||
$Id$
|
||||
</body>
|
||||
</html>
|
||||
55
files.c
55
files.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* files.c *
|
||||
* *
|
||||
@@ -125,7 +126,7 @@ filestruct *read_line(char *buf, filestruct * prev, int *line1ins)
|
||||
|
||||
int read_file(int fd, char *filename)
|
||||
{
|
||||
long size, lines = 0, linetemp = 0;
|
||||
long size, num_lines = 0, linetemp = 0;
|
||||
char input[2]; /* buffer */
|
||||
char *buf;
|
||||
long i = 0, bufx = 128;
|
||||
@@ -133,6 +134,7 @@ int read_file(int fd, char *filename)
|
||||
int line1ins = 0;
|
||||
|
||||
buf = nmalloc(bufx);
|
||||
buf[0] = '\0';
|
||||
|
||||
if (fileptr != NULL && fileptr->prev != NULL) {
|
||||
fileptr = fileptr->prev;
|
||||
@@ -148,7 +150,7 @@ int read_file(int fd, char *filename)
|
||||
linetemp = 0;
|
||||
if (input[0] == '\n') {
|
||||
fileptr = read_line(buf, fileptr, &line1ins);
|
||||
lines++;
|
||||
num_lines++;
|
||||
buf[0] = 0;
|
||||
i = 0;
|
||||
} else {
|
||||
@@ -171,13 +173,13 @@ int read_file(int fd, char *filename)
|
||||
/* Did we not get a newline but still have stuff to do? */
|
||||
if (buf[0]) {
|
||||
fileptr = read_line(buf, fileptr, &line1ins);
|
||||
lines++;
|
||||
num_lines++;
|
||||
buf[0] = 0;
|
||||
}
|
||||
/* Did we even GET a file? */
|
||||
if (totsize == 0) {
|
||||
new_file();
|
||||
statusbar(_("Read %d lines"), lines);
|
||||
statusbar(_("Read %d lines"), num_lines);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -194,8 +196,8 @@ int read_file(int fd, char *filename)
|
||||
/* Update the edit buffer */
|
||||
load_file();
|
||||
}
|
||||
statusbar(_("Read %d lines"), lines);
|
||||
totlines += lines;
|
||||
statusbar(_("Read %d lines"), num_lines);
|
||||
totlines += num_lines;
|
||||
|
||||
free(buf);
|
||||
close(fd);
|
||||
@@ -260,7 +262,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();
|
||||
|
||||
@@ -281,7 +283,7 @@ int do_insertfile(void)
|
||||
* print out how many lines we wrote on the statusbar.
|
||||
*
|
||||
* Note that tmp is only set to 1 for storing temporary files internal
|
||||
* to the editor, and is completely different from temp_opt.
|
||||
* to the editor, and is completely different from TEMP_OPT.
|
||||
*/
|
||||
int write_file(char *name, int tmp)
|
||||
{
|
||||
@@ -299,11 +301,21 @@ int write_file(char *name, int tmp)
|
||||
fileptr = fileage;
|
||||
|
||||
|
||||
/* Check to see if the file is a regular file and FOLLOW_SYMLINKS is
|
||||
set. If so then don't do the delete and recreate code which would
|
||||
cause unexpected behavior */
|
||||
lstat(name, &st);
|
||||
|
||||
/* Open the file and truncate it. Trust the symlink. */
|
||||
if (ISSET(FOLLOW_SYMLINKS) && !tmp) {
|
||||
if ((ISSET(FOLLOW_SYMLINKS) || !S_ISLNK(st.st_mode)) && !tmp) {
|
||||
|
||||
if ((fd = open(name, O_WRONLY | O_CREAT | O_TRUNC,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH |
|
||||
S_IWOTH)) == -1) {
|
||||
if (ISSET(TEMP_OPT)) {
|
||||
UNSET(TEMP_OPT);
|
||||
return do_writeout(1);
|
||||
}
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
return -1;
|
||||
@@ -320,14 +332,16 @@ int write_file(char *name, int tmp)
|
||||
strcat(buf, name);
|
||||
strcat(buf, ".XXXXXX");
|
||||
if ((fd = mkstemp(buf)) == -1) {
|
||||
if (ISSET(TEMP_OPT)) {
|
||||
UNSET(TEMP_OPT);
|
||||
return do_writeout(1);
|
||||
}
|
||||
statusbar(_("Could not open file for writing: %s"),
|
||||
strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
dump_buffer(fileage);
|
||||
while (fileptr != NULL && fileptr->next != NULL) {
|
||||
/* Next line is so we discount the "magic line" */
|
||||
@@ -430,10 +444,21 @@ int do_writeout(int exiting)
|
||||
|
||||
strncpy(answer, filename, 132);
|
||||
|
||||
if ((exiting) && (temp_opt) && (filename)) {
|
||||
i = write_file(answer, 0);
|
||||
display_main_list();
|
||||
return i;
|
||||
if ((exiting) && (ISSET(TEMP_OPT))) {
|
||||
if (filename[0])
|
||||
{
|
||||
i = write_file(answer, 0);
|
||||
display_main_list();
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
UNSET(TEMP_OPT);
|
||||
do_exit();
|
||||
|
||||
/* They cancelled, abort quit */
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
while (1) {
|
||||
|
||||
56
global.c
56
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,6 +78,7 @@ 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 */
|
||||
|
||||
@@ -96,6 +100,52 @@ 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");
|
||||
toggle_regexp_msg = _("Regular expressions");
|
||||
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);
|
||||
toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
|
||||
USE_REGEXP);
|
||||
#endif
|
||||
}
|
||||
|
||||
void shortcut_init(void)
|
||||
{
|
||||
char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg = "",
|
||||
@@ -147,7 +197,6 @@ 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);
|
||||
@@ -337,4 +386,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);
|
||||
|
||||
7
nano.1
7
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.
|
||||
|
||||
10
nano.1.html
10
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>
|
||||
@@ -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>
|
||||
|
||||
464
nano.c
464
nano.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* nano.c *
|
||||
* *
|
||||
@@ -58,14 +59,12 @@
|
||||
#endif
|
||||
|
||||
/* Former globals, now static */
|
||||
char *last_search; /* Last string we searched for */
|
||||
char *last_replace; /* Last replacement string */
|
||||
int temp_opt = 0; /* Editing temp file (pico -t option) */
|
||||
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)
|
||||
@@ -95,10 +94,15 @@ void die(char *msg, ...)
|
||||
va_end(ap);
|
||||
|
||||
/* if we can't save we have REAL bad problems,
|
||||
* but we might as well TRY. FIXME: This should probabally base it
|
||||
* off of the current filename */
|
||||
write_file("nano.save", 0);
|
||||
|
||||
* but we might as well TRY. */
|
||||
if(filename[0] == '\0') {
|
||||
write_file("nano.save", 0);
|
||||
} else {
|
||||
char buf[BUFSIZ];
|
||||
strncpy(buf,filename,BUFSIZ);
|
||||
strncat(buf,".save",BUFSIZ - strlen(buf));
|
||||
write_file(buf, 0);
|
||||
}
|
||||
/* Restore the old term settings */
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
@@ -143,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)
|
||||
@@ -166,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
|
||||
|
||||
@@ -303,15 +305,20 @@ 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
|
||||
printf(_
|
||||
(" -R --regexp Use regular expressions for search\n"));
|
||||
@@ -323,6 +330,10 @@ void usage(void)
|
||||
(" -c --const Constantly show cursor position\n"));
|
||||
printf(_
|
||||
(" -h --help Show this message\n"));
|
||||
#ifndef NANO_SMALL
|
||||
printf(_
|
||||
(" -k --cut Let ^K cut from cursor to end of line\n"));
|
||||
#endif
|
||||
printf(_
|
||||
(" -i --autoindent Automatically indent new lines\n"));
|
||||
printf(_
|
||||
@@ -354,13 +365,14 @@ 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"));
|
||||
printf(_(" -h Show this message\n"));
|
||||
#ifndef NANO_SMALL
|
||||
printf(_(" -k Let ^K cut from cursor to end of line\n"));
|
||||
#endif
|
||||
printf(_(" -i Automatically indent new lines\n"));
|
||||
printf(_
|
||||
(" -l Don't follow symbolic links, overwrite.\n"));
|
||||
@@ -406,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
|
||||
@@ -499,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);
|
||||
@@ -521,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++;
|
||||
@@ -577,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);
|
||||
|
||||
}
|
||||
|
||||
@@ -622,8 +640,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)
|
||||
@@ -700,8 +718,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;
|
||||
@@ -748,9 +765,7 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
if (isspace(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])) {
|
||||
@@ -801,18 +816,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;
|
||||
}
|
||||
@@ -833,10 +836,12 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
|
||||
|
||||
totlines++;
|
||||
totsize++;
|
||||
/* Everything about it makes me want this line here but it causes
|
||||
* totsize to be high by one for some reason. Sigh. (Rob) */
|
||||
/* totsize++; */
|
||||
|
||||
renumber(inptr);
|
||||
edit_update_top(edittop);
|
||||
edit_update(edittop, TOP);
|
||||
|
||||
|
||||
/* Move the cursor to the new line if appropriate. */
|
||||
@@ -849,7 +854,7 @@ void do_wrap(filestruct * inptr, char input_char)
|
||||
do_right();
|
||||
}
|
||||
|
||||
edit_update_top(edittop);
|
||||
edit_update(edittop, TOP);
|
||||
reset_cursor();
|
||||
edit_refresh();
|
||||
}
|
||||
@@ -901,15 +906,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;
|
||||
@@ -942,7 +938,7 @@ int do_backspace(void)
|
||||
current = previous->next;
|
||||
else
|
||||
current = previous;
|
||||
page_up();
|
||||
page_up_center();
|
||||
} else {
|
||||
if (previous->next)
|
||||
current = previous->next;
|
||||
@@ -1043,6 +1039,7 @@ void exit_spell(char *tmpfilename, char *foo)
|
||||
|
||||
if (remove(tmpfilename) == -1)
|
||||
statusbar(_("Error deleting tempfile, ack!"));
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1080,7 +1077,6 @@ int do_spell(void)
|
||||
}
|
||||
|
||||
endwin();
|
||||
resetty();
|
||||
if (alt_speller) {
|
||||
if ((i = system(foo)) == -1 || i == 32512) {
|
||||
statusbar(_("Could not invoke spell program \"%s\""),
|
||||
@@ -1093,12 +1089,13 @@ int do_spell(void)
|
||||
exit_spell(temp, foo);
|
||||
return 0;
|
||||
}
|
||||
initscr();
|
||||
/* initscr(); */
|
||||
refresh();
|
||||
|
||||
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"));
|
||||
@@ -1113,7 +1110,7 @@ int do_exit(void)
|
||||
if (!ISSET(MODIFIED))
|
||||
finish(0);
|
||||
|
||||
if (temp_opt) {
|
||||
if (ISSET(TEMP_OPT)) {
|
||||
i = 1;
|
||||
} else {
|
||||
i =
|
||||
@@ -1143,6 +1140,7 @@ int do_exit(void)
|
||||
void do_mouse(void)
|
||||
{
|
||||
MEVENT mevent;
|
||||
int foo = 0, tab_found = 0;
|
||||
|
||||
if (getmouse(&mevent) == ERR)
|
||||
return;
|
||||
@@ -1185,6 +1183,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);
|
||||
|
||||
@@ -1202,6 +1217,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)
|
||||
{
|
||||
@@ -1259,7 +1297,7 @@ void handle_sigwinch(int s)
|
||||
fix_editbot();
|
||||
|
||||
if (current_y > editwinrows - 1) {
|
||||
edit_update(editbot);
|
||||
edit_update(editbot, CENTER);
|
||||
}
|
||||
erase();
|
||||
|
||||
@@ -1272,6 +1310,52 @@ 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 mouse_init(void)
|
||||
{
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
if (ISSET(USE_MOUSE)) {
|
||||
mousemask(BUTTON1_RELEASED, NULL);
|
||||
mouseinterval(50);
|
||||
}
|
||||
else {
|
||||
mousemask(0, NULL);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int do_tab(void)
|
||||
{
|
||||
do_char('\t');
|
||||
@@ -1387,56 +1471,61 @@ int do_justify(void)
|
||||
|
||||
unlink_node(tmpnode);
|
||||
delete_node(tmpnode);
|
||||
|
||||
}
|
||||
|
||||
totsize -= strlen(current->data);
|
||||
|
||||
justify_format(current->data);
|
||||
|
||||
slen = strlen(current->data);
|
||||
while ((strlenpt(current->data) > (fill))
|
||||
&& !no_spaces(current->data)) {
|
||||
int i = 0;
|
||||
int len2 = 0;
|
||||
filestruct *tmpline = nmalloc(sizeof(filestruct));
|
||||
totsize += slen;
|
||||
|
||||
/* Start at fill , unless line isn't that long (but it appears at least
|
||||
* fill long with tabs.
|
||||
*/
|
||||
if (slen > fill)
|
||||
i = fill;
|
||||
else
|
||||
i = slen;
|
||||
for (; i > 0; i--) {
|
||||
if (isspace(current->data[i]) &&
|
||||
((strlenpt(current->data) - strlen(current->data + i)) <=
|
||||
fill)) break;
|
||||
}
|
||||
if (!i)
|
||||
break;
|
||||
if((strlenpt(current->data) > (fill))
|
||||
&& !no_spaces(current->data)) {
|
||||
do {
|
||||
int i = 0;
|
||||
int len2 = 0;
|
||||
filestruct *tmpline = nmalloc(sizeof(filestruct));
|
||||
|
||||
current->data[i] = '\0';
|
||||
/* Start at fill , unless line isn't that long (but it
|
||||
* appears at least fill long with tabs.
|
||||
*/
|
||||
if (slen > fill)
|
||||
i = fill;
|
||||
else
|
||||
i = slen;
|
||||
for (; i > 0; i--) {
|
||||
if (isspace(current->data[i]) &&
|
||||
((strlenpt(current->data) - strlen(current->data +i)) <=
|
||||
fill)) break;
|
||||
}
|
||||
if (!i)
|
||||
break;
|
||||
|
||||
len2 = strlen(current->data + i + 1);
|
||||
tmpline->data = nmalloc(len2 + 1);
|
||||
current->data[i] = '\0';
|
||||
|
||||
/* Skip the white space in current. */
|
||||
memcpy(tmpline->data, current->data + i + 1, len2);
|
||||
tmpline->data[len2] = '\0';
|
||||
len2 = strlen(current->data + i + 1);
|
||||
tmpline->data = nmalloc(len2 + 1);
|
||||
|
||||
current->data = nrealloc(current->data, i + 1);
|
||||
/* Skip the white space in current. */
|
||||
memcpy(tmpline->data, current->data + i + 1, len2);
|
||||
tmpline->data[len2] = '\0';
|
||||
|
||||
tmpline->prev = current;
|
||||
tmpline->next = current->next;
|
||||
if (current->next != NULL)
|
||||
current->next->prev = tmpline;
|
||||
current->data = nrealloc(current->data, i + 1);
|
||||
|
||||
current->next = tmpline;
|
||||
current = tmpline;
|
||||
slen -= i + 1;
|
||||
current_y++;
|
||||
tmpline->prev = current;
|
||||
tmpline->next = current->next;
|
||||
if (current->next != NULL)
|
||||
current->next->prev = tmpline;
|
||||
|
||||
current->next = tmpline;
|
||||
current = tmpline;
|
||||
slen -= i + 1;
|
||||
current_y++;
|
||||
} while ((strlenpt(current->data) > (fill))
|
||||
&& !no_spaces(current->data));
|
||||
}
|
||||
|
||||
|
||||
if (current->next)
|
||||
current = current->next;
|
||||
else
|
||||
@@ -1451,13 +1540,12 @@ 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();
|
||||
}
|
||||
|
||||
|
||||
edit_refresh();
|
||||
statusbar("Justify Complete");
|
||||
return 1;
|
||||
@@ -1480,6 +1568,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)
|
||||
@@ -1492,7 +1585,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))
|
||||
@@ -1502,31 +1595,86 @@ 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)) {
|
||||
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);
|
||||
UNSET(toggles[which].flag);
|
||||
} 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(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:
|
||||
handle_sigwinch(1);
|
||||
break;
|
||||
}
|
||||
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
|
||||
char *argv0;
|
||||
struct termios term;
|
||||
|
||||
@@ -1542,6 +1690,9 @@ int main(int argc, char *argv[])
|
||||
{"nowrap", 0, 0, 'w'},
|
||||
{"nohelp", 0, 0, 'x'},
|
||||
{"help", 0, 0, 'h'},
|
||||
#ifndef NANO_SMALL
|
||||
{"cut", 0, 0, 'k'},
|
||||
#endif
|
||||
{"autoindent", 0, 0, 'i'},
|
||||
{"tempfile", 0, 0, 't'},
|
||||
{"speller", 1, 0, 's'},
|
||||
@@ -1549,9 +1700,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
|
||||
@@ -1566,26 +1715,20 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
while ((optchr = getopt_long(argc, argv, "?T:RVchilmpr:s:tvwxz",
|
||||
while ((optchr = getopt_long(argc, argv, "?T:RVchiklmpr:s:tvwxz",
|
||||
long_options, &option_index)) != EOF) {
|
||||
#else
|
||||
while ((optchr = getopt(argc, argv, "h?T:RVcilmpr:s:tvwxz")) != EOF) {
|
||||
while ((optchr = getopt(argc, argv, "h?T:RVciklmpr:s:tvwxz")) != EOF) {
|
||||
#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
|
||||
case 'R':
|
||||
SET(USE_REGEXP);
|
||||
@@ -1604,6 +1747,15 @@ int main(int argc, char *argv[])
|
||||
case 'i':
|
||||
SET(AUTOINDENT);
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
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);
|
||||
break;
|
||||
@@ -1625,7 +1777,7 @@ int main(int argc, char *argv[])
|
||||
strcpy(alt_speller, optarg);
|
||||
break;
|
||||
case 't':
|
||||
temp_opt = 1;
|
||||
SET(TEMP_OPT);
|
||||
break;
|
||||
case 'v':
|
||||
SET(VIEW_MODE);
|
||||
@@ -1651,9 +1803,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)
|
||||
@@ -1676,12 +1825,10 @@ int main(int argc, char *argv[])
|
||||
/* First back up the old settings so they can be restored, duh */
|
||||
tcgetattr(0, &oldterm);
|
||||
|
||||
/* Adam's code to blow away intr character so ^C can show cursor pos */
|
||||
tcgetattr(0, &term);
|
||||
for (i = 0; i < NCCS; i++) {
|
||||
if (term.c_cc[i] == CINTR || term.c_cc[i] == CQUIT)
|
||||
term.c_cc[i] = 0;
|
||||
}
|
||||
term = oldterm;
|
||||
term.c_cc[VINTR] = _POSIX_VDISABLE;
|
||||
term.c_cc[VQUIT] = _POSIX_VDISABLE;
|
||||
term.c_lflag &= ~IEXTEN;
|
||||
tcsetattr(0, TCSANOW, &term);
|
||||
|
||||
/* now ncurses init stuff... */
|
||||
@@ -1697,22 +1844,7 @@ 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"));
|
||||
@@ -1722,14 +1854,7 @@ int main(int argc, char *argv[])
|
||||
edit = newwin(editwinrows, COLS, 2, 0);
|
||||
keypad(edit, TRUE);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef NCURSES_MOUSE_VERSION
|
||||
if (ISSET(USE_MOUSE)) {
|
||||
mousemask(BUTTON1_RELEASED, NULL);
|
||||
mouseinterval(50);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
mouse_init();
|
||||
|
||||
/* And the other windows */
|
||||
topwin = newwin(2, COLS, 0, 0);
|
||||
@@ -1755,16 +1880,11 @@ int main(int argc, char *argv[])
|
||||
if (startline > 0)
|
||||
do_gotoline(startline);
|
||||
else
|
||||
edit_update(fileage);
|
||||
edit_update(fileage, CENTER);
|
||||
|
||||
edit_refresh();
|
||||
reset_cursor();
|
||||
|
||||
#ifdef HAVE_TABSIZE
|
||||
if (usrtabsize > 0)
|
||||
TABSIZE = usrtabsize;
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
kbinput = wgetch(edit);
|
||||
if (kbinput == 27) { /* Grab Alt-key stuff first */
|
||||
@@ -1828,9 +1948,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);
|
||||
@@ -1840,7 +1970,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)) {
|
||||
@@ -1881,8 +2011,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);
|
||||
|
||||
36
nano.h
36
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)
|
||||
@@ -104,6 +108,9 @@ typedef struct shortcut {
|
||||
#define USE_MOUSE (1<<13)
|
||||
#define USE_REGEXP (1<<14)
|
||||
#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 */
|
||||
|
||||
@@ -219,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
|
||||
@@ -228,7 +245,16 @@ know what you're doing */
|
||||
#define HELP_LIST_LEN 3
|
||||
#define SPELL_LIST_LEN 3
|
||||
|
||||
#ifndef SMALL_NANO
|
||||
#define TOGGLE_LEN 9
|
||||
#else
|
||||
#define TOGGLE_LEN 6
|
||||
#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
|
||||
|
||||
342
po/cat-id-tbl.c
342
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,111 +114,116 @@ 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},
|
||||
{" -i \t\t--autoindent\t\tAutomatically indent new lines\n", 95},
|
||||
{" -l \t\t--nofollow\t\tDon't follow symbolic links, overwrite.\n", 96},
|
||||
{" -m \t\t--mouse\t\t\tEnable mouse\n", 97},
|
||||
\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", 98},
|
||||
{" -p\t \t--pico\t\t\tMake bottom 2 lines more Pico-like\n", 99},
|
||||
{" -s [prog] \t--speller=[prog]\tEnable alternate speller\n", 100},
|
||||
{" -t \t\t--tempfile\t\tAuto save on exit, don't prompt\n", 101},
|
||||
{" -v \t\t--view\t\t\tView (read only) mode\n", 102},
|
||||
{" -w \t\t--nowrap\t\tDon't wrap long lines\n", 103},
|
||||
{" -x \t\t--nohelp\t\tDon't show help window\n", 104},
|
||||
{" -z \t\t--suspend\t\tEnable suspend\n", 105},
|
||||
{" +LINE\t\t\t\t\tStart at line number LINE\n", 106},
|
||||
-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", 107},
|
||||
{"Option\t\tMeaning\n", 108},
|
||||
{" -T [num]\tSet width of a tab to num\n", 109},
|
||||
{" -R\t\tUse regular expressions for search\n", 110},
|
||||
{" -V \t\tPrint version information and exit\n", 111},
|
||||
{" -c \t\tConstantly show cursor position\n", 112},
|
||||
{" -h \t\tShow this message\n", 113},
|
||||
{" -i \t\tAutomatically indent new lines\n", 114},
|
||||
{" -l \t\tDon't follow symbolic links, overwrite.\n", 115},
|
||||
{" -m \t\tEnable mouse\n", 116},
|
||||
{" -r [#cols] \tSet fill cols to (wrap lines at) #cols\n", 117},
|
||||
{" -s [prog] \tEnable alternate speller\n", 118},
|
||||
{" -p \t\tMake bottom 2 lines more Pico-like\n", 119},
|
||||
{" -t \t\tAuto save on exit, don't prompt\n", 120},
|
||||
{" -v \t\tView (read only) mode\n", 121},
|
||||
{" -w \t\tDon't wrap long lines\n", 122},
|
||||
{" -x \t\tDon't show help window\n", 123},
|
||||
{" -z \t\tEnable suspend\n", 124},
|
||||
{" +LINE\t\tStart at line number LINE\n", 125},
|
||||
{" nano version %s by Chris Allegretta (compiled %s, %s)\n", 126},
|
||||
{" Email: nano@asty.org\tWeb: http://www.asty.org/nano\n", 127},
|
||||
{"Mark Set", 128},
|
||||
{"Mark UNset", 129},
|
||||
{"check_wrap called with inptr->data=\"%s\"\n", 130},
|
||||
{"current->data now = \"%s\"\n", 131},
|
||||
{"After, data = \"%s\"\n", 132},
|
||||
{"Error deleting tempfile, ack!", 133},
|
||||
{"Could not create a temporary filename: %s", 134},
|
||||
{"Could not invoke spell program \"%s\"", 135},
|
||||
{"Could not invoke \"ispell\"", 136},
|
||||
{"Finished checking spelling", 137},
|
||||
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 138},
|
||||
{"Cannot resize top win", 139},
|
||||
{"Cannot move top win", 140},
|
||||
{"Cannot resize edit win", 141},
|
||||
{"Cannot move edit win", 142},
|
||||
{"Cannot resize bottom win", 143},
|
||||
{"Cannot move bottom win", 144},
|
||||
{"Main: set up windows\n", 145},
|
||||
{"Main: bottom win\n", 146},
|
||||
{"Main: open file\n", 147},
|
||||
{"I got Alt-[-%c! (%d)\n", 148},
|
||||
{"I got Alt-%c! (%d)\n", 149},
|
||||
{"Case Sensitive Regexp Search%s", 150},
|
||||
{"Regexp Search%s", 151},
|
||||
{"Case Sensitive Search%s", 152},
|
||||
{"Search%s", 153},
|
||||
{"Search Cancelled", 154},
|
||||
{"Search Wrapped", 155},
|
||||
{"Replaced %d occurences", 156},
|
||||
{"Replaced 1 occurence", 157},
|
||||
{"Replace Cancelled", 158},
|
||||
{"Replace with [%s]", 159},
|
||||
{"Replace with", 160},
|
||||
{"Replace this instance?", 161},
|
||||
{"Enter line number", 162},
|
||||
{"Aborted", 163},
|
||||
{"Come on, be reasonable", 164},
|
||||
{"Only %d lines available, skipping to last line", 165},
|
||||
{"actual_x_from_start for xplus=%d returned %d\n", 166},
|
||||
{"input '%c' (%d)\n", 167},
|
||||
{"New Buffer", 168},
|
||||
{" File: ...", 169},
|
||||
{"Modified", 170},
|
||||
{"Moved to (%d, %d) in edit buffer\n", 171},
|
||||
{"current->data = \"%s\"\n", 172},
|
||||
{"I got \"%s\"\n", 173},
|
||||
{"Yes", 174},
|
||||
{"All", 175},
|
||||
{"No", 176},
|
||||
{"do_cursorpos: linepct = %f, bytepct = %f\n", 177},
|
||||
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 178},
|
||||
{"Dumping file buffer to stderr...\n", 179},
|
||||
{"Dumping cutbuffer to stderr...\n", 180},
|
||||
{"Dumping a buffer to stderr...\n", 181},
|
||||
\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@asty.org\tWeb: http://www.asty.org/nano\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},
|
||||
{"Main: set up windows\n", 156},
|
||||
{"Main: bottom win\n", 157},
|
||||
{"Main: open file\n", 158},
|
||||
{"I got Alt-[-%c! (%d)\n", 159},
|
||||
{"I got Alt-%c! (%d)\n", 160},
|
||||
{"Case Sensitive Regexp Search%s%s", 161},
|
||||
{"Regexp Search%s%s", 162},
|
||||
{"Case Sensitive Search%s%s", 163},
|
||||
{"Search%s%s", 164},
|
||||
{" (to replace)", 165},
|
||||
{"Search Cancelled", 166},
|
||||
{"Search Wrapped", 167},
|
||||
{"Replaced %d occurences", 168},
|
||||
{"Replaced 1 occurence", 169},
|
||||
{"Replace Cancelled", 170},
|
||||
{"Replace with [%s]", 171},
|
||||
{"Replace with", 172},
|
||||
{"Replace this instance?", 173},
|
||||
{"Enter line number", 174},
|
||||
{"Aborted", 175},
|
||||
{"Come on, be reasonable", 176},
|
||||
{"Only %d lines available, skipping to last line", 177},
|
||||
{"actual_x_from_start for xplus=%d returned %d\n", 178},
|
||||
{"input '%c' (%d)\n", 179},
|
||||
{"New Buffer", 180},
|
||||
{" File: ...", 181},
|
||||
{"Modified", 182},
|
||||
{"Moved to (%d, %d) in edit buffer\n", 183},
|
||||
{"current->data = \"%s\"\n", 184},
|
||||
{"I got \"%s\"\n", 185},
|
||||
{"Yes", 186},
|
||||
{"All", 187},
|
||||
{"No", 188},
|
||||
{"do_cursorpos: linepct = %f, bytepct = %f\n", 189},
|
||||
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 190},
|
||||
{"Dumping file buffer to stderr...\n", 191},
|
||||
{"Dumping cutbuffer to stderr...\n", 192},
|
||||
{"Dumping a buffer to stderr...\n", 193},
|
||||
};
|
||||
|
||||
int _msg_tbl_length = 181;
|
||||
int _msg_tbl_length = 193;
|
||||
|
||||
482
po/nano.pot
482
po/nano.pot
File diff suppressed because it is too large
Load Diff
16
proto.h
16
proto.h
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* proto.h *
|
||||
* *
|
||||
@@ -29,10 +30,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;
|
||||
@@ -45,6 +47,7 @@ extern shortcut spell_list[SPELL_LIST_LEN];
|
||||
extern int use_regexp, regexp_compiled;
|
||||
extern regex_t search_regexp;
|
||||
extern regmatch_t regmatches[10];
|
||||
extern toggle toggles[TOGGLE_LEN];
|
||||
|
||||
/* Programs we want available */
|
||||
|
||||
@@ -79,10 +82,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 +108,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);
|
||||
|
||||
73
search.c
73
search.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* search.c *
|
||||
* *
|
||||
@@ -33,6 +34,9 @@
|
||||
#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
|
||||
@@ -59,7 +63,7 @@ int search_init(int replacing)
|
||||
{
|
||||
int i;
|
||||
char buf[BUFSIZ];
|
||||
char *prompt;
|
||||
char *prompt, *reprompt = "";
|
||||
|
||||
if (last_search[0]) {
|
||||
snprintf(buf, BUFSIZ, " [%s]", last_search);
|
||||
@@ -68,18 +72,21 @@ int search_init(int replacing)
|
||||
}
|
||||
|
||||
if (ISSET(USE_REGEXP) && ISSET(CASE_SENSITIVE))
|
||||
prompt = _("Case Sensitive Regexp Search%s");
|
||||
prompt = _("Case Sensitive Regexp Search%s%s");
|
||||
else if (ISSET(USE_REGEXP))
|
||||
prompt = _("Regexp Search%s");
|
||||
prompt = _("Regexp Search%s%s");
|
||||
else
|
||||
if (ISSET(CASE_SENSITIVE))
|
||||
prompt = _("Case Sensitive Search%s");
|
||||
prompt = _("Case Sensitive Search%s%s");
|
||||
else
|
||||
prompt = _("Search%s");
|
||||
|
||||
prompt = _("Search%s%s");
|
||||
|
||||
if (replacing)
|
||||
reprompt = _(" (to replace)");
|
||||
|
||||
i = statusq(replacing ? replace_list : whereis_list,
|
||||
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, "",
|
||||
prompt, buf);
|
||||
prompt, reprompt, buf);
|
||||
|
||||
/* Cancel any search, or just return with no previous search */
|
||||
if ((i == -1) || (i < 0 && !last_search[0])) {
|
||||
@@ -125,15 +132,20 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle)
|
||||
{
|
||||
filestruct *fileptr;
|
||||
char *searchstr, *found = NULL, *tmp;
|
||||
int past_editbot = 0;
|
||||
|
||||
fileptr = current;
|
||||
fileptr = begin;
|
||||
|
||||
searchstr = ¤t->data[current_x + 1];
|
||||
/* Look for searchstr until EOF */
|
||||
while (fileptr != NULL &&
|
||||
(found = strstrwrapper(searchstr, needle)) == NULL) {
|
||||
|
||||
fileptr = fileptr->next;
|
||||
|
||||
if (!past_editbot && (fileptr == editbot))
|
||||
past_editbot = 1;
|
||||
|
||||
if (fileptr == begin)
|
||||
return NULL;
|
||||
|
||||
@@ -148,39 +160,36 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle)
|
||||
for (tmp = fileptr->data; tmp != found; tmp++)
|
||||
current_x++;
|
||||
|
||||
edit_update(current);
|
||||
if (past_editbot)
|
||||
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;
|
||||
@@ -191,6 +200,8 @@ void search_abort(void)
|
||||
UNSET(KEEP_CUTBUFFER);
|
||||
display_main_list();
|
||||
wrefresh(bottomwin);
|
||||
if (ISSET(MARK_ISSET))
|
||||
edit_refresh_clearok();
|
||||
|
||||
#ifdef _POSIX_VERSION
|
||||
if (ISSET(REGEXP_COMPILED))
|
||||
@@ -213,7 +224,6 @@ int do_search(void)
|
||||
search_abort();
|
||||
return 0;
|
||||
} else if (i == -2) {
|
||||
search_abort();
|
||||
do_replace();
|
||||
return 0;
|
||||
} else if (i == 1) {
|
||||
@@ -236,14 +246,10 @@ 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
|
||||
@@ -377,7 +383,6 @@ int do_replace(void)
|
||||
do_replace();
|
||||
return 1;
|
||||
} else if (i == -2) {
|
||||
replace_abort();
|
||||
do_search();
|
||||
return 0;
|
||||
} else if (i == -3) {
|
||||
@@ -472,7 +477,7 @@ int do_replace(void)
|
||||
current->data = copy;
|
||||
|
||||
/* Stop bug where we replace a substring of the replacement text */
|
||||
current_x += strlen(last_replace);
|
||||
current_x += strlen(last_replace) - 1;
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
@@ -484,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;
|
||||
@@ -518,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;
|
||||
}
|
||||
@@ -536,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();
|
||||
|
||||
1
utils.c
1
utils.c
@@ -1,3 +1,4 @@
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* utils.c *
|
||||
* *
|
||||
|
||||
100
winio.c
100
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, 13, " %-11s", 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)
|
||||
@@ -942,8 +944,8 @@ int statusq(shortcut s[], int slen, char *def, char *msg, ...)
|
||||
|
||||
va_start(ap, msg);
|
||||
vsnprintf(foo, 132, msg, ap);
|
||||
strncat(foo, ": ", 132);
|
||||
va_end(ap);
|
||||
strncat(foo, ": ", 132);
|
||||
|
||||
wattron(bottomwin, A_REVERSE);
|
||||
ret = nanogetstr(foo, def, s, slen, (strlen(foo) + 3));
|
||||
@@ -1087,7 +1089,7 @@ int total_refresh(void)
|
||||
clearok(edit, FALSE);
|
||||
clearok(topwin, FALSE);
|
||||
clearok(bottomwin, FALSE);
|
||||
|
||||
edit_refresh();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user