Compare commits

...

83 Commits

Author SHA1 Message Date
Chris Allegretta
03260b40fa GNU nano 1.1.2 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@841 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-04 01:24:07 +00:00
Jordi Mallach
58a3353307 Have a nice day in the Attic, nano.info. We just need nano.texi.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@840 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-04 01:02:26 +00:00
Jordi Mallach
4c6438be6f Fixed the remaining fuzzy string in fi.po. Phear my Finnish :) (thanks Antti-Juhani Kaijanaho).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@835 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 21:57:00 +00:00
Jordi Mallach
780f3205f1 Finnish update for 1.1.2pre3, by Pauli Virtanen.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@834 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 20:47:47 +00:00
Jordi Mallach
8a9863736b Italian updates for 1.1.2 (Marco Colombo).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@832 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 19:04:38 +00:00
Jordi Mallach
cdbabfd4fc * Added more command line options that are currently ignored by nano (DLR).
* nano.1: Updated the statement about nano.save & multibuffers.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@830 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 15:53:25 +00:00
Jordi Mallach
7d589ca5fa Fixed typos found by DLR and ispell.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@829 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 15:44:16 +00:00
Chris Allegretta
ca1a82ecab - rcfile.c: - Fix incorrect argument in fill and tabsize error message (Nathan Heagy)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@828 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 15:18:41 +00:00
Jordi Mallach
f57b886bed Documentation updates for nano 1.1.2 (texi and manpage).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@827 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 12:45:22 +00:00
Jordi Mallach
22262441c7 Galician translation brought up to date for 1.1.2 by Jacobo Tarrío.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@826 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 10:59:23 +00:00
Jordi Mallach
b97bedafe8 Updated ca & es for 1.1.2 release (tab size changes).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@825 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 10:12:37 +00:00
Chris Allegretta
31b2b81e53 Add filebot magic line bug as bug #66
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@823 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 01:51:33 +00:00
Chris Allegretta
5e4b1085b4 Add single line bug as Bug #65
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@822 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 00:45:06 +00:00
Chris Allegretta
b516d8e3f3 - nano.c:main() - Added var constcheck as a CRC-like check of whether cursor pos has changed and if so update the pos with -c
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@820 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-03 00:01:36 +00:00
Chris Allegretta
66c33b8731 Add tabsize support to rc file (Nathan Heagy)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@819 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 23:57:31 +00:00
Chris Allegretta
dc2ca88718 - cut.c:do_cut_text() - Don't recenter the line when cutting one line (DLR)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@818 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 23:55:09 +00:00
Jordi Mallach
a2d849bcd4 * Added notes about the Free Translation Project.
* Updated the ChangeLog, so it has some meaning :)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@817 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 19:13:03 +00:00
Jordi Mallach
14b0accd81 * We can't live WITHOUT bells and whistles 8) (Nathan Heagy)
* Removed ftp.sourceforge.net from download sites as it'll go shortly.
* Added the `testing' distribution page for nano in the Debian section.
* Added a direct link to Debian's package pools too.
* Added --disable-operatingdir to "how make nano smaller?".
* Zsh advocacy :)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@816 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 18:21:55 +00:00
Chris Allegretta
b26cb39296 Don't show non-positive shortcut keys in help_init()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@814 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 04:22:34 +00:00
Chris Allegretta
e10f389e9c Take out the unneeded case sensitive and reverse stuff from -tiny
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@813 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 03:54:40 +00:00
Chris Allegretta
ad3f478452 - Take control-space out of -tiny build, unneeded
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@812 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 03:54:13 +00:00
Chris Allegretta
59121a9aaf Change do_bracket ctrl shortcut to -9 (junk value) instead of 0 so control-space will work
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@811 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 03:14:43 +00:00
Chris Allegretta
92f5fdc230 Finally, do the ChangeLog
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@810 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 02:58:07 +00:00
Chris Allegretta
386e0518b5 winio.c:nanogetstr() - Don't be clever and wasteful, just repaint every iteration
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@809 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 02:57:26 +00:00
Chris Allegretta
1c27d3e875 nano.c:main() - Fix the KEY_IC being undefined when using slang
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@808 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 02:56:45 +00:00
Chris Allegretta
7fdbd05b41 Readded DISABLE_CURPOS cause we can't get away without it (Search Wrapped msgs) and Ken's findnextr fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@807 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 00:55:38 +00:00
Chris Allegretta
d948edc4f3 DLR's latest smooth scroll fix, case where there's not a full half page up from the cursor to fileage screws up the cursor position
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@806 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 00:38:56 +00:00
Chris Allegretta
222a0863fa cut.c:cut_marked_segment() - Add magic line when cutting a selection including filebot (discovered by DLR, fixed by DLR & Chris)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@805 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-02 00:24:37 +00:00
Jordi Mallach
1e36fd8f69 Italian updates for 1.1.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@804 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-01 17:24:24 +00:00
Chris Allegretta
f727da88b0 Add smooth scroll and the DOS/Mac file support to the README
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@803 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-10-01 14:42:27 +00:00
Jordi Mallach
73889487f0 Added Karl, fixed Hungarian translator address (blindly believing Google).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@802 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-30 05:03:15 +00:00
Jordi Mallach
200b27e33e Fixes from Karl Eichwalder to de.po, so Emacs doesn't barf.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@801 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-30 05:01:31 +00:00
Jordi Mallach
10398ade49 Corrected small spacing typo in --dos help.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@800 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-29 18:54:46 +00:00
Chris Allegretta
1b3381bee8 Initialize totsize in files.c:new_file() and let do_gotopos keep current position when invoking the alternate speller (DLR)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@799 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-28 21:59:01 +00:00
Chris Allegretta
2bef18210a Fixes to bracket_msg in global.c by DLR
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@798 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-28 19:53:11 +00:00
Chris Allegretta
352801cf4c Fix brace error with nano-tiny in do_writeout()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@797 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-28 19:42:41 +00:00
Jordi Mallach
c1917e7b66 Updated Catalan and Spanish translations to 1.1.2pre2.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@796 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-28 13:06:29 +00:00
Jordi Mallach
acf4b16b72 Header fixes for some old po files.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@795 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-28 12:58:07 +00:00
Jordi Mallach
475f96d0b3 Updated Catalan and Spanish translations.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@794 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-28 12:55:18 +00:00
Chris Allegretta
a951f21c59 - nano.c: do_mouse() - Change k based on currslen to allow the new widths in bottombars()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@793 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-27 21:07:39 +00:00
Chris Allegretta
26a86e350c Initialize bracket_msg (David Lawrence Ramsey
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@792 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-27 20:52:53 +00:00
Chris Allegretta
9519eb0c88 - files.c: do_writeout() - Expanded strings to not use %s and ?: to determine write/append string to be nice to translators
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@791 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-27 20:46:25 +00:00
Chris Allegretta
759d3523fc Search prompt changes, bracketed modifiers and to search at the front
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@790 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-27 13:04:10 +00:00
Chris Allegretta
56214c6aef DLR's fixes: arg for operatingdir's getopt_long text, changes to cases 2b and 2c in do_wrap for Pico compatibility, and new arg save_cutbuffer to global_init() to stop the cutbuffer from being lost with multiple buffers
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@789 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-27 02:46:53 +00:00
Chris Allegretta
5050d35e87 Fixes to paging (smooth scroll) by David Lawrence Ramsey
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@788 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-27 00:44:58 +00:00
Chris Allegretta
ecc1933c14 Off by one error in findnextstr?
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@787 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-25 01:49:38 +00:00
Jordi Mallach
c1968a0795 Updated Spanish to 1.1.2pre1
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@786 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-24 00:46:31 +00:00
Chris Allegretta
99e30e1bee Oops, we shoudn't let DOS_FILE and MAX_FILE be set at the same time
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@784 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-23 02:45:27 +00:00
Chris Allegretta
ce78c1eb88 DLR's latest fixes for the tabcomp code and keys
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@783 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-23 01:18:03 +00:00
Chris Allegretta
beb5497530 rcfile.c: - NUM_RCOPTS fix (DLR)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@782 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 23:54:45 +00:00
Chris Allegretta
96bd4e4ed8 Readd skipping Meta-A,B,E in do_toggle, oops I'm with it now :-)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@781 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 22:27:37 +00:00
Chris Allegretta
8d990b5e8b - Bracket (brace, parens, etc) matching code by Ken Tyler. New functions do_find_bracket(), changes to findnextstr(), command is Meta-] (hope you dont mind since I already sold off Meta-O to the MacOS file code Ken...)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@780 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 22:14:25 +00:00
Chris Allegretta
6f6aba0350 Move the smooth_msg up a tiny
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@779 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 19:03:01 +00:00
Chris Allegretta
3e3ae94084 - New smooth scroll code by Ken Tyler. New flag -S, --smooth, changes to page_up() and page_down()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@778 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 19:02:04 +00:00
Chris Allegretta
0319176f2d More Mac file fixes
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@777 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 06:38:38 +00:00
Chris Allegretta
960a8635bc Oops, another Mac fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@776 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 05:08:12 +00:00
Chris Allegretta
995177f2d9 Add Mac toggle Meta-O for Mac format
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@775 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 04:34:23 +00:00
Chris Allegretta
8fa1e28681 Added mac file support too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@774 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 04:20:25 +00:00
Chris Allegretta
7004c289f8 -D cmdline flag for DOS formatted files
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@773 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-22 00:42:10 +00:00
Chris Allegretta
6414b40d3d Make the Alt-key seqs work with the mouse
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@772 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-21 03:21:11 +00:00
Chris Allegretta
91841895e0 Code to read/write dos formatted files. Massive amounts of new code in read_line and write_file. New flag DOS_FILE
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@771 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-21 02:37:01 +00:00
Jordi Mallach
5d25f06e3b Catalan commit with no translation changes, just to avoid more conflicts.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@770 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-19 10:12:11 +00:00
Jordi Mallach
128e95ffdc Updated Spanish for chroot patch.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@769 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-19 10:07:50 +00:00
Chris Allegretta
e09cd1d4d1 Credit DLR for his code =-)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@768 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-19 03:22:52 +00:00
Chris Allegretta
e1f1452eb5 General: - New flag -o, --operatingdir, similar to Pico's -o mode. New function check_operating_dir(), changes to load_file (arg), open_file_dup_search (arg), new function do_gotopos for -F.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@767 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-19 03:19:43 +00:00
Chris Allegretta
b6c89eed9f Completely get rid of DISABLE_CURPOS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@766 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-19 03:09:22 +00:00
Chris Allegretta
0357c4d552 - nano.c: main() - Added vars oldcurrent and oldcurrent_x to check whether cursor pos has changed and if so update the pos with -c
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@765 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-19 02:59:25 +00:00
Chris Allegretta
68532c37ef Fix unneeded vars with NANO_SMALL
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@764 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-17 13:49:33 +00:00
Chris Allegretta
ff98983602 Fix acconfig.h, NANO_SMALL leaves out Auto Indent
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@763 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-17 13:48:00 +00:00
Jordi Mallach
6c49b3f32c Updated Swedish translation (Christian Rose)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@762 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-15 22:47:05 +00:00
Jordi Mallach
4d69d4313f Added Keld Simonsen (Danish).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@761 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-15 22:46:21 +00:00
Jordi Mallach
90bbdd3c40 New Danish translation, by Keld Simonsen <keld@dkuug.dk>.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@760 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-12 19:06:59 +00:00
Jordi Mallach
d1625cdfe6 Updated Galician translation; thanks, Jacobo Tarrío.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@757 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-10 11:36:45 +00:00
Jordi Mallach
c6c35eafc8 Added recent translators to THANKS
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@756 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-09 11:04:43 +00:00
Jordi Mallach
b1aaa27c10 Updated Spanish translation.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@754 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-09 10:55:51 +00:00
Jordi Mallach
2cde0a24d4 Added Dutch translation, by Guus Sliepen <guus@nl.linux.org>.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@753 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-09-05 13:23:53 +00:00
Chris Allegretta
7dd1869713 Make the new bottombars not suck quite so badly
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@751 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-08-26 23:16:44 +00:00
Chris Allegretta
96eef7332b winio.c:bottombars() - Spread out the menu items, feedback definitely needed on this
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@750 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-08-25 16:41:37 +00:00
Chris Allegretta
9b3c7e8be7 winio.c: - Add David Lawrence Ramsey to credits
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@749 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-08-25 16:00:53 +00:00
Chris Allegretta
c2acb81782 Unset the flag chris you dolt
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@745 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-08-17 00:08:44 +00:00
Chris Allegretta
c1049aced1 Add and fix bugs #63 and 64
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@744 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-08-17 00:03:46 +00:00
Jordi Mallach
372b1a0939 Corrected the Mouse Toggle help in the texinfo manual.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@743 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-08-08 19:35:23 +00:00
Chris Allegretta
47a2686e41 Back to CVS version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@742 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-07-29 01:17:38 +00:00
44 changed files with 9997 additions and 5456 deletions

11
BUGS
View File

@@ -117,7 +117,16 @@
- Blank lines are not kept when cutting with -k (discovered by Rocco)
(61) [FIXED].
- Nano will not suspend properly inside of mutt (62) [FIXED].
- When switching from Pico mode to normal mode, the previous search is
not displayed until cancelling the search (63) [FIXED].
- If you change search options but don't change the search string in
normal mode, hitting enter causes the search/replace to abort (64)
(Jordi Mallach) [FIXED].
- Cutting one line of text causes the screen to recenter the line
(reported and fixed by David Lawrence Ramsey) (65) [FIXED].
- When cutting marked text including the bottom of the file, a new
"magic line" is not created" (reported by David Lawrence
Ramsey, fixed by David Lawrence Ramsey & Chris) (66) [FIXED].
** Open BUGS **

107
ChangeLog
View File

@@ -1,3 +1,110 @@
nano-1.1.2 - 10/03/2001
- General
- Added BUGS #63 & 64. Fixes in search_init() and nanogetstr(),
new flag CLEAR_BACKUPSTRING because there's no easy way to
clear the backupstring without making it global (messy), so we
use a flag instead (just as messy?)
- --enable-tiny now leaves out the Auto Indent code, do you really
need that on a bootdisk? =-)
- New flag -o, --operatingdir, similar to Pico's -o mode. New
function check_operating_dir(), changes to load_file (arg),
open_file_dup_search (arg), new function do_gotopos for -F
(David Lawrence Ramsey).
- Code to read/write dos formatted files. Massive amounts of
new code in read_line and write_file. New cmdline flag
(-D --dos) to automatically write the file in DOS format,
regardless of the original format.
- Mac file writing supported too. Flag -M, --mac. Toggle
Meta-O (MacOS? OS-X? =-)
- New smooth scroll code by Ken Tyler. New flag -S, --smooth,
changes to page_up() and page_down(). Many fixes to paging by
David Lawrence Ramsey.
- Bracket (brace, parens, etc) matching code by Ken Tyler.
New functions do_find_bracket(), changes to findnextstr(),
command is Meta-] (hope you dont mind since I already sold off
Meta-O to the MacOS file code Ken...) Fixes to bracket_msg
by DLR.
- Call do_gotopos from do_alt_spell() to keep position
consistent when invoking alt speller (DLR).
- Readded DISABLE_CURPOS because in certain instances (like
all the "Search Wrapped" lines) the cursor position will
be different yet we don't want the cursor position displayed.
- Take control-space out of -tiny build, unneeded.
- cut.c:
cut_marked_segment()
- Add magic line when cutting a selection including filebot
(discovered by DLR, fixed by DLR & Chris, fixes BUG #66).
do_cut_text()
- Don't recenter the line when cutting one line (DLR) (Bug #65).
- faq.html:
- Notes about the Free Translation Project.
- Debian additions.
- files.c:
do_writeout()
- Expanded strings to not use %s and ?: to determine
write/append string to be nice to translators.
new_file()
- Initialize totsize (DLR).
- nano.c:
main()
- Added var constcheck as a CRC-like check of whether cursor
pos has changed and if so update the pos with -c.
- Many tweaks and changes from numerics to char equivs
(David Lawrence Ramsey).
- Fix the KEY_IC being undefined when using slang.
do_mouse()
- Send 27 when the menu item clicked is an alt key seq... The
lines aren't lined up since the menu width changed though,
this breakage depends on whether the new widths will be kept
or not (FEEDBACK!!)
- Change k based on currslen to allow the new widths in
bottombars().
do_wrap()
- Fixes for Pico incompatibility in cases 2b and 2c.
(David Lawrence Ramsey).
global_init()
- New arg save_cutbuffer, allows cutbuffer to not be lost when
using multibuffer.
- nano.1:
- Added new features, fixed some typos (Jordi).
- nano.texi:
- Corrected the Mouse Toggle section, noticed by Daniel Bonniot.
- Added many command line options, toggles and other additions
(Jordi).
- rcfile.c:
- NUM_RCOPTS fix (DLR).
- Add tabsize support to rc file (Nathan Heagy).
- Fix incorrect argument in fill and tabsize error message
(Nathan Heagy)
- search.c:
- Changed search prompt to "Search" followed by a list of
bracketed, free-standing modifiers that do not imply a grammar,
and the (to replace) string separately. Hopefully this resolves
the i18n problems that this provoked.
findnextstr()
- Various fixes that need testing (Ken Tyler).
- winio.c:
- Add David Lawrence Ramsey to credits.
bottombars()
- Spread out the menu items, feedback definitely needed on this.
nanogetstr()
- More key fixes (David Lawrence Ramsey)
- Don't be clever and wasteful, just repaint every iteration.
- po/nl.po:
- New Dutch translation, by Guus Sliepen <guus@nl.linux.org>.
- po/ca.po, po/es.po:
- Updated Catalan and Spanish translation (Jordi).
- po/gl.po:
- Updated Galician translation (Jacobo Tarrío).
- po/da.po:
- New Danish translation, by Keld Simonsen <keld@dkuug.dk>.
- po/sv.po:
- Updated Swedish translation (Christian Rose).
- po/it.po:
- Updated Italian translation (Marco Colombo).
- po/fi.po:
- Updated Finnish translation (Pauli Virtanen).
nano-1.1.1 - 07/28/2001
- General
- Reverted included gettext from 0.10.38 to 0.10.35 in intl/ dir.

View File

@@ -155,7 +155,7 @@ all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \

14
NEWS
View File

@@ -1,3 +1,17 @@
10/03/2001 - GNU nano 1.1.2 is out there. Many new features in this
release, including support for auto-converting from
DOS and Mac formatted files, as well as toggles for
writing out files in these formats. Pico's -o flag has
been implemented, as has some new smooth scrolling code
(which can be used in place of the default jerky scrolling
behavior). Also, there is now a "find matching
bracket/brace/etc" feature (Meta-]). The .nanorc file
now accepts setting the tabsize, and the help text at the
bottom of the editor is now better spaced out in the
search/replace prompts. There are also the usual helping
of bugfixes, translation updates and, surely a bug or two.
You better get ready!
07/28/2001 - GNU nano 1.1.1 is released. Our second 1.1 unstable release
features many bugfixes from the initial release, in
particular fixs for the multibuffer code, and various

10
README
View File

@@ -55,7 +55,7 @@ Current Status
This is the 1.1 or unstable branch of nano. New features
will be added and things will be changed around and basically
stabiliity is not guaranteed. If this is not what you're
stability is not guaranteed. If this is not what you're
interested in, please use the latest 1.0.x release of nano.
New features in this branch include:
@@ -71,6 +71,14 @@ Current Status
shortcuts and files in browser, search toggles that are Pico
extensions moved to Meta keys so as to not interfere with Pico
control sequences.
+ Smooth scrolling through files, instead of the jerky half-page
down, half-page up method. This is available by using the
-S or --smooth switch, or the Meta-S toggle.
+ Better non-*nix file support. GNU nano now automatically
converts files from DOS format or Mac format to standard file
format. It can also write files in either format by using the
appropriate command line (-D, --dos or -M, --mac) or toggle
(Meta-D, Meta-O).
Chris Allegretta (chrisa@asty.org)

9
THANKS
View File

@@ -2,16 +2,23 @@ The following people have helped GNU nano in some way or another.
If we missed you here, let us now!
Marco Colombo <magicdice@inwind.it> Italian Translator
Karl Eichwalder <keichwa@gmx.net> German Translator
Tedi Heriyanto <tedi_h@gmx.net> Indonesian Translator
Václav Haisman <V.Haisman@sh.cvut.cz> Czech Translator
Szabolcs Horvath <horvaths@fi.inf.elte.hu> Hungarian Translator
Szabolcs Horvath <horvaths@janus.gimsz.sulinet.hu>
Hungarian Translator
Eivind Kjørstad <ekj@vestdata.no> Norwegian (Bokmål) Translator
Florian König <floki@bigfoot.com> German Translator
Clement Laforet <clem_laf@wanadoo.fr> French Translator
Sergey A. Ribalchenko <fisher@obu.ck.ua> Russian, Ukrainian Translator
Christian Rose <menthos@menthos.com> Swedish Translator
Keld Simonsen <keld@dkuug.dk> Danish Translator
Guus Sliepen <guus@nl.linux.org> Dutch Translator
Pierre Tane <tanep@bigfoot.com> French Translator
Jacobo Tarrío <jtarrio@trasno.net> Galician Translator
Miquel Vidal <miquel@sindominio.net> Catalan Translator
Pauli Virtanen <pauli.virtanen@saunalahti.fi> Finnish Translator
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
Thomas Dickey <dickey@herndon4.his.com> Curses help and advice
Ryan Krebs <fluffy@highwire.stanford.edu> Many bug fixes and testing

View File

@@ -54,7 +54,10 @@
/* Define this to disable the mouse functions */
#undef DISABLE_MOUSE
/* Define this to load files upon inserting them, and allow switching between them; this is disabled if NANO_SMALL is defined */
/* Define this to disable setting of the operating directory (chroot of sorts) */
#undef DISABLE_OPERATINGDIR
/* Define this to enable multiple file buffers; this is disabled if NANO_SMALL is defined */
#undef ENABLE_MULTIBUFFER
/* Define this to use the .nanorc file */
@@ -66,3 +69,5 @@
/* Define this to have syntax hilighting, requires ENABLE_NANORC too! */
#undef ENABLE_COLOR
/* Define this to enable undoing....something */
#undef ENABLE_UNDO

22
aclocal.m4 vendored
View File

@@ -125,24 +125,6 @@ for am_file in <<$1>>; do
done<<>>dnl>>)
changequote([,]))])
#serial 1
# This test replaces the one in autoconf.
# Currently this macro should have the same name as the autoconf macro
# because gettext's gettext.m4 (distributed in the automake package)
# still uses it. Otherwise, the use in gettext.m4 makes autoheader
# give these diagnostics:
# configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
# configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
undefine([AC_ISC_POSIX])
AC_DEFUN([AC_ISC_POSIX],
[
dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
]
)
#serial 19
dnl By default, many hosts won't let programs access large files;
@@ -815,7 +797,7 @@ AC_SUBST($1)dnl
# Ulrich Drepper <drepper@cygnus.com>, 1996.
#
# This file can be copied and used freely without restrictions. It can
# be used in projects which are not available under the GNU General Public License
# be used in projects which are not available under the GNU Public License
# but which still want to provide support for the GNU gettext functionality.
# Please note that the actual code is *not* freely available.
@@ -823,7 +805,7 @@ AC_SUBST($1)dnl
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
AC_DEFUN(AM_PATH_PROG_WITH_TEST,
[# Extract the first word of "$2", so it can be a program name with args.
set dummy $2; ac_word=[$]2
AC_MSG_CHECKING([for $ac_word])

View File

@@ -1,4 +1,4 @@
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if using alloca.c. */
#undef C_ALLOCA
@@ -31,6 +31,9 @@
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
@@ -88,7 +91,10 @@
/* Define this to disable the mouse functions */
#undef DISABLE_MOUSE
/* Define this to load files upon inserting them, and allow switching between them; this is disabled if NANO_SMALL is defined */
/* Define this to disable setting of the operating directory (chroot of sorts) */
#undef DISABLE_OPERATINGDIR
/* Define this to enable multiple file buffers; this is disabled if NANO_SMALL is defined */
#undef ENABLE_MULTIBUFFER
/* Define this to use the .nanorc file */
@@ -100,6 +106,9 @@
/* Define this to have syntax hilighting, requires ENABLE_NANORC too! */
#undef ENABLE_COLOR
/* Define this to enable undoing....something */
#undef ENABLE_UNDO
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT

517
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
# $Id$
dnl Process this file with autoconf to produce a configure script.
AC_INIT(nano.c)
AM_INIT_AUTOMAKE(nano, 1.1.1)
AM_INIT_AUTOMAKE(nano, 1.1.2)
AM_CONFIG_HEADER(config.h:config.h.in)
ALL_LINGUAS="es de fr it id fi hu ca cs gl uk ru sv no"
ALL_LINGUAS="es de fr it id fi hu ca cs gl uk ru sv no nl da"
dnl Checks for programs.
AC_PROG_CC
@@ -26,6 +26,7 @@ AC_ARG_ENABLE(tiny,
AC_DEFINE(DISABLE_JUSTIFY)
AC_DEFINE(DISABLE_BROWSER)
AC_DEFINE(DISABLE_MOUSE)
AC_DEFINE(DISABLE_OPERATINGDIR)
fi])
AC_ARG_ENABLE(extra,
@@ -33,10 +34,17 @@ AC_ARG_ENABLE(extra,
[if test x$enableval = xyes; then
AC_DEFINE(NANO_EXTRA) extra_support=yes
AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_support=yes
AC_DEFINE(ENABLE_UNDO) undo_support=yes
fi])
AC_ARG_ENABLE(undo,
[ --enable-undo Enable undo support],
[if test x$enableval = xyes && test x$tiny_support != xyes; then
AC_DEFINE(ENABLE_UNDO) undo_support=yes
fi])
AC_ARG_ENABLE(multibuffer,
[ --enable-multibuffer Enable use of file loading on insertion, and switching between loaded files; this is disabled if --enable-tiny is used],
[ --enable-multibuffer Enable multiple file buffers; this is disabled if --enable-tiny is used],
[if test x$enableval = xyes && test x$tiny_support != xyes; then
AC_DEFINE(ENABLE_MULTIBUFFER) multibuffer_support=yes
fi])
@@ -103,6 +111,12 @@ AC_ARG_ENABLE(mouse,
AC_DEFINE(DISABLE_MOUSE)
fi])
AC_ARG_ENABLE(operatingdir,
[ --disable-operatingdir Disable setting of operating directory (chroot of sorts)],
[if test x$enableval != xyes; then
AC_DEFINE(DISABLE_OPERATINGDIR)
fi])
AC_MSG_CHECKING([whether to use slang])
CURSES_LIB_NAME=""
AC_ARG_WITH(slang,

10
cut.c
View File

@@ -180,6 +180,8 @@ void cut_marked_segment(filestruct * top, int top_x, filestruct * bot,
filebot = next;
} else {
filebot = top;
if (top_x > 0)
new_magicline();
}
}
if (top->lineno < edittop->lineno)
@@ -192,6 +194,7 @@ int do_cut_text(void)
{
filestruct *tmp, *fileptr = current;
#ifndef NANO_SMALL
int cuttingpartialline = 0;
int cuttingtoend = 0;
#endif
@@ -250,9 +253,12 @@ int do_cut_text(void)
}
}
if (ISSET(MARK_ISSET)) {
if (current->lineno <= mark_beginbuf->lineno)
if (current->lineno <= mark_beginbuf->lineno) {
if (current->lineno == mark_beginbuf->lineno)
cuttingpartialline = 1;
cut_marked_segment(current, current_x, mark_beginbuf,
mark_beginx, 1);
}
else
cut_marked_segment(mark_beginbuf, mark_beginx, current,
current_x, 1);
@@ -262,7 +268,7 @@ int do_cut_text(void)
marked_cut = 1;
set_modified();
if (cuttingtoend)
if (cuttingpartialline || cuttingtoend)
edit_refresh();
else
edit_update(current, CENTER);

105
faq.html
View File

@@ -203,7 +203,7 @@ nano was developed).</font></blockquote>
of nano?</font></h2>
<blockquote><font color="#330000">The current version of nano *should*
be 1.1.1.&nbsp; Of course you should always check the nano hompage to
be 1.1.2.&nbsp; Of course you should always check the nano hompage to
see what the latest and greatest version is.</font></blockquote>
<h2>
@@ -232,9 +232,6 @@ at the following fine web and ftp sites:</font>
<li>
<font color="#330000"><a href="ftp://ftp.nano-editor.org/pub/nano">ftp://ftp.nano-editor.org/pub/nano</a></font></li>
<li>
<font color="#330000"><a href="ftp://nano.sourceforge.net/pub/nano/">ftp://nano.sourceforge.net/pub/nano</a></font></li>
</ul>
</blockquote>
@@ -252,9 +249,6 @@ packages.</font></h2>
<li>
<font color="#330000"><a href="ftp://ftp.nano-editor.org/pub/nano/RPMS">ftp://ftp.nano-editor.org/pub/nano/RPMS</a></font></li>
<li>
<font color="#330000"><a href="ftp://nano.sourceforge.net/pub/nano/RPMS">ftp://nano.sourceforge.net/pub/nano/RPMS</a></font></li>
</ul>
<font color="#330000">Additionally, check out the Redhat contribs section
at:</font>
@@ -276,9 +270,15 @@ current nano packages for:</font>
<li>
<font color="#330000"><a href="http://www.debian.org/Packages/stable/editors/nano.html">stable</a></font></li>
<li>
<font color="#330000"><a href="http://www.debian.org/Packages/testing/editors/nano.html">testing</a></font></li>
<li>
<font color="#330000"><a href="http://www.debian.org/Packages/unstable/editors/nano.html">unstable</a></font></li>
</ul>
<p><font color="#330000">You can also have a look at the</font>
<font color="#330000"><a href="ftp://ftp.debian.org/debian/pool/main/n/nano/">Package Pool</a> to see all the available binary and source packages.</font></p>
<font color="#330000">Note that versions &lt; 0.9.10 are probably not for
those wanting to get serious work done, so if you are using Debian 2.2, check
that you have updated to 2.2r3, which comes with nano 0.9.23. If you're
@@ -372,6 +372,7 @@ list:
<b>--disable-browser</b> Disables mini file browser
<b>--disable-wrapping</b> Disables all wrapping of text (and -w flag)
<b>--disable-mouse</b> Disables mouse support (and -m flag)
<b>--disable-operatingdir</b> Disable setting of operating directory
</pre><br>
There's also the <b>--enable-tiny</b> option which disables everything
above, as well as some larger chunks of the program (like the marker code
@@ -381,7 +382,7 @@ disable internationalization and save a few K to a few dozen K depending
on if you have locale support on your system. And finally there's always
good old <b>strip</b> to strip all debugging code and code that exists in
libraries on your system.
<p>If, in the other hand, you can't live with bells and whistles, you could
<p>If, in the other hand, you can't live without bells and whistles, you could
try:
<pre>
<b>--enable-extra</b> Enable extra functions, including easter eggs
@@ -394,29 +395,33 @@ try:
<a NAME="3.7"></a><font color="#330000">
3.7. Tell me more about this multibuffer stuff!</font></h2>
<blockquote><font color="#330000"> To use multiple file buffers, you must be using nano 1.1.1
or newer, and you must have configured nano with <b>--enable-multibuffer</b> or
<b>--enable-extra</b> (use nano -V to check). Then when you want to enable inserting a file
into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the
file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers,
<blockquote><font color="#330000"> To use multiple file buffers, you must
be using nano 1.1.2 or newer, and you must have configured nano with
<b>--enable-multibuffer</b> or <b>--enable-extra</b> (use nano -V to check).
Then when you want to enable inserting a file into its own buffer instead of
into the current file, just hit <b>Meta-F</b>, then insert the file as normal
with <b>^R</b>. If you always want files to be loaded into their own buffers,
use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano. <P>
You can move between the buffers you have open with the <b>Meta-&lt;</b> and <b>Meta-&gt;</b>
keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-).
When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the
normal "Exit" when only one buffer is open.
You can move between the buffers you have open with the <b>Meta-&lt;</b> and
<b>Meta-&gt;</b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b>
(clear as mud, right? =-). When you have more than one file buffer open,
the ^X shortcut will say "Close", instead of the normal "Exit" when only one
buffer is open.
</font></blockquote>
<h2>
<a NAME="3.8"></a><font color="#330000">
3.8. How do I make a .nanorc file that nano will read when I start it?</font></h2>
<blockquote><font color="#330000"> It's not hard at all! But, your version of nano must have
beem compiled with <b>--enable-nanorc</b>, and again must be version 1.1.1 or newer (use nano
-V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b>
that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc
in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and
off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set
<blockquote><font color="#330000"> It's not hard at all! But, your version
of nano must have beem compiled with <b>--enable-nanorc</b>, and again must
be version 1.1.2 or newer (use nano -V to check your version and compiled
features). Then simply copy the <b>nanorc.sample</b>
that came with the nano source or your nano package (most likely in
/usr/doc/nano) to .nanorc in your home directory. If you didn't get one,
the syntax is simple. Flags are turned on and off by using the word
<b>set</b> and the getopt_long flag for the feature, for example "set
pico" or "set nowrap". </font></blockquote> <hr WIDTH="100%">
<h1><a NAME="4"></a><font color="#330000">4. Running</font></h1>
@@ -500,7 +505,7 @@ mutt, etc)?</h2>
<blockquote>You need to make nano your $EDITOR.&nbsp; If you want this
to be saved, you should put a line like this in your <b>.bashrc</b> if
you use bash:
you use bash (or <b>.zshrc</b> if you believe in zsh):
<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>
@@ -529,20 +534,32 @@ this in your <b>.muttrc</b>:
<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 =-).&nbsp; 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.&nbsp; Then send it to the <a href="mailto:nano-devel@lists.sourceforge.net">nano-devel</a> list or <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></blockquote>
<blockquote><font color="#330000">On June of 2001, GNU nano entered the
<a href="www.iro.umontreal.ca/contrib/po/HTML">Free Translation Project</a>
and since then, translations should be managed from there.
<p>If there isn't a translation for your language, you could ask
<a href="http://www.iro.umontreal.ca/contrib/po/HTML/teams.html">your language
team</a> to tranlate nano, or better still, join your team and do it yourself.
Joining a team is easy. You just need to ask the
<a href="mailto:translation@iro.umontreal.ca">TP coordinator</a> to add you
to your team, and send a <a href="http://www.iro.umontreal.ca/contrib/po/HTML/disclaim.html">translation disclaimer to the FSF</a> (this is necessary as
nano is an official GNU package, but it does <strong>not</strong> mean that
you transfer the rights of your work to the FSF, it's just so the FSF can
legaly manage them).</p>
<p>In any case, translating nano is very easy.&nbsp; 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.&nbsp; When you're done, you should
send it to the TP's central po repository.
<h2>
<a NAME="5.2"></a><font color="#330000">5.2. I don't like the translation
for &lt;x> in my language.&nbsp;&nbsp; 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>&lt;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>
the person listed in the <code>Last-Translator:</code> field in
<b>&lt;your_language&gt;.po</b> file with your suggested corrections and
they can make the changes reach the nano devel list.</font></blockquote>
<hr WIDTH="100%">
<h1>
@@ -663,10 +680,28 @@ to your resume.</font></blockquote>
<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>
<h2>
<a NAME="8"></a><font color="#330000">8. ChangeLog</font>
</h2>
<blockquote>06/31/2000 - Initial framework.</blockquote>
<blockquote>2001/10/02 - Update for Free Translation Project.</blockquote>
<blockquote>2001/10/02 - Assorted fixes, Debian additions.</blockquote>
<blockquote>2001/06/30 - Silly typo fix.</blockquote>
<blockquote>2001/05/05 - Spelling fixes by David Lawrence Ramsey.</blockquote>
<blockquote>2001/05/02 - Misc fixes.</blockquote>
<blockquote>2001/03/26 - Typo fix in an URL.</blockquote>
<blockquote>2001/02/17 - Advocacy updates.</blockquote>
<blockquote>2001/02/15 - Added GNU notes for 0.9.99pre3.</blockquote>
<blockquote>2001/02/06 - Typo fixes.</blockquote>
<blockquote>2001/01/14 - Added note about numlock glitch.</blockquote>
<blockquote>2001/01/10 - Linux --&gt; GNU/Linux.</blockquote>
<blockquote>2001/01/09 - Added "making exe smaller section.</blockquote>
<blockquote>2000/12/19 - Typo and assorted error fixes.</blockquote>
<blockquote>2000/11/28 - Added blurb about make install-strip.</blockquote>
<blockquote>2000/11/19 - Changed Debian frozen to stable.</blockquote>
<blockquote>2000/11/18 - Previous string display (4.5).</blockquote>
<blockquote>2000/09/27 - Moved addresses to nano-editor.org.</blockquote>
<blockquote>2000/06/31 - Initial framework.</blockquote>
<P>
$Id$
</body>

395
files.c
View File

@@ -44,16 +44,20 @@
#endif
/* Load file into edit buffer - takes data from file struct */
void load_file(void)
void load_file(int quiet)
{
current = fileage;
#ifdef ENABLE_MULTIBUFFER
/* add a new entry to the open_files structure, and check for
duplicate entries; if a duplicate entry was found, reload the
currently open file (it may have been changed during duplicate
handling) */
if (add_open_file(0, 1) == 2)
/* if quiet is zero, add a new entry to the open_files structure, and
do duplicate checking; otherwise, update the current entry and
don't do duplicate checking (the latter is needed in the case of
the alternate spell checker); if a duplicate entry was found,
reload the currently open file (it may have been changed during
duplicate handling) */
if (quiet != 0)
quiet = 1;
if (add_open_file(quiet, 1 - quiet) == 2)
load_open_file();
#endif
@@ -74,13 +78,14 @@ void new_file(void)
editbot = fileage;
current = fileage;
totlines = 1;
totsize = 0;
#ifdef ENABLE_MULTIBUFFER
/* if there aren't any entries in open_files, create the entry for
this new file, and, of course, don't bother checking for
duplicates; without this, if nano is started without a filename on
the command line, a new file with no name will be created, but it
will be given no open_files entry, leading to problems later on */
the command line, a new file will be created, but it will be given
no open_files entry, leading to problems later on */
if (!open_files)
add_open_file(0, 0);
#endif
@@ -120,6 +125,14 @@ filestruct *read_line(char *buf, filestruct * prev, int *line1ins)
fileptr->data = charalloc(strlen(buf) + 2);
strcpy(fileptr->data, buf);
#ifndef NANO_SMALL
/* If it's a DOS file (CRLF), strip out the CR part*/
if (buf[strlen(buf) - 1] == '\r') {
fileptr->data[strlen(buf) - 1] = 0;
totsize--;
}
#endif
if (*line1ins) {
/* Special case, insert with cursor on 1st line. */
fileptr->prev = NULL;
@@ -149,7 +162,7 @@ filestruct *read_line(char *buf, filestruct * prev, int *line1ins)
}
int read_file(int fd, char *filename)
int read_file(int fd, char *filename, int quiet)
{
long size, num_lines = 0, linetemp = 0;
char input[2]; /* buffer */
@@ -173,11 +186,21 @@ int read_file(int fd, char *filename)
/* Read the entire file into file struct */
while ((size = read_byte(fd, filename, input)) > 0) {
linetemp = 0;
if (input[0] == '\n') {
fileptr = read_line(buf, fileptr, &line1ins);
num_lines++;
buf[0] = 0;
i = 0;
#ifndef NANO_SMALL
/* If it's a Mac file (no LF just a CR), handle it! */
} else if (i > 0 && buf[i-1] == '\r') {
fileptr = read_line(buf, fileptr, &line1ins);
num_lines++;
buf[0] = input[0];
buf[1] = 0;
i = 1;
#endif
} else {
/* Now we allocate a bigger buffer 128 characters at a time.
If we allocate a lot of space for one line, we may indeed
@@ -220,7 +243,7 @@ int read_file(int fd, char *filename)
totsize--;
/* Update the edit buffer */
load_file();
load_file(quiet);
}
statusbar(_("Read %d lines"), num_lines);
totlines += num_lines;
@@ -262,13 +285,14 @@ int open_file(char *filename, int insert, int quiet)
/* Don't open character or block files. Sorry, /dev/sndstat! */
statusbar(_("File \"%s\" is a device file"), filename);
if (!insert)
new_file();
return -1;
}
if (!quiet)
statusbar(_("Reading File"));
read_file(fd, filename);
read_file(fd, filename, quiet);
}
return 1;
@@ -319,6 +343,15 @@ int do_insertfile(int loading_file)
}
#endif
#ifndef DISABLE_OPERATINGDIR
if (operating_dir) {
if (check_operating_dir(realname, 0)) {
statusbar(_("Can't insert file from outside of %s"), operating_dir);
return 0;
}
}
#endif
#ifdef ENABLE_MULTIBUFFER
if (loading_file) {
@@ -346,7 +379,7 @@ int do_insertfile(int loading_file)
#ifdef ENABLE_MULTIBUFFER
if (loading_file)
load_file();
load_file(0);
else
#endif
@@ -475,9 +508,7 @@ int add_open_file(int update, int dup_fix)
while (current->prev)
current = current->prev;
open_files->file = copy_filestruct(current);
do_gotoline(open_files->lineno, 1);
placewewant = open_files->file_placewewant;
update_line(current, current_x);
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
/* save current modification status */
open_files->file_modified = ISSET(MODIFIED);
@@ -525,13 +556,9 @@ int load_open_file(void)
totlines = open_files->file_totlines;
totsize = open_files->file_totsize;
/* since do_gotoline() resets the x-coordinate but not the
y-coordinate, set all coordinates up this way */
current_y = open_files->file_current_y;
do_gotoline(open_files->lineno, 1);
current_x = open_files->file_current_x;
placewewant = open_files->file_placewewant;
update_line(current, current_x);
/* restore full file position: line number, x-coordinate, y-
coordinate, place we want */
do_gotopos(open_files->lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
/* set up modification status and update the titlebar */
if (open_files->file_modified)
@@ -556,7 +583,7 @@ int load_open_file(void)
*
* Note: This should only be called inside open_file_dup_fix().
*/
filestruct *open_file_dup_search(void)
filestruct *open_file_dup_search(int update)
{
filestruct *tmp;
char *path;
@@ -582,9 +609,18 @@ filestruct *open_file_dup_search(void)
if (!strcmp(tmp->file_path, path)) {
/* if it's not the current entry, we've found a duplicate */
if (tmp != open_files)
if (!update)
/* if we're making a new entry and there's an entry with
the same full path, we've found a duplicate */
return tmp;
else {
/* if we're updating an existing entry and there's an
entry with the same full path that isn't the current
entry, we've found a duplicate */
if (tmp != open_files)
return tmp;
}
}
/* go to the next entry */
@@ -602,7 +638,7 @@ filestruct *open_file_dup_search(void)
*/
int open_file_dup_fix(int update)
{
filestruct *tmp = open_file_dup_search();
filestruct *tmp = open_file_dup_search(update);
if (!tmp)
return 0;
@@ -766,17 +802,25 @@ int close_open_file(void)
display_main_list();
return 0;
}
#endif
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_OPERATINGDIR)
/*
* When passed "[relative path][filename]" in origpath, return "[full
* path][filename]" on success, or NULL on error.
* When passed "[relative path]" or "[relative path][filename]" in
* origpath, return "[full path]" or "[full path][filename]" on success,
* or NULL on error. This is still done if the file doesn't exist but
* the relative path does (since the file could exist in memory but not
* yet on disk); it is not done if the relative path doesn't exist (since
* the first call to chdir() will fail then).
*/
char *get_full_path(const char *origpath)
char *get_full_path(char *origpath)
{
char *newpath = NULL, *last_slash, *d_here, *d_there, *d_there_file;
int last_slash_index;
char *newpath = NULL, *last_slash, *d_here, *d_there, *d_there_file, tmp;
int path_only, last_slash_index;
struct stat fileinfo;
/* first, get the current directory */
/* first, get the current directory, and tack a slash onto the end of
it, unless it turns out to be "/", in which case leave it alone */
#ifdef PATH_MAX
d_here = getcwd(NULL, PATH_MAX + 1);
@@ -787,14 +831,44 @@ char *get_full_path(const char *origpath)
if (d_here) {
align(&d_here);
if (strcmp(d_here, "/")) {
d_here = nrealloc(d_here, strlen(d_here) + 2);
strcat(d_here, "/");
}
/* get the filename (with path included) and save it in both
d_there and d_there_file */
/* stat origpath; if stat() fails, assume that origpath refers to
a new file that hasn't been saved to disk yet (i. e. set
path_only to 0); if stat() succeeds, set path_only to 0 if
origpath doesn't refer to a directory, or to 1 if it does */
path_only = stat(origpath, &fileinfo);
if (path_only == -1)
path_only = 0;
else {
if (S_ISDIR(fileinfo.st_mode))
path_only = 1;
else
path_only = 0;
}
/* save the value of origpath in both d_there and d_there_file */
d_there = charalloc(strlen(origpath) + 1);
d_there_file = charalloc(strlen(origpath) + 1);
strcpy(d_there, origpath);
strcpy(d_there_file, origpath);
/* if we have a path but no filename, tack slashes onto the ends
of both d_there and d_there_file, if they don't end in slashes
already */
if (path_only) {
tmp = d_there[strlen(d_there) - 1];
if (tmp != '/') {
d_there = nrealloc(d_there, strlen(d_there) + 2);
strcat(d_there, "/");
d_there_file = nrealloc(d_there_file, strlen(d_there_file) + 2);
strcat(d_there_file, "/");
}
}
/* search for the last slash in d_there */
last_slash = strrchr(d_there, '/');
@@ -807,19 +881,27 @@ char *get_full_path(const char *origpath)
else {
/* otherwise, remove all non-path elements from d_there */
/* otherwise, remove all non-path elements from d_there
(i. e. everything after the last slash) */
last_slash_index = strlen(d_there) - strlen(last_slash);
null_at(d_there, last_slash_index);
null_at(d_there, last_slash_index + 1);
/* and remove all non-file elements from d_there_file */
last_slash++;
d_there_file = nrealloc(d_there_file, strlen(last_slash) + 1);
strcpy(d_there_file, last_slash);
/* and remove all non-file elements from d_there_file (i. e.
everything before and including the last slash); if we
have a path but no filename, don't do anything */
if (!path_only) {
last_slash = strrchr(d_there_file, '/');
last_slash++;
strcpy(d_there_file, last_slash);
align(&d_there_file);
}
/* now go to the path specified in d_there */
if (chdir(d_there) != -1) {
/* get the full pathname, and save it back in d_there */
/* get the full pathname, and save it back in d_there,
tacking a slash on the end if we have a path but no
filename; if the saving fails, get out */
free(d_there);
@@ -830,6 +912,17 @@ char *get_full_path(const char *origpath)
#endif
align(&d_there);
if (d_there) {
/* add a slash to d_there, unless it's "/", in which
case we don't need it */
if (strcmp(d_there, "/")) {
d_there = nrealloc(d_there, strlen(d_there) + 2);
strcat(d_there, "/");
}
}
else
return NULL;
}
/* finally, go back to where we were before, d_here (no error
@@ -840,11 +933,17 @@ char *get_full_path(const char *origpath)
/* all data is set up; fill in newpath */
/* newpath = d_there + "/" + d_there_file */
newpath = charalloc(strlen(d_there) + strlen(d_there_file) + 2);
strcpy(newpath, d_there);
strcat(newpath, "/");
strcat(newpath, d_there_file);
/* if we have a path and a filename, newpath = d_there +
d_there_file; otherwise, newpath = d_there */
if (!path_only) {
newpath = charalloc(strlen(d_there) + strlen(d_there_file) + 1);
strcpy(newpath, d_there);
strcat(newpath, d_there_file);
}
else {
newpath = charalloc(strlen(d_there) + 1);
strcpy(newpath, d_there);
}
/* finally, clean up */
free(d_there_file);
@@ -854,6 +953,80 @@ char *get_full_path(const char *origpath)
return newpath;
}
#endif /* ENABLE_MULTIBUFFER || !DISABLE_OPERATINGDIR */
#ifndef DISABLE_OPERATINGDIR
/*
* Check to see if we're inside the operating directory. Return 0 if we
* are, or 1 otherwise. If allow_tabcomp is nonzero, allow incomplete
* names that would be matches for the operating directory, so that tab
* completion will work.
*/
int check_operating_dir(char *currpath, int allow_tabcomp)
{
/* this is static so that we only need to get it the first time this
function is called; also, a relative operating directory path will
only be handled properly if this is done */
static char *full_operating_dir = NULL;
char *fullpath, *whereami1, *whereami2 = NULL;
/* if no operating directory is set, don't bother doing anything */
if (!operating_dir)
return 0;
/* if the operating directory is "/", that's the same as having no
operating directory, so discard it and get out */
if (!strcmp(operating_dir, "/")) {
operating_dir = NULL;
return 0;
}
/* get the full operating (if we don't have it already) and current
directories, and then search the current for the operating (for
normal usage) and the operating for the current (for tab
completion, if we're allowing it); if the current directory's path
doesn't exist, assume we're outside the operating directory */
if (!full_operating_dir) {
full_operating_dir = get_full_path(operating_dir);
/* if get_full_path() failed, discard the operating directory */
if (!full_operating_dir) {
operating_dir = NULL;
return 0;
}
/* if the full operating directory is "/", that's the same as
having no operating directory, so discard it and get out */
if (!strcmp(full_operating_dir, "/")) {
free(full_operating_dir);
operating_dir = NULL;
return 0;
}
}
fullpath = get_full_path(currpath);
if (!fullpath)
return 1;
whereami1 = strstr(fullpath, full_operating_dir);
if (allow_tabcomp)
whereami2 = strstr(full_operating_dir, fullpath);
/* if both searches failed, we're outside the operating directory */
if (!whereami1 && !whereami2)
return 1;
/* check the search results; if the full operating directory path is
not at the beginning of the full current path (for normal usage)
and vice versa (for tab completion, if we're allowing it), we're
outside the operating directory */
if (whereami1 != fullpath && whereami2 != full_operating_dir)
return 1;
/* otherwise, we're still inside it */
return 0;
}
#endif
/*
@@ -898,6 +1071,18 @@ int write_file(char *name, int tmp, int append, int nonamechange)
realname = mallocstrcpy(realname, name);
#endif
#ifndef DISABLE_OPERATINGDIR
if (!tmp && operating_dir) {
/* if we're writing a temporary file, we're going outside the
operating directory, so skip the operating directory test */
if (check_operating_dir(realname, 0)) {
statusbar(_("Can't write outside of %s"), operating_dir);
return -1;
}
}
#endif
/* Save the state of file at the end of the symlink (if there is one) */
realexists = stat(realname, &st);
@@ -966,7 +1151,13 @@ int write_file(char *name, int tmp, int append, int nonamechange)
fprintf(stderr, _("Wrote >%s\n"), fileptr->data);
#endif
}
write(fd, "\n", 1);
#ifndef NANO_SMALL
if (ISSET(DOS_FILE) || ISSET(MAC_FILE))
write(fd, "\r", 1);
if (!ISSET(MAC_FILE))
#endif
write(fd, "\n", 1);
fileptr = fileptr->next;
lineswritten++;
@@ -979,12 +1170,27 @@ int write_file(char *name, int tmp, int append, int nonamechange)
strerror(errno));
return -1;
} else if (size > 0) {
size = write(fd, "\n", 1);
lineswritten++;
if (size == -1) {
statusbar(_("Could not open file for writing: %s"),
#ifndef NANO_SMALL
if (ISSET(DOS_FILE) || ISSET(MAC_FILE)) {
size = write(fd, "\r", 1);
lineswritten++;
if (size == -1) {
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
return -1;
return -1;
}
}
if (!ISSET(MAC_FILE))
#endif
{
size = write(fd, "\n", 1);
lineswritten++;
if (size == -1) {
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
return -1;
}
}
}
}
@@ -1079,14 +1285,27 @@ int do_writeout(char *path, int exiting, int append)
}
while (1) {
/* Be nice to the translation folks */
#ifndef NANO_SMALL
if (ISSET(MARK_ISSET) && !exiting)
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
_("%s Selection to File"), append ? _("Append") : _("Write"));
else
if (ISSET(MARK_ISSET) && !exiting) {
if (append)
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
_("Append Selection to File"));
else
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
_("Write Selection to File"));
} else
#endif
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, answer,
_("File Name to %s"), append ? _("Append") : _("Write"));
{
if (append)
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, answer,
_("File Name to Append"));
else
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, answer,
_("File Name to Write"));
}
if (i != -1) {
@@ -1325,6 +1544,16 @@ char **username_tab_completion(char *buf, int *num_matches)
* This makes a lot more sense to me (Chris) this way...
*/
#ifndef DISABLE_OPERATINGDIR
/* ...unless the match exists outside the operating
directory, in which case just go to the next match */
if (operating_dir) {
if (check_operating_dir(userdata->pw_dir, 1))
continue;
}
#endif
matchline = charalloc(strlen(userdata->pw_name) + 2);
sprintf(matchline, "~%s", userdata->pw_name);
matches[*num_matches] = matchline;
@@ -1415,6 +1644,27 @@ char **cwd_tab_completion(char *buf, int *num_matches)
/* Cool, found a match. Add it to the list
* This makes a lot more sense to me (Chris) this way...
*/
#ifndef DISABLE_OPERATINGDIR
/* ...unless the match exists outside the operating
directory, in which case just go to the next match; to
properly do operating directory checking, we have to add the
directory name to the beginning of the proposed match
before we check it */
if (operating_dir) {
tmp2 = charalloc(strlen(dirName) + strlen(next->d_name) + 2);
strcpy(tmp2, dirName);
strcat(tmp2, "/");
strcat(tmp2, next->d_name);
if (check_operating_dir(tmp2, 1)) {
free(tmp2);
continue;
}
free(tmp2);
}
#endif
tmp2 = NULL;
tmp2 = charalloc(strlen(next->d_name) + 1);
strcpy(tmp2, next->d_name);
@@ -1518,6 +1768,13 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
strncpy(copyto, matches[0], strlen(matches[0]) + 1);
*newplace += strlen(matches[0]) - pos;
/* if an exact match is typed in and Tab is pressed,
*newplace will now be negative; in that case, make it
zero, so that the cursor will stay where it is instead of
moving backward */
if (*newplace < 0)
*newplace = 0;
/* Is it a directory? */
append_slash_if_dir(buf, lastWasTab, newplace);
@@ -1925,6 +2182,19 @@ char *do_browser(char *inpath)
path = mallocstrcpy(path, filelist[selected]);
#ifndef DISABLE_OPERATINGDIR
/* Note: The case of the user's being completely outside the
operating directory is handled elsewhere, before this
point */
if (operating_dir) {
if (check_operating_dir(path, 0)) {
statusbar(_("Can't visit parent in restricted mode"));
beep();
break;
}
}
#endif
st = filestat(path);
if (S_ISDIR(st.st_mode)) {
if ((test_dir = opendir(path)) == NULL) {
@@ -1961,6 +2231,15 @@ char *do_browser(char *inpath)
bottombars(browser_list, BROWSER_LIST_LEN);
curs_set(0);
#ifndef DISABLE_OPERATINGDIR
if (operating_dir) {
if (check_operating_dir(answer, 0)) {
statusbar(_("Can't go outside of %s in restricted mode"), operating_dir);
break;
}
}
#endif
if (j < 0) {
statusbar(_("Goto Cancelled"));
break;

View File

@@ -75,6 +75,11 @@ char *help_text; /* The text in the help window */
filestruct *mark_beginbuf; /* the begin marker buffer */
int mark_beginx; /* X value in the string to start */
#ifndef DISABLE_OPERATINGDIR
char *operating_dir = NULL; /* Operating directory, which we can't go
higher than */
#endif
#ifndef DISABLE_SPELLER
char *alt_speller; /* Alternative spell command */
#endif
@@ -146,7 +151,8 @@ void toggle_init(void)
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
*toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_case_msg,
*toggle_backwards_msg;
*toggle_backwards_msg, *toggle_dos_msg, *toggle_mac_msg,
*toggle_smooth_msg;
#ifdef ENABLE_MULTIBUFFER
char *toggle_load_msg, *nano_openprev_msg, *nano_opennext_msg;
@@ -156,6 +162,7 @@ void toggle_init(void)
char *toggle_regexp_msg;
#endif
toggle_const_msg = _("Constant cursor position");
toggle_autoindent_msg = _("Auto indent");
toggle_suspend_msg = _("Suspend");
@@ -163,8 +170,12 @@ void toggle_init(void)
toggle_picomode_msg = _("Pico mode");
toggle_mouse_msg = _("Mouse support");
toggle_cuttoend_msg = _("Cut to end");
toggle_backwards_msg = _("Backwards Search");
toggle_case_msg = _("Case Sensitive Search");
toggle_backwards_msg = _("Backwards search");
toggle_case_msg = _("Case sensitive search");
toggle_dos_msg = _("Writing file in DOS format");
toggle_mac_msg = _("Writing file in Mac format");
toggle_smooth_msg = _("Smooth scrolling");
#ifdef HAVE_REGEX_H
toggle_regexp_msg = _("Regular expressions");
#endif
@@ -196,13 +207,19 @@ void toggle_init(void)
REVERSE_SEARCH, 0);
toggle_init_one(&toggles[9], TOGGLE_CASE_KEY, toggle_case_msg,
CASE_SENSITIVE, 0);
toggle_init_one(&toggles[10], TOGGLE_DOS_KEY, toggle_dos_msg,
DOS_FILE, 0);
toggle_init_one(&toggles[11], TOGGLE_MAC_KEY, toggle_mac_msg,
MAC_FILE, 0);
toggle_init_one(&toggles[12], TOGGLE_SMOOTH_KEY, toggle_smooth_msg,
SMOOTHSCROLL, 0);
#ifdef ENABLE_MULTIBUFFER
toggle_init_one(&toggles[10], TOGGLE_LOAD_KEY, toggle_load_msg,
toggle_init_one(&toggles[13], TOGGLE_LOAD_KEY, toggle_load_msg,
MULTIBUFFER, 0);
toggle_init_one(&toggles[11], NANO_OPENPREV_KEY, nano_openprev_msg,
toggle_init_one(&toggles[14], NANO_OPENPREV_KEY, nano_openprev_msg,
0, '<');
toggle_init_one(&toggles[12], NANO_OPENNEXT_KEY, nano_opennext_msg,
toggle_init_one(&toggles[15], NANO_OPENNEXT_KEY, nano_opennext_msg,
0, '>');
#endif
@@ -231,7 +248,10 @@ void shortcut_init(int unjustify)
#ifndef NANO_SMALL
char *nano_tofiles_msg = "", *nano_gotodir_msg = "", *nano_case_msg =
"", *nano_reverse_msg = "", *nano_regexp_msg = "";
"", *nano_reverse_msg = "";
#ifdef HAVE_REGEX_H
char *nano_regexp_msg = "", *nano_bracket_msg = "";
#endif
nano_help_msg = _("Invoke the help menu");
nano_writeout_msg = _("Write the current file to disk");
@@ -275,8 +295,11 @@ void shortcut_init(int unjustify)
nano_gotodir_msg = _("Goto Directory");
nano_cancel_msg = _("Cancel the current function");
nano_append_msg = _("Append to the current file");
nano_reverse_msg = _("Search Backwards");
nano_regexp_msg = _("Use Regular Expressions");
nano_reverse_msg = _("Search backwards");
#ifdef HAVE_REGEX_H
nano_regexp_msg = _("Use Regular expressions");
nano_bracket_msg = _("Find other bracket");
#endif
#endif
sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
@@ -320,11 +343,11 @@ void shortcut_init(int unjustify)
sc_init_one(&main_list[6], NANO_PREVPAGE_KEY, _("Prev Page"),
nano_prevpage_msg,
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
sc_init_one(&main_list[7], NANO_NEXTPAGE_KEY, _("Next Page"),
nano_nextpage_msg,
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
sc_init_one(&main_list[8], NANO_CUT_KEY, _("Cut Text"),
nano_cut_msg, 0, NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
@@ -397,7 +420,11 @@ void shortcut_init(int unjustify)
nano_goto_msg,
NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
#if (!defined NANO_SMALL) && (defined HAVE_REGEX_H)
sc_init_one(&main_list[26], -9, _("Find Other Bracket"),
nano_bracket_msg,
NANO_BRACKET_KEY, 0, 0, VIEW, do_find_bracket);
#endif
sc_init_one(&whereis_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
@@ -416,7 +443,7 @@ void shortcut_init(int unjustify)
sc_init_one(&whereis_list[4], TOGGLE_CASE_KEY, _("Case Sens"),
nano_case_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&whereis_list[5], TOGGLE_BACKWARDS_KEY, _("Backward"),
sc_init_one(&whereis_list[5], TOGGLE_BACKWARDS_KEY, _("Direction"),
nano_reverse_msg, 0, 0, 0, VIEW, 0);
#ifdef HAVE_REGEX_H
@@ -446,7 +473,7 @@ void shortcut_init(int unjustify)
sc_init_one(&replace_list[4], TOGGLE_CASE_KEY, _("Case Sens"),
nano_case_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&replace_list[5], TOGGLE_BACKWARDS_KEY, _("Backward"),
sc_init_one(&replace_list[5], TOGGLE_BACKWARDS_KEY, _("Direction"),
nano_reverse_msg, 0, 0, 0, VIEW, 0);
#ifdef HAVE_REGEX_H
@@ -481,11 +508,11 @@ void shortcut_init(int unjustify)
sc_init_one(&help_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
nano_prevpage_msg,
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, do_page_up);
sc_init_one(&help_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
nano_nextpage_msg,
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, do_page_down);
sc_init_one(&help_list[2], NANO_EXIT_KEY, _("Exit"),
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);

44
move.c
View File

@@ -34,20 +34,24 @@
#define _(string) (string)
#endif
void page_down_center(void)
void page_down(void)
{
if (editbot != filebot) {
edit_update(editbot->next, CENTER);
center_cursor();
if (!ISSET(SMOOTHSCROLL)) {
if (editbot != filebot) {
edit_update(editbot->next, CENTER);
center_cursor();
} else {
while (current != filebot)
current = current->next;
edit_update(current, CENTER);
}
} else {
while (current != filebot)
current = current->next;
edit_update(current, CENTER);
edit_update(editbot, NONE);
}
update_cursor();
}
int page_down(void)
int do_page_down(void)
{
wrap_reset();
current_x = 0;
@@ -124,7 +128,7 @@ int do_down(void)
if (current_y < editwinrows - 1 && current != editbot)
current_y++;
else
page_down_center();
page_down();
update_cursor();
update_line(current->prev, 0);
@@ -134,11 +138,23 @@ int do_down(void)
return 1;
}
void page_up_center(void)
void page_up(void)
{
if (edittop != fileage) {
edit_update(edittop, CENTER);
center_cursor();
if (!ISSET(SMOOTHSCROLL)) {
edit_update(edittop, CENTER);
/* Now that we've updated the edit window, edittop might be
at the top of the file; if so, just move the cursor up one
line and don't center it. */
if (edittop != fileage)
center_cursor();
else {
current = current->prev;
reset_cursor();
}
} else {
edit_update(edittop->prev, NONE);
}
} else
current_y = 0;
@@ -146,7 +162,7 @@ void page_up_center(void)
}
int page_up(void)
int do_page_up(void)
{
int i;
@@ -184,7 +200,7 @@ int do_up(void)
if (current_y > 0)
current_y--;
else
page_up_center();
page_up();
update_cursor();
update_line(current->next, 0);

43
nano.1
View File

@@ -5,10 +5,8 @@
.\" This is free documentation, see the latest version of the GNU General
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" 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 "April 30, 2001"
.\" $Id$
.TH NANO 1 "October 3, 2001"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
@@ -33,25 +31,35 @@ also implements some missing (or disabled by default) features in Pico,
such as "search and replace" and "goto line number".
.SH OPTIONS
.TP
.B \-D (\-\-dos)
Write file in DOS format.
.TP
.B \-F (\-\-multibuffer)
Enable multiple file buffers (if available).
.TP
.B \-T (\-\-tabsize)
Set the size (width) of a tab.
.B \-M (\-\-mac)
Write file in Mac format.
.TP
.B \-R (\-\-regexp)
Enable regular expression matching for search strings, as well as
\\n subexpression replacement for replace strings, if available.
.TP
.B \-S (\-\-smooth)
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behaviour.
.TP
.B \-T [num] (\-\-tabsize=[num])
Set the size (width) of a tab.
.TP
.B \-V (\-\-version)
Show the current version number and author.
.TP
.B \-h (\-\-help)
Display a summary of command line options.
.TP
.B \-c (\-\-const)
Constantly show the cursor position.
.TP
.B \-h (\-\-help)
Display a summary of command line options.
.TP
.B \-i (\-\-autoindent)
Indent new lines to the previous line's indentation. Useful when editing
source code.
@@ -66,18 +74,21 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
.B \-m (\-\-mouse)
Enable mouse support (if available for your system).
.TP
.B \-o [dir] (\-\-operatingdir=[dir])
Set operating directory. Makes nano set up something similar to a chroot.
.TP
.B \-p (\-\-pico)
Emulate Pico as closely as possible. This affects both the "shortcut list"
at the bottom of the screen, as well as the display and entry of previous
search and replace strings.
.TP
.B \-r (\-\-fill)
.B \-r [#cols] (\-\-fill=[#cols])
Wrap lines at column #cols. By default, this is the width of the screen,
less eight. If this value is negative, wrapping will occur at #cols from
the right of the screen, allowing it to vary along with the screen width
if the screen is resized.
.TP
.B \-s (\-\-speller)
.B \-s [prog] (\-\-speller=[prog])
Enable alternative spell checker command.
.TP
.B \-t (\-\-tempfile)
@@ -95,7 +106,7 @@ Disable help screen at bottom of editor.
.B \-z (\-\-suspend)
Enable suspend ability.
.TP
.B \-b, \-e, \-f
.B \-a, \-b, \-e, \-f, \-g, \-j
Ignored, for compatibility with Pico.
.TP
.B \+LINE
@@ -105,8 +116,9 @@ Nano will try to dump the buffer into an emergency file in some cases.
Mainly, this will happen if Nano receives a SIGHUP or runs out of
memory, when it will write the buffer into a file named "nano.save" if the
buffer didn't have a name already, or will add a ".save" suffix to the
current filename. Nano will \fBnot\fP write this file if a previous one
exists in the current directory.
current filename. In multibuffer mode, nano will write all the open buffers to
the respective emergency files. Nano will \fBnot\fP write this file if a
previous one exists in the current directory.
.SH BUGS
Please send any comments or bug reports to
.br
@@ -120,7 +132,8 @@ subject of "subscribe".
.SH HOMEPAGE
http://www.nano-editor.org
.SH AUTHOR
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS for details).
Chris Allegretta <chrisa@asty.org>, et al (see AUTHORS and THANKS for
details).
This manual page was originally written by Jordi Mallach
<jordi@sindominio.net>, for the Debian GNU/Linux system (but may be
used by others).

View File

@@ -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: April 30, 2001<BR><A HREF="#index">Index</A>
Section: User Commands (1)<BR>Updated: October 3, 2001<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
@@ -44,31 +44,44 @@ such as &quot;search and replace&quot; and &quot;goto line number&quot;.
<H2>OPTIONS</H2>
<DL COMPACT>
<DT><B>-D (--dos)</B>
<DD>
Write file in DOS format.
<DT><B>-F (--multibuffer)</B>
<DD>
Enable multiple file buffers (if available).
<DT><B>-T (--tabsize)</B>
<DT><B>-M (--mac)</B>
<DD>
Set the size (width) of a tab.
Write file in Mac format.
<DT><B>-R (--regexp)</B>
<DD>
Enable regular expression matching for search strings, as well as
\n subexpression replacement for replace strings, if available.
<DT><B>-S (--smooth)</B>
<DD>
Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behaviour.
<DT><B>-T [num] (--tabsize=[num])</B>
<DD>
Set the size (width) of a tab.
<DT><B>-V (--version)</B>
<DD>
Show the current version number and author.
<DT><B>-h (--help)</B>
<DD>
Display a summary of command line options.
<DT><B>-c (--const)</B>
<DD>
Constantly show the cursor position.
<DT><B>-h (--help)</B>
<DD>
Display a summary of command line options.
<DT><B>-i (--autoindent)</B>
<DD>
@@ -87,20 +100,24 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
<DD>
Enable mouse support (if available for your system).
<DT><B>-o [dir] (--operatingdir=[dir])</B>
<DD>
Set operating directory. Makes nano set up something similar to a chroot.
<DT><B>-p (--pico)</B>
<DD>
Emulate Pico as closely as possible. This affects both the &quot;shortcut list&quot;
at the bottom of the screen, as well as the display and entry of previous
search and replace strings.
<DT><B>-r (--fill)</B>
<DT><B>-r [#cols] (--fill=[#cols])</B>
<DD>
Wrap lines at column #cols. By default, this is the width of the screen,
less eight. If this value is negative, wrapping will occur at #cols from
the right of the screen, allowing it to vary along with the screen width
if the screen is resized.
<DT><B>-s (--speller)</B>
<DT><B>-s [prog] (--speller=[prog])</B>
<DD>
Enable alternative spell checker command.
@@ -124,7 +141,7 @@ Disable help screen at bottom of editor.
<DD>
Enable suspend ability.
<DT><B>-b, -e, -f</B>
<DT><B>-a, -b, -e, -f, -g, -j</B>
<DD>
Ignored, for compatibility with Pico.
@@ -140,8 +157,9 @@ Nano will try to dump the buffer into an emergency file in some cases.
Mainly, this will happen if Nano receives a SIGHUP or runs out of
memory, when it will write the buffer into a file named &quot;nano.save&quot; if the
buffer didn't have a name already, or will add a &quot;.save&quot; suffix to the
current filename. Nano will <B>not</B> write this file if a previous one
exists in the current directory.
current filename. In multibuffer mode, nano will write all the open buffers to
the respective emergency files. Nano will <B>not</B> write this file if a
previous one exists in the current directory.
<A NAME="lbAG">&nbsp;</A>
<H2>BUGS</H2>
@@ -166,7 +184,8 @@ subject of &quot;subscribe&quot;.
<A NAME="lbAI">&nbsp;</A>
<H2>AUTHOR</H2>
Chris Allegretta &lt;<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>&gt;, et al (see AUTHORS for details).
Chris Allegretta &lt;<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>&gt;, et al (see AUTHORS and THANKS for
details).
This manual page was originally written by Jordi Mallach
&lt;<A HREF="mailto:jordi@sindominio.net">jordi@sindominio.net</A>&gt;, for the Debian GNU/Linux system (but may be
used by others).
@@ -188,6 +207,6 @@ used by others).
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 03:54:23 GMT, July 15, 2001
Time: 01:18:43 GMT, October 04, 2001
</BODY>
</HTML>

298
nano.c
View File

@@ -202,8 +202,9 @@ void clear_filename(void)
filename[0] = 0;
}
/* Initialize global variables - no better way for now */
void global_init(void)
/* Initialize global variables - no better way for now. If
save_cutbuffer is nonzero, don't set cutbuffer to NULL. */
void global_init(int save_cutbuffer)
{
current_x = 0;
current_y = 0;
@@ -212,11 +213,13 @@ void global_init(void)
die_too_small();
fileage = NULL;
cutbuffer = NULL;
if (!save_cutbuffer)
cutbuffer = NULL;
current = NULL;
edittop = NULL;
editbot = NULL;
totlines = 0;
totsize = 0;
placewewant = 0;
#ifndef DISABLE_WRAPJUSTIFY
@@ -402,18 +405,31 @@ void usage(void)
printf(_("Usage: nano [GNU long option] [option] +LINE <file>\n\n"));
printf(_("Option Long option Meaning\n"));
#ifndef NANO_SMALL
printf
(_
(" -D --dos Write file in DOS format\n"));
#endif
#ifdef ENABLE_MULTIBUFFER
printf
(_
(" -F --multibuffer Enable multiple file buffers\n"));
#endif
printf(_
(" -T [num] --tabsize=[num] Set width of a tab to num\n"));
#ifndef NANO_SMALL
printf
(_
(" -M --mac Write file in Mac format\n"));
#endif
#ifdef HAVE_REGEX_H
printf(_
(" -R --regexp Use regular expressions for search\n"));
#endif
#ifndef NANO_SMALL
printf(_
(" -S --smooth Smooth scrolling\n"));
#endif
printf(_
(" -T [num] --tabsize=[num] Set width of a tab to num\n"));
printf
(_
(" -V --version Print version information and exit\n"));
@@ -421,9 +437,9 @@ void usage(void)
(" -c --const Constantly show cursor position\n"));
printf(_
(" -h --help Show this message\n"));
#ifndef NANO_SMALL
printf(_
(" -i --autoindent Automatically indent new lines\n"));
#ifndef NANO_SMALL
printf(_
(" -k --cut Let ^K cut from cursor to end of line\n"));
#endif
@@ -434,8 +450,12 @@ void usage(void)
printf(_(" -m --mouse Enable mouse\n"));
#endif
#endif
#ifndef DISABLE_OPERATINGDIR
printf(_
(" -p --pico Emulate Pico as closely as possible\n"));
(" -o [dir] --operatingdir=[dir] Set operating directory\n"));
#endif
printf(_
(" -p --pico Emulate Pico as closely as possible\n"));
#ifndef DISABLE_WRAPJUSTIFY
printf
@@ -463,16 +483,25 @@ void usage(void)
#else
printf(_("Usage: nano [option] +LINE <file>\n\n"));
printf(_("Option Meaning\n"));
#ifndef NANO_SMALL
printf(_(" -D Write file in DOS format\n"));
#endif
#ifdef ENABLE_MULTIBUFFER
printf(_(" -F Enable multiple file buffers\n"));
#endif
#ifndef NANO_SMALL
printf(_(" -M Write file in Mac format\n"));
#endif
printf(_(" -T [num] Set width of a tab to num\n"));
printf(_(" -R Use regular expressions for search\n"));
#ifndef NANO_SMALL
printf(_(" -S Smooth scrolling\n"));
#endif
printf(_(" -V Print version information and exit\n"));
printf(_(" -c Constantly show cursor position\n"));
printf(_(" -h Show this message\n"));
printf(_(" -i Automatically indent new lines\n"));
#ifndef NANO_SMALL
printf(_(" -i Automatically indent new lines\n"));
printf(_(" -k Let ^K cut from cursor to end of line\n"));
#endif
printf(_
@@ -481,6 +510,9 @@ void usage(void)
#ifdef NCURSES_MOUSE_VERSION
printf(_(" -m Enable mouse\n"));
#endif
#endif
#ifndef DISABLE_OPERATINGDIR
printf(_(" -o [dir] Set operating directory\n"));
#endif
printf(_(" -p Emulate Pico as closely as possible\n"));
@@ -547,6 +579,9 @@ void version(void)
#ifdef DISABLE_MOUSE
printf(" --disable-mouse");
#endif
#ifdef DISABLE_OPERATINGDIR
printf(" --disable-operatingdir");
#endif
#endif /* NANO_SMALL */
#ifdef DISABLE_WRAPPING
@@ -608,7 +643,6 @@ int do_mark(void)
edit_refresh();
}
#endif
SET(DISABLE_CURPOS);
return 1;
}
@@ -662,13 +696,17 @@ void do_char(char ch)
int do_enter(filestruct * inptr)
{
filestruct *newnode;
char *tmp, *spc;
char *tmp;
#ifndef NANO_SMALL
char *spc;
int extra = 0;
#endif
newnode = make_new_node(inptr);
tmp = &current->data[current_x];
current_x = 0;
#ifndef NANO_SMALL
/* Do auto-indenting, like the neolithic Turbo Pascal editor */
if (ISSET(AUTOINDENT)) {
spc = current->data;
@@ -683,7 +721,9 @@ int do_enter(filestruct * inptr)
strncpy(newnode->data, current->data, extra);
strcpy(&newnode->data[extra], tmp);
}
} else {
} else
#endif
{
newnode->data = charalloc(strlen(tmp) + 1);
strcpy(newnode->data, tmp);
}
@@ -727,6 +767,7 @@ int do_enter_void(void)
return do_enter(current);
}
#ifndef NANO_SMALL
void do_next_word(void)
{
filestruct *fileptr, *old;
@@ -778,6 +819,7 @@ void do_next_word(void)
}
}
#endif /* NANO_SMALL */
#ifndef DISABLE_WRAPPING
void do_wrap(filestruct * inptr, char input_char)
@@ -847,13 +889,10 @@ void do_wrap(filestruct * inptr, char input_char)
* it is all spaces between previous word and next word which appears after fill.
* b) cursor is at the word at the wrap point.
* - word at wrap point starts a new line.
* 1. pressed a space and at first character of wrap point word.
* - white space on original line is kept to where cursor was.
* 2. pressed non space (or space elsewhere).
* - white space at end of original line is cleared.
* - white space on original line is kept to where cursor was.
* c) cursor is past the word at the wrap point.
* - word at wrap point starts a new line.
* - white space at end of original line is cleared
* - white space at end of original line is cleared
*/
temp = nmalloc(sizeof(filestruct));
@@ -896,7 +935,12 @@ void do_wrap(filestruct * inptr, char input_char)
/* Inside word, remove it from original, and move cursor to right spot. */
if (current_x >= current_word_start) {
right = current_x - current_word_start;
/* Decrease totsize by the number of spaces we removed, less
one for the new line we're replacing the spaces with. */
totsize -= (current_word_start - 1);
current_x = 0;
#ifndef NANO_SMALL
if (ISSET(AUTOINDENT)) {
int i = 0;
while ((inptr->next->data[i] == ' '
@@ -905,6 +949,7 @@ void do_wrap(filestruct * inptr, char input_char)
right++;
}
}
#endif
down = 1;
}
@@ -926,10 +971,16 @@ void do_wrap(filestruct * inptr, char input_char)
if (!isspace((int) input_char)) {
i = current_word_start - 1;
/* Decrement totsize each time we remove a space. */
while (isspace((int) inptr->data[i])) {
i--;
totsize--;
assert(i >= 0);
}
/* And increment it to account for the blank line we're
replacing the spaces with. */
totsize++;
} else if (current_x <= last_word_end)
i = last_word_end - 1;
else
@@ -950,6 +1001,7 @@ void do_wrap(filestruct * inptr, char input_char)
down = 1;
right = current_x - current_word_start;
#ifndef NANO_SMALL
if (ISSET(AUTOINDENT)) {
int i = 0;
while ((inptr->next->data[i] == ' '
@@ -958,22 +1010,16 @@ void do_wrap(filestruct * inptr, char input_char)
right++;
}
}
#endif
i = current_word_start - 1;
if (isspace((int) input_char)
&& (current_x == current_word_start)) {
current_x = current_word_start;
current_x = current_word_start;
null_at(inptr->data, current_word_start);
} else {
null_at(inptr->data, current_word_start);
while (isspace((int) inptr->data[i])) {
i--;
assert(i >= 0);
}
inptr->data = nrealloc(inptr->data, i + 2);
inptr->data[i + 1] = 0;
}
/* Increment totsize to account for the new line that
will be added below, so that it won't end up being
short by one. */
totsize++;
}
@@ -989,12 +1035,17 @@ void do_wrap(filestruct * inptr, char input_char)
current_x = current_word_start;
i = current_word_start - 1;
/* Decrement totsize each time we remove a space. */
while (isspace((int) inptr->data[i])) {
i--;
totsize--;
assert(i >= 0);
inptr->data = nrealloc(inptr->data, i + 2);
inptr->data[i + 1] = 0;
}
/* And increment it to account for the blank line we're
replacing the spaces with. */
totsize++;
}
}
@@ -1006,6 +1057,12 @@ void do_wrap(filestruct * inptr, char input_char)
char *p =
charalloc((strlen(temp->data) + strlen(inptr->next->data) + 2));
/* We're adding to an existing line instead of creating a new
one; decrement totlines here so that when it gets incremented
below, it won't end up being high by one. */
totlines--;
#ifndef NANO_SMALL
if (ISSET(AUTOINDENT)) {
int non = 0;
@@ -1024,7 +1081,9 @@ void do_wrap(filestruct * inptr, char input_char)
/* Now tack on the rest of the next line after the spaces and
tabs */
strcat(p, &inptr->next->data[non]);
} else {
} else
#endif
{
strcpy(p, temp->data);
strcat(p, " ");
strcat(p, inptr->next->data);
@@ -1054,6 +1113,7 @@ void do_wrap(filestruct * inptr, char input_char)
SET(SAMELINEWRAP);
#ifndef NANO_SMALL
if (ISSET(AUTOINDENT)) {
char *spc = inptr->data;
char *t = NULL;
@@ -1071,6 +1131,7 @@ void do_wrap(filestruct * inptr, char input_char)
temp->data = t;
}
}
#endif
}
@@ -1178,7 +1239,7 @@ int do_backspace(void)
current = previous->next;
else
current = previous;
page_up_center();
page_up();
} else {
if (previous->next)
current = previous->next;
@@ -1303,7 +1364,7 @@ int do_int_spell_fix(char *word)
edit_update(fileage, TOP);
/* make sure word is still mis-spelt (i.e. when multi-errors) */
if (findnextstr(TRUE, fileage, beginx_top, prevanswer) != NULL) {
if (findnextstr(TRUE, FALSE, fileage, beginx_top, prevanswer) != NULL) {
do_replace_highlight(TRUE, prevanswer);
/* allow replace word to be corrected */
@@ -1467,7 +1528,7 @@ int do_int_speller(char *tempfile_name)
/* External spell checking */
int do_alt_speller(char *file_name)
{
int alt_spell_status;
int alt_spell_status, x_cur = current_x, y_cur = current_y, pww_cur = placewewant;
pid_t pid_spell;
char *ptr;
long lineno_cur = current->lineno;
@@ -1517,19 +1578,15 @@ int do_alt_speller(char *file_name)
refresh();
free_filestruct(fileage);
global_init();
global_init(1);
open_file(file_name, 0, 1);
do_gotoline(lineno_cur, 0);
/* go back to the old position, mark the file as modified, and make
sure that the titlebar is refreshed */
do_gotopos(lineno_cur, x_cur, y_cur, pww_cur);
set_modified();
#ifdef ENABLE_MULTIBUFFER
/* if we have multiple files open, the spell-checked (current) file
is now stored after the un-spell-checked file in the open_files
structure, so go back to the un-spell-checked file and close it */
open_prevfile(0);
close_open_file();
#endif
clearok(topwin, FALSE);
titlebar(NULL);
return TRUE;
}
@@ -1556,6 +1613,14 @@ int do_spell(void)
return 0;
}
#ifdef ENABLE_MULTIBUFFER
/* update the current open_files entry before spell-checking, in case
any problems occur; the case of there being no open_files entries
is handled elsewhere (before we reach this point); no duplicate
checking is needed here */
add_open_file(1, 0);
#endif
if (alt_speller)
spell_res = do_alt_speller(temp);
else
@@ -1707,7 +1772,13 @@ void do_mouse(void)
update_cursor();
edit_refresh();
} else if (wenclose(bottomwin, mevent.y, mevent.x) && !ISSET(NO_HELP)) {
int k = COLS / 6, val = 0;
int k, val = 0;
if (currslen < 2)
k = COLS / 6;
else
k = COLS / ((currslen + (currslen %2)) / 2);
/* Determine what shortcut list was clicked */
mevent.y -= (editwinrows + 3);
@@ -1723,6 +1794,11 @@ void do_mouse(void)
/* And ungetch that value */
ungetch(val);
/* And if it's an alt-key sequence, we should probably send alt
too ;-) */
if (val >= 'a' && val <= 'z')
ungetch(27);
}
}
#endif
@@ -2212,7 +2288,10 @@ void help_init(void)
/* Now add our shortcut info */
for (i = 0; i <= MAIN_LIST_LEN - 1; i++) {
sofar = snprintf(buf, BUFSIZ, "^%c ", main_list[i].val + 64);
if (main_list[i].val > 0)
sofar = snprintf(buf, BUFSIZ, "^%c ", main_list[i].val + 64);
else
sofar = snprintf(buf, BUFSIZ, " ");
if (main_list[i].misc1 > KEY_F0 && main_list[i].misc1 <= KEY_F(64))
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(F%d) ",
@@ -2220,9 +2299,12 @@ void help_init(void)
else
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
if (main_list[i].altval > 0)
if (main_list[i].altval > 0 && main_list[i].altval < 91)
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(M-%c) ",
main_list[i].altval - 32);
else if (main_list[i].altval > 0)
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, "(M-%c) ",
main_list[i].altval);
else
sofar += snprintf(&buf[sofar], BUFSIZ - sofar, " ");
@@ -2268,12 +2350,20 @@ void do_toggle(int which)
char *enabled = _("enabled");
char *disabled = _("disabled");
switch (toggles[which].val) {
case TOGGLE_BACKWARDS_KEY:
case TOGGLE_CASE_KEY:
case TOGGLE_REGEXP_KEY:
return;
}
/* Even easier! */
TOGGLE(toggles[which].flag);
switch (toggles[which].val) {
case TOGGLE_PICOMODE_KEY:
shortcut_init(0);
SET(CLEAR_BACKUPSTRING);
display_main_list();
break;
case TOGGLE_SUSPEND_KEY:
@@ -2290,7 +2380,12 @@ void do_toggle(int which)
edit_refresh();
display_main_list();
break;
case TOGGLE_DOS_KEY:
UNSET(MAC_FILE);
break;
case TOGGLE_MAC_KEY:
UNSET(DOS_FILE);
break;
}
if (!ISSET(toggles[which].flag)) {
@@ -2307,8 +2402,6 @@ void do_toggle(int which)
statusbar("%s %s", toggles[which].desc, enabled);
}
SET(DISABLE_CURPOS);
#endif
}
@@ -2355,6 +2448,8 @@ int main(int argc, char *argv[])
int keyhandled; /* Have we handled the keystroke yet? */
int i, modify_control_seq;
char *argv0;
long constcheck; /* Check to constantly update */
#ifdef _POSIX_VDISABLE
struct termios term;
#endif
@@ -2374,8 +2469,10 @@ int main(int argc, char *argv[])
{"view", 0, 0, 'v'},
#ifndef NANO_SMALL
{"cut", 0, 0, 'k'},
#endif
{"dos", 0, 0, 'D'},
{"mac", 0, 0, 'M'},
{"autoindent", 0, 0, 'i'},
#endif
{"tempfile", 0, 0, 't'},
#ifndef DISABLE_SPELLER
{"speller", 1, 0, 's'},
@@ -2385,6 +2482,9 @@ int main(int argc, char *argv[])
{"fill", 1, 0, 'r'},
#endif
{"mouse", 0, 0, 'm'},
#ifndef DISABLE_OPERATINGDIR
{"operatingdir", 1, 0, 'o'},
#endif
{"pico", 0, 0, 'p'},
{"nofollow", 0, 0, 'l'},
{"tabsize", 1, 0, 'T'},
@@ -2392,7 +2492,9 @@ int main(int argc, char *argv[])
#ifdef ENABLE_MULTIBUFFER
{"multibuffer", 0, 0, 'F'},
#endif
#ifndef NANO_SMALL
{"smooth", 0, 0, 'S'},
#endif
{0, 0, 0, 0}
};
#endif
@@ -2413,21 +2515,30 @@ int main(int argc, char *argv[])
#endif /* ENABLE_NANORC */
#ifdef HAVE_GETOPT_LONG
while ((optchr = getopt_long(argc, argv, "h?FT:RVbcefgijklmpr:s:tvwxz",
while ((optchr = getopt_long(argc, argv, "h?DFMRST:Vabcefgijklmo:pr:s:tvwxz",
long_options, &option_index)) != EOF) {
#else
while ((optchr =
getopt(argc, argv, "h?FT:RVbcefgijklmpr:s:tvwxz")) != EOF) {
getopt(argc, argv, "h?DFMRST:Vabcefgijklmo:pr:s:tvwxz")) != EOF) {
#endif
switch (optchr) {
#ifndef NANO_SMALL
case 'D':
SET(DOS_FILE);
break;
#endif
#ifdef ENABLE_MULTIBUFFER
case 'F':
SET(MULTIBUFFER);
break;
#endif
#ifndef NANO_SMALL
case 'M':
SET(MAC_FILE);
break;
#endif
case 'T':
tabsize = atoi(optarg);
if (tabsize <= 0) {
@@ -2439,10 +2550,16 @@ int main(int argc, char *argv[])
case 'R':
SET(USE_REGEXP);
break;
#endif
#ifndef NANO_SMALL
case 'S':
SET(SMOOTHSCROLL);
break;
#endif
case 'V':
version();
exit(0);
case 'a':
case 'b':
case 'e':
case 'f':
@@ -2457,10 +2574,10 @@ int main(int argc, char *argv[])
case '?':
usage();
exit(0);
#ifndef NANO_SMALL
case 'i':
SET(AUTOINDENT);
break;
#ifndef NANO_SMALL
case 'k':
SET(CUT_TO_END);
break;
@@ -2471,6 +2588,20 @@ int main(int argc, char *argv[])
case 'm':
SET(USE_MOUSE);
break;
#ifndef DISABLE_OPERATINGDIR
case 'o':
operating_dir = charalloc(strlen(optarg) + 1);
strcpy(operating_dir, optarg);
/* make sure we're inside the operating directory */
if (check_operating_dir(".", 0)) {
if (chdir(operating_dir) == -1) {
free(operating_dir);
operating_dir = NULL;
}
}
break;
#endif
case 'p':
SET(PICO_MODE);
break;
@@ -2565,7 +2696,7 @@ int main(int argc, char *argv[])
noecho();
/* Set up some global variables */
global_init();
global_init(0);
shortcut_init(0);
#ifndef DISABLE_HELP
init_help_msg();
@@ -2620,6 +2751,7 @@ int main(int argc, char *argv[])
reset_cursor();
while (1) {
constcheck = current->lineno + current_x + totsize;
#ifndef DISABLE_MOUSE
currshortcut = main_list;
@@ -2635,10 +2767,11 @@ int main(int argc, char *argv[])
#ifdef DEBUG
fprintf(stderr, "AHA! %c (%d)\n", kbinput, kbinput);
#endif
if (kbinput == 27) { /* Grab Alt-key stuff first */
switch (kbinput = wgetch(edit)) {
/* Alt-O, suddenly very important ;) */
case 79:
case 'O':
kbinput = wgetch(edit);
if ((kbinput <= 'D' && kbinput >= 'A') ||
(kbinput <= 'd' && kbinput >= 'a'))
@@ -2661,7 +2794,7 @@ int main(int argc, char *argv[])
modify_control_seq = 1;
keyhandled = 1;
break;
case 91:
case '[':
switch (kbinput = wgetch(edit)) {
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
kbinput = wgetch(edit);
@@ -2671,7 +2804,7 @@ int main(int argc, char *argv[])
} else if (kbinput >= '7' && kbinput <= '9') {
kbinput = KEY_F(kbinput - 49);
wgetch(edit);
} else if (kbinput == 126)
} else if (kbinput == '~')
kbinput = KEY_HOME;
#ifdef DEBUG
@@ -2702,16 +2835,8 @@ int main(int argc, char *argv[])
kbinput = KEY_F(12);
wgetch(edit);
break;
case 126: /* Hack, make insert key do something
useful, like insert file */
#ifdef ENABLE_MULTIBUFFER
do_insertfile(ISSET(MULTIBUFFER));
#else
do_insertfile(0);
#endif
keyhandled = 1;
break;
case '~':
goto do_insertkey;
#ifdef DEBUG
default:
fprintf(stderr, _("I got Alt-[-2-%c! (%d)\n"),
@@ -2846,6 +2971,24 @@ int main(int argc, char *argv[])
keyhandled = 1;
}
#ifndef USE_SLANG
/* Hack, make insert key do something useful, like insert file */
if (kbinput == KEY_IC) {
#else
if (0) {
#endif
do_insertkey:
#ifdef ENABLE_MULTIBUFFER
do_insertfile(ISSET(MULTIBUFFER));
#else
do_insertfile(0);
#endif
keyhandled = 1;
}
/* Last gasp, stuff that's not in the main lists */
if (!keyhandled)
switch (kbinput) {
@@ -2856,12 +2999,14 @@ int main(int argc, char *argv[])
break;
#endif
#endif
#ifndef NANO_SMALL
case 0: /* Erg */
do_next_word();
break;
#endif
case 331: /* Stuff that we don't want to do squat */
case -1:
case -1: /* Stuff that we don't want to do squat */
case 410: /* Must ignore this, it gets sent when we resize */
#ifdef PDCURSES
case 541: /* ???? */
@@ -2885,12 +3030,11 @@ int main(int argc, char *argv[])
}
do_char(kbinput);
}
if (ISSET(CONSTUPDATE)) {
if (ISSET(DISABLE_CURPOS))
UNSET(DISABLE_CURPOS);
else
if (ISSET(DISABLE_CURPOS))
UNSET(DISABLE_CURPOS);
else if (ISSET(CONSTUPDATE))
if (constcheck != current->lineno + current_x + totsize)
do_cursorpos();
}
reset_cursor();
wrefresh(edit);

19
nano.h
View File

@@ -137,9 +137,13 @@ typedef struct rcoption {
#define REGEXP_COMPILED (1<<15)
#define TEMP_OPT (1<<16)
#define CUT_TO_END (1<<17)
#define DISABLE_CURPOS (1<<18)
#define REVERSE_SEARCH (1<<19)
#define MULTIBUFFER (1<<20)
#define REVERSE_SEARCH (1<<18)
#define MULTIBUFFER (1<<19)
#define CLEAR_BACKUPSTRING (1<<20)
#define DOS_FILE (1<<21)
#define MAC_FILE (1<<22)
#define SMOOTHSCROLL (1<<23)
#define DISABLE_CURPOS (1<<24) /* Damn, we still need it */
/* Control key sequences, changing these would be very very bad */
@@ -203,6 +207,7 @@ typedef struct rcoption {
#define NANO_ALT_Z 'z'
#define NANO_ALT_LCARAT ','
#define NANO_ALT_RCARAT '.'
#define NANO_ALT_BRACKET ']'
/* Some semi-changeable keybindings; don't play with unless you're sure you
know what you're doing */
@@ -260,6 +265,7 @@ know what you're doing */
#define NANO_APPEND_KEY NANO_ALT_A
#define NANO_OPENPREV_KEY NANO_ALT_LCARAT
#define NANO_OPENNEXT_KEY NANO_ALT_RCARAT
#define NANO_BRACKET_KEY NANO_ALT_BRACKET
#define TOGGLE_CONST_KEY NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
@@ -273,6 +279,9 @@ know what you're doing */
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
#define TOGGLE_CASE_KEY NANO_ALT_A
#define TOGGLE_LOAD_KEY NANO_ALT_F
#define TOGGLE_DOS_KEY NANO_ALT_D
#define TOGGLE_MAC_KEY NANO_ALT_O
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
/* Toggle stuff, these static lengths need to go away RSN */
@@ -306,11 +315,11 @@ know what you're doing */
#define WHEREIS_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
#define REPLACE_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
#define TOGGLE_LEN (11 - NO_REGEX + MULTI_TOGGLES)
#define TOGGLE_LEN (14 - NO_REGEX + MULTI_TOGGLES)
#define WRITEFILE_LIST_LEN (3 - NO_BROWSER)
#define INSERTFILE_LIST_LEN (2 - NO_BROWSER)
#define BROWSER_LIST_LEN 4
#define MAIN_LIST_LEN 26
#define MAIN_LIST_LEN (27 - NO_REGEX)
#define MAIN_VISIBLE 12
#define REPLACE_LIST_2_LEN 3
#define GOTO_LIST_LEN 3

411
nano.info
View File

@@ -1,411 +0,0 @@
This is nano.info, produced by makeinfo version 4.0b from nano.texi.
INFO-DIR-SECTION Editors
START-INFO-DIR-ENTRY
* Nano: (nano). Small and friendly text editor.
END-INFO-DIR-ENTRY

File: nano.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)
This manual documents GNU nano, a small and friendly text editor.
* Menu:
* Introduction::
* Editor Basics::
* Online Help::
* Feature Toggles::
* The File Browser::
* Pico Compatibility::
* Building and Configure Options::

File: nano.info, Node: Introduction, Next: Editor Basics, Prev: Top, Up: Top
Introduction
************
GNU `nano' is a small and friendly text editor. Besides basic text
editing, `nano' offers many extra features like an interactive search
and replace, goto line number, auto-indentation, feature toggles,
internationalization support, and filename tab completion.
* Menu:
* Overview::
* Command Line Options::

File: nano.info, Node: Overview, Next: Command Line Options, Prev: Introduction, Up: Introduction
Overview
========
`nano' [GNU long option] [option] +LINE [ FILE ... ]
The original goal for `nano' was a complete bug-for-bug compatible
emulation of Pico, but consistency is now a slightly higher priority.
There is a flag to implement (nearly) complete Pico emulation, (option
-p or GNU long option -pico). This can also be toggled from within
`nano' by typing Meta-P. *Note Pico Compatibility::, for more info.
Email bug reports to <nano@nano-editor.org>.

File: nano.info, Node: Command Line Options, Prev: Overview, Up: Introduction
Command Line Options
====================
`nano' takes the following options from the command line:
`-T [num, --tabsize=[num]'
Set the displayed tab length to [num] columns.
`-R, --regexp'
Turns on regular expression search and search/replace.
`-V, --version'
Print the version number and copyright and quit.
`-c, --const'
Constantly display the cursor position and line number on the
statusbar.
`-h, --help'
Print the usage and exit.
`-i, --autoindent'
Automatically indent new lines to the same number of spaces and
tabs as the previous line.
`-k, --cut'
Makes ^K cut from the current cursor position to the end of the
current line.
`-l, --nofollow'
When writing files, if the given file is a symbolic link it is
removed and a new file is created.
`-m, --mouse'
Enables the use of the mouse to select text (currently only useful
for running under the X window system).
`-p, --pico'
Emulate Pico as closely as possible, sacrificing consistency for
correct emulation. *Note Pico Compatibility::, for more info.
`-r [#cols], --fill=[#cols].'
Wrap lines at column #cols. By default this is the width of the
screen, less eight. If this value is negative, wrapping will occur
at #cols from the right of the screen, allowing it to vary along
with the screen width if the screen is resized.
`-s [prog], --speller=[prog]'
Invoke [prog] as the spell checker. By default, `nano' uses its
own interactive spell checker that requires the `spell' program be
installed on your system.
`-t, --tempfile'
Do not ask whether or not to save the current contents of the file
when exiting, assume yes. This is most useful when using `nano'
as the composer of a mailer program.
`-x, --nohelp'
In Expert Mode, the Shortcut Lists will not appear at the bottom
of the screen. This affects the location of the statusbar as
well, as in Expert Mode it is located at the very bottom of the
editor.
Note: When accessing the help system, Expert Mode is temporarily
disabled to display the help system navigation keys.
`-v, --view'
Do not allow the contents of the file to be altered. Note that
this flag should NOT be used in place of correct file permissions
to implement a read-only file.
`-w, --nowrap'
Do not wrap long lines at any length. This option overrides any
value for -r.
`-z, --suspend'
Enable suspend ability of `nano' using the system's suspend
keystroke (usually ^Z).
`+LINE'
Start at line number LINE instead of the default of line 1.

File: nano.info, Node: Editor Basics, Next: Online Help, Prev: Introduction, Up: Top
Editor Basics
*************
* Menu:
* Entering Text::
* Special Functions::
* The Titlebar::
* The Statusbar::
* Shortcut Lists::

File: nano.info, Node: Entering Text, Next: Special Functions, Prev: Editor Basics, Up: Editor Basics
Entering Text
=============
All key sequences in `nano' are entered using the keyboard. `nano'
is a "modeless" editor, all keys with the exception of Control and Meta
key sequences will enter text into the file being edited.

File: nano.info, Node: Special Functions, Next: The Titlebar, Prev: Entering Text, Up: Editor Basics
Special Functions
=================
Special functions use the Control key (displayed in the help and
shortcut lists as ^) or the Meta key (displayed as M).
* Control key sequences are entered by holding down the Control key
and pressing the desired letter.
* Meta key sequences can be entered in a number of possible ways:
Pressing the Escape key, then releasing it and pressing the
desired key, or holding down the Alt key while pressing the desired
key. This varies from keyboard to keyboard, and certain commercial
operating systems "swallow" the Alt key so that it never reaches
the application. If your operating system does this, you should
use the Escape key to generate Meta key sequences.

File: nano.info, Node: The Titlebar, Next: The Statusbar, Prev: Special Functions, Up: Editor Basics
The Titlebar
============
The titlebar is the line displayed at the top of the editor. There
are three sections: left, center and right. The section on the left
displays the version of `nano' being used. The center section displays
the current file name, or "New Buffer" if the file has not yet been
named. The section on the right will display "Modified" if the file
has been modified since it was last saved or opened.
Special modes: When nano is in "File browser" mode, the center
section will display the current directory instead of the filename.
*Note The File Browser::.

File: nano.info, Node: The Statusbar, Next: Shortcut Lists, Prev: The Titlebar, Up: Editor Basics
The Statusbar
=============
The statusbar is located three lines from the bottom of the screen
(or the bottom line in Expert Mode. *Note Expert Mode::, for more info.
The Statusbar shows important and informational messages. Any error
messages that occur from using the editor will appear on the statusbar.
Any questions that are asked of the user will be asked on the statusbar,
and any user input (search strings, file names, etc) will be input on
the statusbar.

File: nano.info, Node: Shortcut Lists, Prev: The Statusbar, Up: Editor Basics
Shortcut Lists
==============
The Shortcut Lists are the two lines at the bottom of the screen
which show some of the more commonly used functions in the editor. The
exact functions which are displayed depend on whether Pico
Compatibility Mode mode is enabled. *Note Pico Compatibility::, for
more info.

File: nano.info, Node: Online Help, Next: Feature Toggles, Prev: Editor Basics, Up: Top
Online Help
***********
The online help system in `nano' is available by pressing ^G. It is
fairly self explanatory, documenting the various parts of the editor
and available keystrokes. Navigation is via the ^Y (Page Up) and ^V
(Page Down) keys. ^X exits the help system.

File: nano.info, Node: Feature Toggles, Next: The File Browser, Prev: Online Help, Up: Top
Feature Toggles
***************
Toggles allow you to change certain aspects of the editor that would
normally be done via command line flags. They are invoked via certain
Meta key sequenced. *Note Special Functions::, for more info. The
following toggles are available:
`Constant Update Toggle (Meta-C)'
toggles the -c (-const) command line flag.
`Regular Expressions Toggle (Meta-E)'
toggles the -R (-regexp) command line flag.
`AutoIndent Toggle (Meta-I)'
toggles the -i (-autoindent) command line flag.
`Cut To End Toggle (Meta-K)'
toggles the -k (-cut) command line flag.
`Cut To End Toggle (Meta-M)'
toggles the -m (-mouse) command line flag.
`Pico Mode Toggle (Meta-P)'
toggles the -p (-pico) command line flag. *Note Pico
Compatibility::, for more info.
`AutoWrap Toggle (Meta-W)'
toggles the -w (-nowrap) command line flag.
`Expert/Nohelp Toggle (Meta-X)'
toggles the -x (-nohelp) command line flag.
`Suspend Toggle (Meta-Z)'
toggles the -z (-suspend) command line flag.

File: nano.info, Node: The File Browser, Next: Pico Compatibility, Prev: Feature Toggles, Up: Top
The File Browser
****************
When reading or writing files, pressing ^T will invoke the file
browser. Here, one can navigate directories in a graphical manner in
order to find the desired file.
Basic movement in the file browser is accomplished with he arrow keys
and page up/down. The behavior of the enter (or 's') key varies by what
is currently selected. If the currently selected object is a directory,
the file browser will enter and display the contents of the directory.
If the object is a file, this filename and path are copied to the
statusbar and the file browser is exited.

File: nano.info, Node: Pico Compatibility, Next: Building and Configure Options, Prev: The File Browser, Up: Top
Pico Compatibility
******************
Nano does not completely emulate Pico by default. The following
differences apply to the default mode and Pico Compatibility mode:
`Displayed Shortcuts'
By default, the following shortcuts are displayed in the Shortcut
Lists:
^G ^O ^\ ^Y ^K ^C
^X ^R ^W ^V ^U ^T
Related functions are listed above or below each other by default.
The Justify function is not listed, instead the "Replace"
function is displayed. Also, he "Read File" and "WriteOut"
functions are aligned for consistency.
In Pico Compatibility mode, the default Pico shortcuts are
displayed:
^G ^O ^R ^Y ^K ^C
^X ^J ^W ^V ^U ^T
`Previous String Text'
By default, previously entered string for a function (search
string, file name) will be placed on the statusbar, and is
editable. This is done so there is consistency across all
functions. For example: even if there is a previous replace
string, it can always be deleted if one wishes to perform an empty
string replace.
In Pico Compatibility Mode, the previously entered text in a
search or replace will appear in brackets, and is not editable.
It is not a simple matter to do an empty string replace when a
previous replace string exists, for example. When writing a file,
the previous filename will be displayed in the editable text
portion of the editor.
`Interactive Replace and Spell Checker'
It is worth noting that the `nano' replace function is interactive,
i.e. it does not stop after one search string is found and
automatically replace it. The `nano' implementation will stop at
each search string found and query whether to replace this
instance or not. The internal spell checker operates similarly.
Note that these is no way to force these functions to behave in
the Pico fashion.

File: nano.info, Node: Building and Configure Options, Prev: Pico Compatibility, Up: Top
Building and Configure Options
******************************
Building nano from source is fairly straightforward if you are
familiar with compiling programs with autoconf support:
tar xvfz nano-x.y.z.tar.gz (where x.y.z is the version of nano) cd
nano-x.y.z/ ./configure make make install
if you are looking to optimize nano for size, you may want to
consider the following command line options:
`--disable-tabcomp'
Disable the tab completion code when reading or writing files.
`--disable-justify'
Disable the justify (^J)/unjustify (^U) functions in the editor.
`--disable-speller'
Disables spell checker ability.
`--disable-help'
Disables the help function (^G). Disabling this option makes the
binary much smaller, but makes it difficult for new users to learn
more than very basic things about using the editor.
`--disable-browser'
Disables the mini file browser (^O) when reading or writing files.
`--enable-tiny'
This options disables all the above. It also disables some of the
larger internals of the editor, like the marker code (^^) and the
cut to line (-k) option which it depends on to work properly. It
also disables the function toggles and mouse support.
`--disable-wrapping'
Disables all word wrapping in the editor. This also eliminates the
-w command line flag, as nonwrapping is then the default behavior.
`--disable-mouse'
Disables all mouse functionality. This also disables the -m
commands line flag which enables the mouse functions.

Tag Table:
Node: Top200
Node: Introduction508
Node: Overview934
Node: Command Line Options1514
Ref: Expert Mode3406
Node: Editor Basics4249
Node: Entering Text4474
Node: Special Functions4814
Node: The Titlebar5669
Node: The Statusbar6367
Node: Shortcut Lists6948
Node: Online Help7341
Node: Feature Toggles7717
Node: The File Browser8860
Node: Pico Compatibility9569
Node: Building and Configure Options11611

End Tag Table

View File

@@ -8,8 +8,8 @@
@c Run `makeinfo' rather than `texinfo-format-buffer'.
@smallbook
@set EDITION 0.1
@set VERSION 1.1.1
@set UPDATED 12 Feb 2001
@set VERSION 1.1.2
@set UPDATED 3 Oct 2001
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 1.1.1
@subtitle version 1.1.2
@author Chris Allegretta
@page
@@ -108,12 +108,24 @@ Email bug reports to @email{nano@@nano-editor.org}.
@code{nano} takes the following options from the command line:
@table @code
@item -T [num, --tabsize=[num]
Set the displayed tab length to [num] columns.
@item -D, --dos
Write file in DOS format.
@item -F, --multibuffer
Enable multiple file buffers.
@item -M, --mac
Write file in Mac format.
@item -R, --regexp
Turns on regular expression search and search/replace.
@item -S, --smooth
Enables smooth scrolling.
@item -T [num], --tabsize=[num]
Set the displayed tab length to [num] columns.
@item -V, --version
Print the version number and copyright and quit.
@@ -139,6 +151,9 @@ and a new file is created.
Enables the use of the mouse to select text (currently only useful for
running under the X window system).
@item -o [dir], --operatingdir=[dir]
Set operating directory. Makes nano set up something similar to a chroot.
@item -p, --pico
Emulate Pico as closely as possible, sacrificing consistency for correct
emulation. @xref{Pico Compatibility}, for more info.
@@ -181,6 +196,9 @@ Do not wrap long lines at any length. This option overrides any value for
Enable suspend ability of @code{nano} using the system's suspend
keystroke (usually ^Z).
@item -a, -b, -e, -f, -g, -j
Ignored, for compatibility with Pico.
@item +LINE
Start at line number LINE instead of the default of line 1.
@end table
@@ -277,25 +295,43 @@ The following toggles are available:
@table @code
@item Case Sensitive Search Toggle (Meta-A)
toggles case sensistive searching functionality on/off.
@item Backwards Search Toggle (Meta-B)
toggles backwards searching fuctionality on/off.
@item Constant Update Toggle (Meta-C)
toggles the -c (--const) command line flag.
@item DOS Format Toggle (Meta-D)
toggles the -D (--dos) command line flag.
@item Regular Expressions Toggle (Meta-E)
toggles the -R (--regexp) command line flag.
@item Multiple Files Toggle (Meta-F)
toggles the -F (--multibuffer) command line flag.
@item AutoIndent Toggle (Meta-I)
toggles the -i (--autoindent) command line flag.
@item Cut To End Toggle (Meta-K)
toggles the -k (--cut) command line flag.
@item Cut To End Toggle (Meta-M)
@item Mouse Toggle (Meta-M)
toggles the -m (--mouse) command line flag.
@item Mac Format Toggle (Meta-O)
toggles the -M (--mac) command line flag.
@item Pico Mode Toggle (Meta-P)
toggles the -p (--pico) command line flag.
@xref{Pico Compatibility}, for more info.
@item Smooth Scrolling Toggle (Meta-S)
toggles the -s (--smooth) command line flag.
@item AutoWrap Toggle (Meta-W)
toggles the -w (--nowrap) command line flag.
@@ -305,6 +341,13 @@ toggles the -x (--nohelp) command line flag.
@item Suspend Toggle (Meta-Z)
toggles the -z (--suspend) command line flag.
@item Open Previous File Toggle (Meta-<)
changes buffer to previously loaded file.
@item Open Next File Toggle (Meta->)
changes buffer to next loaded file.
@end table
@node The File Browser, Pico Compatibility, Feature Toggles, Top
@@ -415,6 +458,18 @@ Disables all word wrapping in the editor. This also eliminates the
Disables all mouse functionality. This also disables the -m commands line
flag which enables the mouse functions.
@item --disable-operatingdir
Disables setting of operating directory. This also disables the -o command
line flag.
@item --disable-nls
Disables Native Language support. This will make the available GNU nano
translations unusable.
@item --with-slang
Compiling GNU nano with Slang is supported, and will make the binary notably
smaller than if compiled with ncurses or other curses libraries.
@end table
@contents

View File

@@ -17,12 +17,18 @@
# Don't follow symlinks when writing files
# set nofollow
# Set operating directory (chroot of sorts)
# set operatingdir "~"
# Use Pico Compatibility mode for the shortcut lists and search text
# set pico
# Use this value instead of the default
# set fill -8
# Use this tab size instead of the default
# set tabsize 8
# Use this spelling checker instead of the default one
# set speller aspell
@@ -41,6 +47,9 @@
# Allow nano to be suspended with ^Z
# set suspend
# Use smooth scrolling as the default
# set smooth
# Allow multiple file buffers (using ^R inserts into separate buffer)
# You must have configured with --enable-multibuffer or --enable-extra for
# this to work

747
po/ca.po

File diff suppressed because it is too large Load Diff

699
po/cs.po

File diff suppressed because it is too large Load Diff

1292
po/da.po Normal file

File diff suppressed because it is too large Load Diff

731
po/de.po

File diff suppressed because it is too large Load Diff

711
po/es.po

File diff suppressed because it is too large Load Diff

789
po/fi.po

File diff suppressed because it is too large Load Diff

698
po/fr.po

File diff suppressed because it is too large Load Diff

766
po/gl.po

File diff suppressed because it is too large Load Diff

693
po/hu.po

File diff suppressed because it is too large Load Diff

693
po/id.po

File diff suppressed because it is too large Load Diff

877
po/it.po

File diff suppressed because it is too large Load Diff

1293
po/nl.po Normal file

File diff suppressed because it is too large Load Diff

704
po/no.po

File diff suppressed because it is too large Load Diff

689
po/ru.po

File diff suppressed because it is too large Load Diff

824
po/sv.po

File diff suppressed because it is too large Load Diff

689
po/uk.po

File diff suppressed because it is too large Load Diff

25
proto.h
View File

@@ -44,6 +44,9 @@ extern char *answer;
extern char *hblank, *help_text;
extern char *last_search;
extern char *last_replace;
#ifndef DISABLE_OPERATINGDIR
extern char *operating_dir;
#endif
#ifndef DISABLE_SPELLER
extern char *alt_speller;
#endif
@@ -100,10 +103,20 @@ int do_insertfile(int loading_file);
int add_open_file(int update, int dup_fix);
#endif
#ifndef DISABLE_OPERATINGDIR
int check_operating_dir(char *currpath, int allow_tabcomp);
#endif
int do_writeout(char *path, int exiting, int append);
int do_gotoline(long line, int save_pos);
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
int wholewords, int *i);
int do_find_bracket(void);
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
void do_gotopos(long line, int pos_x, int pos_y, int pos_placewewant);
#endif
/* Now in move.c */
int do_up(void);
int do_down(void);
@@ -152,7 +165,7 @@ void new_file(void);
void new_magicline(void);
void splice_node(filestruct *begin, filestruct *newnode, filestruct *end);
void null_at(char *data, int index);
void page_up_center(void);
void page_up(void);
void blank_edit(void);
void search_init_globals(void);
void replace_abort(void);
@@ -182,7 +195,7 @@ int do_insertfile_void(void), do_search(void);
int load_open_file(void), close_open_file(void);
#endif
int page_up(void), page_down(void);
int do_page_up(void), do_page_down(void);
int do_cursorpos(void), do_spell(void);
int do_up(void), do_down (void), do_right(void), do_left (void);
int do_home(void), do_end(void), total_refresh(void), do_mark(void);
@@ -198,8 +211,8 @@ int open_prevfile(int closing_file), open_nextfile(int closing_file);
char *charalloc (size_t howmuch);
#ifdef ENABLE_MULTIBUFFER
char *get_full_path(const char *origpath);
#if defined (ENABLE_MULTIBUFFER) || !defined (ENABLE_OPERATINGDIR)
char *get_full_path(char *origpath);
#endif
#ifndef DISABLE_BROWSER
@@ -221,9 +234,9 @@ RETSIGTYPE main_loop (int junk);
filestruct *copy_node(filestruct * src);
filestruct *copy_filestruct(filestruct * src);
filestruct *make_new_node(filestruct * prevnode);
filestruct *findnextstr(int quiet, filestruct * begin,
filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin,
int beginx, char *needle);
#ifdef ENABLE_MULTIBUFFER
filestruct *open_file_dup_search(void);
filestruct *open_file_dup_search(int update);
#endif

View File

@@ -39,7 +39,7 @@
#define _(string) (string)
#endif
#define NUM_RCOPTS 15
#define NUM_RCOPTS 18
/* Static stuff for the nanorc file */
rcoption rcopts[NUM_RCOPTS] =
{
@@ -49,7 +49,9 @@ rcoption rcopts[NUM_RCOPTS] =
{"cut", CUT_TO_END},
{"nofollow", FOLLOW_SYMLINKS},
{"mouse", USE_MOUSE},
{"operatingdir", 0},
{"pico", PICO_MODE},
{"tabsize", 0},
#ifndef DISABLE_WRAPJUSTIFY
{"fill", 0},
@@ -61,7 +63,8 @@ rcoption rcopts[NUM_RCOPTS] =
{"nowrap", NO_WRAP},
{"nohelp", NO_HELP},
{"suspend", SUSPEND},
{"multibuffer", MULTIBUFFER}};
{"multibuffer", MULTIBUFFER},
{"smooth", SMOOTHSCROLL}};
/* We have an error in some part of the rcfile; put it on stderr and
make the user hit return to continue starting up nano */
@@ -166,6 +169,8 @@ void parse_rcfile(FILE *rcstream, char *filename)
#endif
if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) {
if (
!strcasecmp(rcopts[i].name, "operatingdir") ||
!strcasecmp(rcopts[i].name, "tabsize") ||
#ifndef DISABLE_WRAPJUSTIFY
!strcasecmp(rcopts[i].name, "fill") ||
#endif
@@ -189,13 +194,20 @@ void parse_rcfile(FILE *rcstream, char *filename)
if ((i = atoi(option)) < MIN_FILL_LENGTH) {
rcfile_msg(&errors,
_("Error in %s on line %d: requested fill size %d too small"),
filename, lineno, option);
filename, lineno, i);
}
else
fill = i;
#endif
}
else {
} else if (!strcasecmp(rcopts[i].name, "tabsize")) {
if ((i = atoi(option)) <= 0) {
rcfile_msg(&errors,
_("Error in %s on line %d: requested tab size %d too small"),
filename, lineno, i);
} else {
tabsize = i;
}
} else {
#ifndef DISABLE_SPELLER
alt_speller = charalloc(strlen(option) + 1);
strcpy(alt_speller, option);

204
search.c
View File

@@ -74,7 +74,6 @@ int search_init(int replacing)
{
int i = 0;
char *buf;
char *prompt;
static char *backupstring = NULL;
#ifndef NANO_SMALL
int j;
@@ -85,6 +84,15 @@ int search_init(int replacing)
buf = charalloc(strlen(last_search) + 5);
buf[0] = 0;
/* Clear the backupstring if we've changed from Pico mode to regular
mode */
if (ISSET(CLEAR_BACKUPSTRING)) {
free(backupstring);
backupstring = NULL;
UNSET(CLEAR_BACKUPSTRING);
}
/* Okay, fun time. backupstring is our holder for what is being
returned from the statusq call. Using answer for this would be tricky.
Here, if we're using PICO_MODE, we only want nano to put the
@@ -117,19 +125,24 @@ int search_init(int replacing)
else
strcpy(buf, "");
/* Instead of having a million if statements here to determine
the prompt, we instead just have a hundred "? :" calls in
the statusq call. I hope no one ever has to modify this :-) */
prompt = "%s%s%s%s%s%s";
/* This is now one simple call. It just does a lot */
i = statusq(0, replacing ? replace_list : whereis_list,
replacing ? REPLACE_LIST_LEN : WHEREIS_LIST_LEN, backupstring,
prompt,
ISSET(CASE_SENSITIVE) ? _("Case Sensitive ") : "",
ISSET(USE_REGEXP) ? _("Regexp ") : "",
"%s%s%s%s%s%s",
_("Search"),
ISSET(REVERSE_SEARCH) ? _(" Backwards") : "",
/* This string is just a modifier for the search prompt,
no grammar is implied */
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") : "",
/* This string is just a modifier for the search prompt,
no grammar is implied */
ISSET(USE_REGEXP) ? _(" [Regexp]") : "",
/* This string is just a modifier for the search prompt,
no grammar is implied */
ISSET(REVERSE_SEARCH) ? _(" [Backwards]") : "",
replacing ? _(" (to replace)") : "",
buf);
@@ -183,17 +196,6 @@ int search_init(int replacing)
case NANO_OTHERSEARCH_KEY:
backupstring = mallocstrcpy(backupstring, answer);
return -2; /* Call the opposite search function */
/*
} else if (i == NANO_REVERSESEARCH_KEY) {
free(backupstring);
backupstring = NULL;
backupstring = mallocstrcpy(backupstring, answer);
TOGGLE(REVERSE_SEARCH);
return 1;
} else if (i == NANO_FROMSEARCHTOGOTO_KEY) {
*/
case NANO_FROMSEARCHTOGOTO_KEY:
free(backupstring);
backupstring = NULL;
@@ -224,23 +226,27 @@ void not_found_msg(char *str)
}
}
filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
int past_editbuff; /* search is now looking through lines not displayed */
filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beginx,
char *needle)
{
filestruct *fileptr;
char *searchstr, *rev_start = NULL, *found = NULL;
int past_editbot = 0, current_x_find;
int current_x_find = 0;
fileptr = current;
past_editbuff = 0;
if (!ISSET(REVERSE_SEARCH)) { /* forward search */
current_x_find = current_x + 1;
/* Are we now back to the line where the search started) */
if ((fileptr == begin) && (current_x_find < beginx))
#if 0
/* Are we now back to the place where the search started) */
if ((fileptr == begin) && (beginx > current_x_find))
search_last_line = 1;
#endif
/* Make sure we haven't passed the end of the string */
if (strlen(fileptr->data) < current_x_find)
current_x_find--;
@@ -259,15 +265,19 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
fileptr = fileptr->next;
if (!past_editbot && (fileptr == editbot))
past_editbot = 1;
if (fileptr == editbot)
past_editbuff = 1;
/* EOF reached ?, wrap around once */
if (fileptr == NULL) {
if (bracket_mode) /* don't wrap if looking for bracket match */
return NULL;
fileptr = fileage;
past_editbot = 1;
if (!quiet)
statusbar(_("Search Wrapped"));
past_editbuff = 1;
if (!quiet) {
statusbar(_("Search Wrapped"));
SET(DISABLE_CURPOS);
}
}
/* Original start line reached */
@@ -279,19 +289,21 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
/* We found an instance */
current_x_find = found - fileptr->data;
#if 0
/* Ensure we haven't wrapped around again! */
if ((search_last_line) && (current_x_find >= beginx)) {
if (!quiet)
not_found_msg(needle);
return NULL;
}
} else { /* reverse search */
#endif
}
#ifndef NANO_SMALL
else { /* reverse search */
current_x_find = current_x - 1;
/* Are we now back to the line where the search started) */
/* Are we now back to the place where the search started) */
if ((fileptr == begin) && (current_x_find > beginx))
search_last_line = 1;
@@ -315,15 +327,19 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
fileptr = fileptr->prev;
/* ? */ if (!past_editbot && (fileptr == edittop->prev))
past_editbot = 1;
if (fileptr == edittop->prev)
past_editbuff = 1;
/* SOF reached ?, wrap around once */
/* ? */ if (fileptr == NULL) {
if (bracket_mode)
return NULL;
fileptr = filebot;
past_editbot = 1;
if (!quiet)
past_editbuff = 1;
if (!quiet) {
statusbar(_("Search Wrapped"));
SET(DISABLE_CURPOS);
}
}
/* Original start line reached */
@@ -336,26 +352,30 @@ filestruct *findnextstr(int quiet, filestruct * begin, int beginx,
/* We found an instance */
current_x_find = found - fileptr->data;
#if 0
/* Ensure we haven't wrapped around again! */
if ((search_last_line) && (current_x_find < beginx)) {
if (!quiet)
not_found_msg(needle);
return NULL;
}
#endif
}
#endif /* NANO_SMALL */
/* Set globals now that we are sure we found something */
current = fileptr;
current_x = current_x_find;
if (past_editbot)
edit_update(fileptr, CENTER);
else
update_line(current, current_x);
if (!bracket_mode) {
if (past_editbuff)
edit_update(fileptr, CENTER);
else
update_line(current, current_x);
placewewant = xplustabs();
reset_cursor();
placewewant = xplustabs();
reset_cursor();
}
return fileptr;
}
@@ -415,7 +435,7 @@ int do_search(void)
last_search = mallocstrcpy(last_search, answer);
search_last_line = 0;
findnextstr(0, current, current_x, answer);
findnextstr(FALSE, FALSE, current, current_x, answer);
search_abort();
return 1;
}
@@ -584,7 +604,7 @@ int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
while (1) {
/* Sweet optimization by Rocco here */
fileptr = findnextstr(replaceall, begin, *beginx, prevanswer);
fileptr = findnextstr(replaceall, FALSE, begin, *beginx, prevanswer);
/* No more matches. Done! */
if (!fileptr)
@@ -793,3 +813,89 @@ int do_gotoline_void(void)
{
return do_gotoline(0, 0);
}
#if (defined ENABLE_MULTIBUFFER || !defined DISABLE_SPELLER)
void do_gotopos(long line, int pos_x, int pos_y, int pos_placewewant)
{
/* since do_gotoline() resets the x-coordinate but not the
y-coordinate, set the coordinates up this way */
current_y = pos_y;
do_gotoline(line, 1);
current_x = pos_x;
placewewant = pos_placewewant;
update_line(current, pos_x);
}
#endif
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
int do_find_bracket(void)
{
char ch_under_cursor, wanted_ch;
char *pos, *brackets = "([{<>}])";
char regexp_pat[] = "[ ]";
int offset, have_past_editbuff = 0, flagsave, current_x_save, count = 1;
filestruct *current_save;
ch_under_cursor = current->data[current_x];
if ((!(pos = strchr(brackets, ch_under_cursor))) || (!((offset = pos - brackets) < 8))) {
statusbar(_("Not a bracket"));
return 1;
}
blank_statusbar_refresh();
wanted_ch = *(brackets + ((strlen(brackets) - (offset + 1))));
current_x_save = current_x;
current_save = current;
flagsave = flags;
SET(USE_REGEXP);
/* apparent near redundancy with regexp_pat[] here is needed, [][] works, [[]] doesn't */
if (offset < (strlen(brackets) / 2)) { /* on a left bracket */
regexp_pat[1] = wanted_ch;
regexp_pat[2] = ch_under_cursor;
UNSET(REVERSE_SEARCH);
} else { /* on a right bracket */
regexp_pat[1] = ch_under_cursor;
regexp_pat[2] = wanted_ch;
SET(REVERSE_SEARCH);
}
regexp_init(regexp_pat);
while (1) {
search_last_line = 0;
if (findnextstr(1, 1, current, current_x, regexp_pat)) {
have_past_editbuff |= past_editbuff;
if (current->data[current_x] == ch_under_cursor) /* found identical bracket */
count++;
else { /* found complementary bracket */
if (!(--count)) {
if (have_past_editbuff)
edit_update(current, CENTER);
else
update_line(current, current_x);
placewewant = xplustabs();
reset_cursor();
break ;
}
}
} else { /* didn't find either left or right bracket */
statusbar(_("No matching bracket"));
current_x = current_x_save;
current = current_save;
break;
}
}
if (ISSET(REGEXP_COMPILED))
regexp_cleanup();
flags = flagsave;
return 0;
}
#endif

View File

@@ -74,7 +74,6 @@ char *revstrcasestr(char *haystack, char *needle, char *rev_start)
}
return 0;
}
#endif /* NANO_SMALL */
/* This is now mutt's version (called mutt_stristr) because it doesn't
use memory allocation to do a simple search (yuck). */
@@ -96,6 +95,7 @@ char *strcasestr(char *haystack, char *needle)
}
return NULL;
}
#endif /* NANO_SMALL */
char *strstrwrapper(char *haystack, char *needle, char *rev_start)
{
@@ -130,22 +130,22 @@ char *strstrwrapper(char *haystack, char *needle, char *rev_start)
return 0;
}
#endif
if (ISSET(CASE_SENSITIVE)) {
#ifndef NANO_SMALL
if (ISSET(CASE_SENSITIVE)) {
if (ISSET(REVERSE_SEARCH))
return revstrstr(haystack, needle, rev_start);
else
#endif
return strstr(haystack,needle);
} else {
#ifndef NANO_SMALL
if (ISSET(REVERSE_SEARCH))
return revstrcasestr(haystack, needle, rev_start);
else
#endif
return strcasestr(haystack, needle);
#ifndef NANO_SMALL
}
#endif
}
/* Thanks BG, many ppl have been asking for this... */

60
winio.c
View File

@@ -330,12 +330,10 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
case NANO_HOME_KEY:
case KEY_HOME:
x = x_left;
nanoget_repaint(buf, inputbuf, x);
break;
case NANO_END_KEY:
case KEY_END:
x = x_left + strlen(inputbuf);
nanoget_repaint(buf, inputbuf, x);
break;
case KEY_RIGHT:
case NANO_FORWARD_KEY:
@@ -351,16 +349,13 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
strlen(inputbuf) - (x - x_left) - 1);
inputbuf[strlen(inputbuf) - 1] = 0;
}
nanoget_repaint(buf, inputbuf, x);
break;
case NANO_CONTROL_K:
case NANO_CONTROL_U:
*inputbuf = 0;
x = x_left;
nanoget_repaint(buf, inputbuf, x);
break;
case KEY_BACKSPACE:
case KEY_DC:
case 127:
case NANO_CONTROL_H:
if (strlen(inputbuf) > 0) {
@@ -375,7 +370,6 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
}
if (x > strlen(buf))
x--;
nanoget_repaint(buf, inputbuf, x);
break;
#ifndef DISABLE_TABCOMP
case NANO_CONTROL_I:
@@ -386,7 +380,6 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
x += shift;
if (x - x_left > strlen(inputbuf))
x = strlen(inputbuf) + x_left;
nanoget_repaint(buf, inputbuf, x);
}
break;
#endif
@@ -400,21 +393,22 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
case KEY_DOWN:
break;
case KEY_DC:
goto do_deletekey;
case 27:
switch (kbinput = wgetch(edit)) {
case 79:
case 'O':
switch (kbinput = wgetch(edit)) {
case 70:
case 'F':
x = x_left + strlen(inputbuf);
nanoget_repaint(buf, inputbuf, x);
break;
case 72:
case 'H':
x = x_left;
nanoget_repaint(buf, inputbuf, x);
break;
}
break;
case 91:
case '[':
switch (kbinput = wgetch(edit)) {
case 'C':
if (x < xend)
@@ -426,11 +420,12 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
x--;
wmove(bottomwin, 0, x);
break;
case 49:
case '1':
case '7':
x = x_left;
nanoget_repaint(buf, inputbuf, x);
goto skip_126;
case 51:
goto skip_tilde;
case '3':
do_deletekey:
if (strlen(inputbuf) > 0
&& (x - x_left) != strlen(inputbuf)) {
memmove(inputbuf + (x - x_left),
@@ -438,16 +433,15 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
strlen(inputbuf) - (x - x_left) - 1);
inputbuf[strlen(inputbuf) - 1] = 0;
}
nanoget_repaint(buf, inputbuf, x);
goto skip_126;
case 52:
goto skip_tilde;
case '4':
case '8':
x = x_left + strlen(inputbuf);
nanoget_repaint(buf, inputbuf, x);
goto skip_126;
skip_126:
goto skip_tilde;
skip_tilde:
nodelay(edit, TRUE);
kbinput = wgetch(edit);
if (kbinput == 126 || kbinput == ERR)
if (kbinput == '~' || kbinput == ERR)
kbinput = -1;
nodelay(edit, FALSE);
break;
@@ -470,7 +464,6 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
}
}
nanoget_repaint(buf, inputbuf, x);
break;
default:
@@ -488,21 +481,19 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
x++;
nanoget_repaint(buf, inputbuf, x);
#ifdef DEBUG
fprintf(stderr, _("input \'%c\' (%d)\n"), kbinput, kbinput);
#endif
}
nanoget_repaint(buf, inputbuf, x);
wrefresh(bottomwin);
}
answer = mallocstrcpy(answer, inputbuf);
free(inputbuf);
/* Now that the text is editable instead of bracketed, we have to
check for answer == def, instead of answer == "" */
if (((ISSET(PICO_MODE)) && !strcmp(answer, "")) ||
((!ISSET(PICO_MODE)) && !strcmp(answer, def)))
/* In pico mode, just check for a blank answer here */
if (((ISSET(PICO_MODE)) && !strcmp(answer, "")))
return -2;
else
return 0;
@@ -602,7 +593,11 @@ void bottombars(shortcut s[], int slen)
#endif
/* Determine how many extra spaces are needed to fill the bottom of the screen */
k = COLS / 6 - 13;
if (slen < 2)
k = COLS / 6 - 13;
else
k = COLS / ((slen + (slen %2)) / 2) - 13;
clear_bottomwin();
wmove(bottomwin, 1, 0);
@@ -1655,7 +1650,7 @@ void do_replace_highlight(int highlight_flag, char *word)
}
#ifdef NANO_EXTRA
#define CREDIT_LEN 47
#define CREDIT_LEN 48
void do_credits(void)
{
int i, j = 0, k, place = 0, start_x;
@@ -1694,6 +1689,7 @@ void do_credits(void)
"Joshua Jensen",
"Ryan Krebs",
"Albert Chin",
"David Lawrence Ramsey",
"",
specialthx,
"Plattsburgh State University",