Compare commits

...

64 Commits

Author SHA1 Message Date
Chris Allegretta
9faa3f13e2 Nano 0.9.99pre1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@487 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-18 04:37:09 +00:00
Chris Allegretta
3c10ec016c Added bug #51
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@486 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-17 19:27:55 +00:00
Robert Siemborski
c2eeb4e585 small fix for do_justify totsize calculations
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@485 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-17 03:29:02 +00:00
Chris Allegretta
4058709e0b input_tab(): Added memset() to matchBuf to ensure sanity (Rocco, Adam).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@484 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-16 04:45:38 +00:00
Chris Allegretta
51dd32fb4e Changed null out at end of matchBuf from NULL to 0
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@483 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-16 04:20:08 +00:00
Chris Allegretta
ae4318dab0 Get rid of unneeded call to usage() in main() when calling a flag for a function that hasn't been compiled in (Rocco)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@482 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-16 04:18:26 +00:00
Chris Allegretta
3693944492 main(): Initialized kbinput to get around stupid compiler warning.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@481 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-15 20:26:38 +00:00
Chris Allegretta
4097379a26 Changed 'without NumLock on' to 'with NumLock off', more easy to understand?
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@480 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-15 20:25:24 +00:00
Chris Allegretta
b4c43683a5 input_tab(): - Added null end of matchBuf for sanity (Rocco).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@479 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-15 17:22:27 +00:00
Chris Allegretta
a35ec048d7 files.c:cwd_tab_completion(), input_tab(): Changed bare malloc/calloc calls to nmalloc (found by Rocco).
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@478 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-15 02:26:12 +00:00
Chris Allegretta
2be96d00b9 Oops, forgot to credit Rocco in one place
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@477 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-14 05:22:43 +00:00
Chris Allegretta
e61e830010 Rocco's source code cleanups and #defines for magic values in global_init(). Added die_too_small() function
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@476 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-14 05:18:27 +00:00
Chris Allegretta
201d9bf467 Added print_numlock_warning(), code to figure out when numlock makes the keypad go bad.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@475 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-14 03:17:53 +00:00
Chris Allegretta
1748cd1d0f Added function ABCD(), better support for default settings
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@474 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-13 17:22:54 +00:00
Chris Allegretta
d9742c69c0 fi.po updates by Pauli Virtanen
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@473 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-12 15:51:53 +00:00
Rocco Corsi
af5c302b48 Move #ifndef cleanups. Some HELP and SPELLER #ifndef additions.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@472 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-12 07:51:05 +00:00
Chris Allegretta
4ee0b41b41 Moved ChangeLog entries for configure.in to configure.in section
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@471 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-11 15:11:00 +00:00
Chris Allegretta
cd6f12d53e Moved code to define all disabled when --tiny is used from nano.h to configure.in
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@470 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-11 15:08:06 +00:00
Rocco Corsi
06aca1cc9e Rolled back DISABLE_TABCOMP and NANO_SMALL changes from earlier today
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@469 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-11 05:30:31 +00:00
Chris Allegretta
a4d6d1df37 Add check for tiny option in #ifdefs for DISABLE_TABCOMP code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@468 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-10 23:44:10 +00:00
Chris Allegretta
7db63a5b65 Change Linux to GNU/Linux in the faq
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@467 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-10 22:05:40 +00:00
Chris Allegretta
2c4feca17f faq.html: Added section 3.6, reducing binary size
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@466 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-09 17:40:56 +00:00
Chris Allegretta
bbebec6871 configure.in: - Fix for _use_keypad check breaking slang support (Christian Weisgerber)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@465 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-09 00:37:32 +00:00
Chris Allegretta
8eac3b5069 do_browser() - added space and - keys for page down and up
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@464 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-08 21:14:04 +00:00
Chris Allegretta
bf69261597 real_dir_from_tilde(): ops, fix case where buf =~, silly crash
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@463 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-08 16:59:19 +00:00
Chris Allegretta
7e08082ffe Back to CVS ver
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@462 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-08 02:31:03 +00:00
Chris Allegretta
4ca160f784 0.9.25 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@460 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-08 02:29:20 +00:00
Chris Allegretta
155d620a14 Add and fix Bug #51 :-)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@459 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-08 01:50:37 +00:00
Chris Allegretta
2a2e2be0c4 Added and fixed bug #50
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@458 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-08 01:32:58 +00:00
Chris Allegretta
7044489c76 do_help: Do the bottom window the right wrong way if NO_HELP is set
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@457 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-07 23:02:02 +00:00
Chris Allegretta
1699144136 Update docs for upcoming 0.9.25 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@456 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-07 22:06:11 +00:00
Chris Allegretta
19b9e2be94 Oops, restore keypad() call when using PDCURSES
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@455 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-07 07:31:12 +00:00
Chris Allegretta
3f583165c4 Oops, take out my debugging code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@454 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-07 05:51:28 +00:00
Chris Allegretta
e1ebaf3821 do_writeout() takes an arg now, and mallocstrcpy now gives up if src == dest
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@453 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-07 05:50:36 +00:00
Chris Allegretta
c08f50d9de Back to the drawing board, old keypad code, dont slightly better
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@452 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-06 18:12:43 +00:00
Chris Allegretta
816a165b4b Fixes for dir crash by rocco and exit called on insert file
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@451 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-06 17:43:56 +00:00
Chris Allegretta
150469a646 Added do_browse_from(), called from do_writeout and do_insert, changed mallocstrcpy to *char
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@450 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-05 21:13:14 +00:00
Chris Allegretta
544347c08a Oops, stop freeing stuff we can't necessarily free
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@449 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-05 14:31:52 +00:00
Chris Allegretta
6636dc3181 Changed ENABLE_BROWSER to DISABLE_BROWSER, tiny build now doesn't build browser either
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@448 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-05 05:41:07 +00:00
Chris Allegretta
90661b2def Updated README with snazzy one line desc of nano
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@447 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 23:25:18 +00:00
Chris Allegretta
123e5e66d3 Don't free realname when exiting do_browser in insert_file
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@446 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 22:05:47 +00:00
Chris Allegretta
f4f7e04c5b Work around gnome-terminal, I'm tired of this
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@445 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 16:56:15 +00:00
Jordi Mallach
75ef81bc42 Browser Spanish translations
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@444 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 16:48:59 +00:00
Chris Allegretta
ba8edea860 Accept s and S silently to selected a file/dir
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@443 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 05:22:46 +00:00
Chris Allegretta
b0f5282de2 Fix segfault when width == 0
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@442 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 05:20:23 +00:00
Chris Allegretta
fe41584102 Make functions return themselves when do_browser() aborts
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@441 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 05:08:37 +00:00
Chris Allegretta
0e9d3c6c28 Commented file browser code
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@440 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 04:59:17 +00:00
Chris Allegretta
6e82741931 Added fkey equivs to browser
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@439 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 04:41:08 +00:00
Chris Allegretta
f0999a18f0 use lstat instead of stat in filestat, so we can check for if the file is a symlink in the browser
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@438 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 02:49:56 +00:00
Chris Allegretta
63c8ab94fb Tadaa. Keypad issue fixed. It was the stupid timeout(0) call. UGH
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@437 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-04 02:33:52 +00:00
Chris Allegretta
85b444137b Added --enable-browser to version()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@436 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-03 20:13:28 +00:00
Chris Allegretta
425a266a92 Some better page up/down fixes, added keypad_on() call for now
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@435 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-03 15:09:27 +00:00
Chris Allegretta
f4b9601c1b First try at browser
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@434 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-03 07:11:47 +00:00
Chris Allegretta
827b15fdc0 credits spelling fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@433 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-03 02:09:04 +00:00
Rocco Corsi
8b6cccc5cc TAB-TAB completion segfaulting with more than 2048 files fixed. (Rocco)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@432 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2001-01-02 06:21:07 +00:00
Chris Allegretta
ee289d7a2b Don't skip . and .. in cwd_tab_completion()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@431 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-27 16:12:47 +00:00
Chris Allegretta
1e6fb08d15 Finally got rid of TIP from README and updated the Overview which people always quote from
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@430 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-27 15:46:22 +00:00
Chris Allegretta
66795ecbe1 do_cursorpos cleanups
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@429 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-27 04:47:28 +00:00
Chris Allegretta
d55655f23a Reordered --help usage listing by alpha
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@428 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-27 03:36:47 +00:00
Jordi Mallach
e34f96dec2 Add request for backup saves.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@427 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-20 01:06:39 +00:00
Jordi Mallach
5b89a14514 Added configure and Makefile.in. Yell at me :)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@426 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-19 23:01:24 +00:00
Jordi Mallach
56e6d72282 Corrected some typos and small errors in the faq.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@425 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-19 22:59:55 +00:00
Jordi Mallach
79ea7dd883 Corrected some typos and small errors.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@424 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-19 22:58:00 +00:00
Chris Allegretta
e47e4edf7f Back to CVS version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@423 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2000-12-19 03:01:00 +00:00
25 changed files with 2633 additions and 1631 deletions

View File

@@ -1,8 +1,10 @@
Makefile
Makefile.in
confdefs.h
config.cache
config.h
config.log
config.status
configure
nano
stamp-h

11
BUGS
View File

@@ -78,6 +78,13 @@
favor of the last stored search (47) [FIXED]
- If nano fails to open a file when it starts up,doing almost anything
causes a segfault (discovered by Ben Roberts) (48). [FIXED]
- In certain terminals, nano would not work properly with keypad().
Turned out to be the silly timeout(0) call which is completely
unneeded anyway. (49) [FIXED]
- With less than a page of text, doing a page down will move the
current line to the top of the screen, which it shouldn't do. (50)
[FIXED]
- with PDCURSES, running meta-X turns off the keypad. (51) [FIXED]
** Open BUGS **
@@ -85,5 +92,9 @@
such as when all of a line is selected but the mark doesn't proceed to
the new line. (8) { Is this an issue? compare to pico 3.5 }
- totsize problems still abound in do_justify (33).
- Resizing the window completely screws up the display if in any other
mode than normal editing (help screen, search and replace, file
browser..) (52)
$Id$

124
ChangeLog
View File

@@ -1,3 +1,127 @@
nano 0.9.99-pre1 - 01/17/2001
General
- Changed #ifdefs to check for both DISABLE_TABCOMP and
NANO_SMALL, makes tiny option leave out tab completion, which
should be left out in that circumstance. Saves at least 5k.
- Previous change to #ifdefs DISABLE_TABCOMP and NANO_SMALL rolled
back. (Rocco)
- Various #ifdef & #ifndef cleanups. (Rocco)
- Added message for when keypad goes awry. Added code in main and
function print_numlock_warning() to notify user, and added an
apropriate section in the faq to refer to this brokenness.
- Added macros in nano.h for magic values that might be unclear in
nano.c:global_init(). (Rocco)
- configure.in:
- Fix for _use_keypad check breaking slang support (Christian
Weisgerber).
- Changed to automatically define the 5 DISABLE varibles when
NANO_SMALL (enable-tiny) is requested at configure.
- faq.html:
- Added some info on making the binary smaller with the configure
script.
- Added section on keypad bugginess.
- files.c:
real_dir_from_tilde()
- Oops, fix case where buf ="~", silly crash (bug discovered by
Neil Parks).
do_browser()
- Added space and - keys to do page up and down.
cwd_tab_completion(), input_tab()
- Changed bare malloc/calloc calls to nmalloc (found by Rocco).
- Added memset() to matchBuf to ensure sanity (Rocco, Adam).
- nano.c:
ABCD()
- New function, figures out what kbinput to return given
input common to several switch statements, allows us to
support the default Konsole key settings.
main()
- Alternate speller option no longer valid if DISABLE_SPELLER is
active. (Rocco)
- Removed direct calls to usage() (#else) for -k (cut) or -s (speller)
options when these have been disabled. (Rocco)
- Initialized kbinput to get around stupid compiler warning.
nano_small_msg()
- This function has been removed. All references now call
nano_disabled_msg. (Rocco)
version()
- When NANO_SMALL (enable-tiny) is defined, the 5 main DISABLE
variables (SPELLER, HELP, JUSTIFY, BROWSER, TABCOMP) are not
reported as enabled when Nano is called with -V (--version)
command-line option. (Rocco)
usage()
- Alternate speller option no longer valid if DISABLE_SPELLER is
active. (Rocco)
window_init(), handle_sigwinch()
- Added check for not having enough LINES to do anything useful,
if so die with an error. (Rocco)
die_too_small()
- Function to print the window too small error message, avoids
repeated string defs and globals.
do_justify()
- Small fix for totsize calculation (Rob)
- fi.po:
- Update by Pauli Virtanen.
nano 0.9.25 - 01/07/2001
General -
- New file browser code. New functions in files.c:do_browser(),
helper functions browser_init(), tail(), striponedir(),
filestat(). New shortcut list browser_list. Some new
strings to translate. Added function do_browse_from().
- Keypad code has been changed slightly. Now checks for
_use_keypad flag in window to see whether or not to turn
the keypad() back off when finished (taken from aumix). Moved
to winio.c where it should probably be anyway. New confgure
check for _use_keypad in window sstruct. This will have to do
for now.
- Moved keypad() calls for PDCURSES from main() to window_init()
so the keypad continues to work after a Meta-X, for example.
Fixed bug #51.
- faq.html:
- Fix typos and small mistakes (Jordi).
- files.c:
username_tab_completion()
- Added the (char *) sizeof when allocating memory for the filename
array (Rocco).
cwd_tab_completion()
- removed skipping . and .. when tabulating matches.
- Added the (char *) sizeof when allocating memory for the filename
array (Rocco).
do_writeout()
- Now takes an argument so the string typed in can be retained
when calling the browser.
do_browser()
- Don't decrement longest by the length of path. Fixes crashes
on entering various dirs (Rocco).
- Don't ungetch() the exit key, unneeded, fixes inerting a file
causes exit code.
- move.c:
page_down()
- Don't do an edit_update when there is only one page of text
(fileage == edittop && filebot == editbot). Fixes Bug #50.
- nano.c:
main()
- Reorder the getopt options to be more or less alphabetical
(suggested by Sven Guckes).
- winio.c:
do_cursorpos()
- Optimizations and cleanups by Rocco Corsi.
do_credits()
- Spell Erik Andersen's name right.
titlebar()
- Now takes an arg, needed for browser function.
do_help()
- Changed way of temporarily bringing up shortcuts at the
bottom in the help screen (actually works).
- utils.c:
mallocstrcpy()
- Takes char pointers now instead of void (makes debugging a
helluva lot easier)
- Duh, don't do anything if src == dest!
- es.po:
- Updates for file browser (Jordi).
nano 0.9.24 - 12/18/2000
General
- Added --disable-help option, affects acconfig.h, configure(.in),

19
NEWS
View File

@@ -1,3 +1,22 @@
01/17/2001 - Nano 0.9.99-pre1 is released. This is the first pre-1.0
release of nano, and is also the first release since the
code freeze for nano 1.0. Don't expect (or request) any
new features between now and nano 1.0, only bugfixes,
optimizations and doc/translation updates. For fixes, a
nasty segfault when trying to insert one's home directory
(~), some checks for the NumLock key making the keypad
go awry, window size sanity checks, many autoconf fixes,
and support for the KDE konsole keypad layout. Have fun.
01/07/2001 - Nano 0.9.25 is the "Just one more feature I swear!" release.
It includes one new feature that Pico has had forever, a
built-in file browser. Since not everyone may want this
option, there is a --disable-browser option to the
configure script as well. Other changes include slightly
different keypad handling, and a bugfix for crashes when
tab completion in certain instances. Have fun and Happy
New Year!
12/18/2000 - Nano 0.9.24 is released. This versions contains the last of
the security fixes for writing files, as well as for a
nasty segfault when nano is unable to open a file for

32
README
View File

@@ -1,26 +1,18 @@
The nano editor (Nano's ANOther editor) by Chris Allegretta
nano - a GPLed, enhanced clone of the Pico text editor.
Manifesto
Overview
The nano project was started because of a few "problems" with the
wonderfully easy-to-use and friendly Pico text editor.
First and foremost is its license: the Pine suite does not use the
GPL or a GPL-friendly license, and has unclear restrictions on
redistribution. Because of this, Pine and Pico are not included with
many GNU/Linux distributions. Also, other features (like goto line
number or search and replace) were unavailable until recently or
require a command-line flag. Yuck.
Nano is the editor formerly known as TIP (TIP Isn't Pico).
The nano project was started because of three main problems with the
wonderfully easy-to-use and friendly Pico text editor:
- It's license is not the GNU GPL, and hence some Linux
distributions, including Debian (my favorite) don't always
include it/don't include binaries. This is not necessarily a
problem, but an issue nonetheless.
- Until recently, it had no ability to go to a line # from within
the editor. There was the +number command line option, but who wants
to exit a file to go to a specific line number? When I want to go to
a line, since I have to exit anyway, I just call up vi temporarily.
- No search and replace feature. Well, apparently there is a flag
that lets you do a search and replace (-b in newer versions) but,
well, I still dont like it.
nano aims to solve these problems by emulating the functionality of
Pico as closely as possible while adressing the problems above and
perhaps providing other extra functionality.

3
TODO
View File

@@ -20,8 +20,9 @@ Current Version:
For Next Version:
- Undo/Redo key?
- single line scroll up/down?
- Single line scroll up/down?
- Color syntax highlighting? (certainly seems like there's a demand for it.)
- .nanorc ?????
- Backup making (filename~)?
$Id$

View File

@@ -3,6 +3,9 @@
/* Define this if you have the wresize function in your ncurses-type library */
#undef HAVE_WRESIZE
/* Define this if your curses lib has the _use_keypad flag */
#undef HAVE_USEKEYPAD
/* Define this if you have NLS */
#undef ENABLE_NLS
@@ -39,3 +42,5 @@
/* Define this to disable the ^G help menu */
#undef DISABLE_HELP
/* Define this to disable the built-in (crappy) file browser */
#undef DISABLE_BROWSER

View File

@@ -55,6 +55,9 @@
/* Define this if you have the wresize function in your ncurses-type library */
#undef HAVE_WRESIZE
/* Define this if your curses lib has the _use_keypad flag */
#undef HAVE_USEKEYPAD
/* Define this if you have NLS */
#undef ENABLE_NLS
@@ -91,6 +94,9 @@
/* Define this to disable the ^G help menu */
#undef DISABLE_HELP
/* Define this to disable the built-in (crappy) file browser */
#undef DISABLE_BROWSER
/* Define if you have the __argz_count function. */
#undef HAVE___ARGZ_COUNT

435
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
# $Id$
dnl Process this file with autoconf to produce a configure script.
AC_INIT(nano.c)
AM_INIT_AUTOMAKE(nano, 0.9.24)
AM_INIT_AUTOMAKE(nano, 0.9.99pre1)
AM_CONFIG_HEADER(config.h:config.h.in)
ALL_LINGUAS="es de fr it id fi"
@@ -19,6 +19,11 @@ AC_ARG_ENABLE(tiny,
(currently disables detailed help and i18n)],
[if test x$enableval = xyes; then
AC_DEFINE(NANO_SMALL) tiny_support=yes
AC_DEFINE(DISABLE_TABCOMP)
AC_DEFINE(DISABLE_SPELLER)
AC_DEFINE(DISABLE_HELP)
AC_DEFINE(DISABLE_JUSTIFY)
AC_DEFINE(DISABLE_BROWSER)
fi])
AC_ARG_ENABLE(extra,
@@ -51,6 +56,12 @@ AC_ARG_ENABLE(help,
AC_DEFINE(DISABLE_HELP)
fi])
AC_ARG_ENABLE(browser,
[ --disable-browser Disables mini file browser],
[if test x$enableval != xyes; then
AC_DEFINE(DISABLE_BROWSER)
fi])
AC_MSG_CHECKING(whether to use slang)
CURSES_LIB_NAME=""
AC_ARG_WITH(slang,
@@ -200,7 +211,23 @@ else
fi
AC_CHECK_LIB($CURSES_LIB_NAME, wresize, AC_DEFINE(HAVE_WRESIZE))
if test x$slang_support != xyes; then
AC_CHECK_LIB($CURSES_LIB_NAME, wresize, AC_DEFINE(HAVE_WRESIZE))
# Taken from aumix (can't tell form the variable name?)
AC_CACHE_CHECK(for private member _use_keypad in WINDOW,
aumix_cv_struct_window_usekeypad,
[AC_TRY_COMPILE([#ifdef HAVE_NCURSES_H
#include <ncurses.h>
#else
#include <curses.h>
#endif], [WINDOW w; w._use_keypad;],
aumix_cv_struct_window_usekeypad=yes, aumix_cv_struct_window_usekeypad=no)])
if test $aumix_cv_struct_window_usekeypad = yes; then
AC_DEFINE(HAVE_USEKEYPAD)
fi
fi
dnl Parse any configure options

View File

@@ -1,5 +1,6 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<title>The nano editor FAQ</title>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.16 i586) [Netscape]">
@@ -48,7 +49,9 @@ THE HECK DO I DO NOW?</a></font>
<br><font color="#330000"><a href="#3.4">3.4. I get errors about 'bindtextdomain',
'gettext' and/or 'gettextdomain'.&nbsp; What can I do about it?</a></font>
<br><font color="#330000"><a href="#3.5">3.5. Nano should automatically
run strip on the binary when installing it!</a></font></blockquote>
run strip on the binary when installing it!</a></font>
<br><font color="#330000"><a href="#3.6">3.6. How can I make the
executable smaller? This is too bloated!</a></font></blockquote>
<h2>
<font color="#330000"><a href="#4">4. Running</a></font></h2>
@@ -64,8 +67,11 @@ my window.&nbsp;&nbsp; How can I fix that?</a></font>
<br><font color="#330000"><a href="#4.5">4.5. When I type in a
search string, the string I last searched for is already in front of
my cursor! !What happened?!</a></font>
<br><a href="#4.6">4.6 How do I make nano my default editor (in Pine,
mutt, etc.)?</a></blockquote>
<br><font color="#330000"><a href="#4.6">4.6. I get the message "NumLock
glitch detected. Keypad will malfunction with NumLock off." What
gives?</a></font>
<br><font color="#330000"><a href="#4.7">4.7. How do I make nano my
default editor (in Pine, mutt, etc.)?</a></font></blockquote>
<h2>
<font color="#330000"><a href="#5">5. Internationalization</a></font></h2>
@@ -146,7 +152,7 @@ nano?</font></h2>
on a Unix system.&nbsp; The Pico text editor is the portion of the program
one would use to compose his or her mail messages.&nbsp; Many beginners
to Unix flocked to Pico and Pine because of their well organized, easy
to use interfaces.&nbsp; With the proliferation of Linux in the mid to
to use interfaces.&nbsp; With the proliferation of GNU/Linux in the mid to
late 90's, many University students became intimately familiar with the
strengths (and weaknesses) of Pine and Pico.</font>
<p><b><font color="#330000">Then came debian...</font></b>
@@ -181,7 +187,7 @@ renamed to nano because of a namespace conflict with another program called
'tip'.&nbsp; The original 'tip' program "establishes a full duplex terminal
connection to a remote host", and was included with many older Unix systems
(and newer ones like Solaris). The conflict was not noticed at first because
there is no 'tip' utility included with most Linux distributions (where
there is no 'tip' utility included with most GNU/Linux distributions (where
nano was developed).</font></blockquote>
<h2>
@@ -189,7 +195,7 @@ nano was developed).</font></blockquote>
of nano?</font></h2>
<blockquote><font color="#330000">The current version of nano *should*
be 0.9.24.&nbsp; Of course you should always check the nano hompage to
be 0.9.99pre1.&nbsp; Of course you should always check the nano hompage to
see what the latest and greatest version is.</font></blockquote>
<h2>
@@ -294,7 +300,7 @@ DEB package?</font></h2>
<b>dpkg
-i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where
<b>x.y.z</b>
is the release of nano.&nbsp; There are other programs to install programs,
is the release of nano.&nbsp; There are other programs to install packages,
and if you wish to use those, knock yourself out.</font></blockquote>
<h2>
@@ -310,7 +316,8 @@ try this:</font>
<p><font color="#330000">(again, where x.y.z is the version number in question).&nbsp;
Then you need to run configure with any options you might want (if any).</font>
<p><font color="#330000">The average case is this:</font>
<p><b><font color="#330000">./configure</font></b>
<p><b><font color="#330000">cd nano-x.y.z/</font></b>
<br><b><font color="#330000">./configure</font></b>
<br><b><font color="#330000">make</font></b>
<br><font color="#330000"><b>make install </b>(as root, of course)</font></blockquote>
@@ -340,8 +347,31 @@ run strip on the binary when installing it!</font></h2>
<b>make install-strip</b>. The default make install does not, and will
not, run strip automatically.</font></blockquote>
<hr WIDTH="100%">
<h1>
<h2>
<a NAME="3.6"></a><font color="#330000">
3.6. How can I make the executable smaller? This is too
bloated!</font></h2>
<blockquote><font color="#330000">Actually, there are several parts of the
editor that can be disabled. You can pass arguments to the
<b>configure</b> script that disable certain features. Here's a brief
list:
<pre>
<b>--disable-tabcomp</b> Disables tab completion code for a smaller binary
<b>--disable-justify</b> Disable justify/unjustify function
<b>--disable-speller</b> Disables spell checker function
<b>--disable-help</b> Disables help function (^G)
<b>--disable-browser</b> Disables mini file browser
</pre><br>
There's also the <b>--enable-tiny</b> option which disabled everything
above, as well as some larger chunks of the program (like the marker code
that you use Control-^ to select with). Also, if you know you aren't
going to be using other languages you can use <b>--disable-nls</b> to
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.
</font></blockquote> <hr WIDTH="100%"> <h1>
<a NAME="4"></a><font color="#330000">4. Running</font></h1>
<h2>
@@ -368,8 +398,8 @@ to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</font></block
my window.&nbsp;&nbsp; How can I fix that?</font></h2>
<blockquote><font color="#330000">Older versions of nano had this problem,
please upgrade to a newer version (at least 0.9.9 would be great, 0.9.
12 is recommended).</font></blockquote>
please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12
is recommended).</font></blockquote>
<h2>
<a NAME="4.4"></a><font color="#330000">4.4. Why does nano show ^\ and
@@ -396,7 +426,26 @@ Meta-P while in nano (see the ^G help text for more
details).</font></blockquote>
<h2>
<a NAME="4.6"></a>4.6. How do I make nano my default editor (in Pine,
<a NAME="4.6"></a>I get the message "NumLock glitch detected. Keypad
will malfunction with NumLock off." What gives?</h2>
<blockquote>
Nano (actually almost all console editors do) has issues when cycling
the NumLock key in certain X terminals (rxvt, aterm, wterm, etc...). When
you switch NumLock on to off, you put the terminal into an "application
mode" that changes what sequences are sent by the keypad. These sequences
vary sufficiently from terminal to terminal that it is nearly impossible
to work around them from within nano.
<br><br>
In a nutshell, if you want to be able to use the keypad with the arrow and
page up/down functionality, you have to exit nano and reset your terminal
(presumably with "reset" or "stty sane" or similar) and then run nano
again with NumLock off. If you know an easier way to restore "normal
mode", please mail <A href="nano@nano-editor.org">nano@nano-editor.org</A>.
<br>&nbsp;</blockquote>
<h2>
<a NAME="4.7"></a>4.7. How do I make nano my default editor (in Pine,
mutt, etc)?</h2>
<blockquote>You need to make nano your $EDITOR.&nbsp; If you want this
@@ -526,7 +575,7 @@ any changes in the past few years in a positive direction.</font></blockquote>
<blockquote><font color="#330000">There are two mailing lists for nano
hosted at <a href="http://www.sourceforge.net">SourceForge</a>, nano-announce
and nano-devel.&nbsp; Nano-announce is a very low traffic list where new
versions of nano are announced (surprise!)&nbsp; Nano-devel is a sometimes
versions of nano are announced (surprise!)&nbsp; Nano-devel is a normally
low, sometimes very high traffic list for dicussing the present and future
development of nano.&nbsp; Here are links to where you can sign up for
a given list:</font><font color="#330000"></font>

450
files.c
View File

@@ -271,6 +271,21 @@ int do_insertfile(void)
realname = mallocstrcpy(realname, answer);
#endif
#ifndef DISABLE_BROWSER
if (i == NANO_TOFILES_KEY) {
char *tmp = do_browse_from(realname);
#ifdef DISABLE_TABCOMP
realname = NULL;
#endif
if (tmp != NULL)
realname = mallocstrcpy(realname, tmp);
else
return do_insertfile();
}
#endif
i = open_file(realname, 1, 0);
free(realname);
@@ -318,7 +333,7 @@ int write_file(char *name, int tmp)
statusbar(_("Cancelled"));
return -1;
}
titlebar();
titlebar(NULL);
fileptr = fileage;
if (realname != NULL)
@@ -359,7 +374,7 @@ int write_file(char *name, int tmp)
if (fd == -1) {
if (!tmp && ISSET(TEMP_OPT)) {
UNSET(TEMP_OPT);
return do_writeout(1);
return do_writeout(filename, 1);
}
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
@@ -376,7 +391,7 @@ int write_file(char *name, int tmp)
if ((fd = mkstemp(buf)) == -1) {
if (ISSET(TEMP_OPT)) {
UNSET(TEMP_OPT);
return do_writeout(1);
return do_writeout(filename, 1);
}
statusbar(_("Could not open file for writing: %s"),
strerror(errno));
@@ -475,19 +490,20 @@ int write_file(char *name, int tmp)
filename = mallocstrcpy(filename, realname);
statusbar(_("Wrote %d lines"), lineswritten);
UNSET(MODIFIED);
titlebar();
titlebar(NULL);
}
return 1;
}
int do_writeout(int exiting)
int do_writeout(char *path, int exiting)
{
int i = 0;
#ifdef NANO_EXTRA
static int did_cred = 0;
#endif
answer = mallocstrcpy(answer, filename);
answer = mallocstrcpy(answer, path);
if ((exiting) && (ISSET(TEMP_OPT))) {
if (filename[0]) {
@@ -509,6 +525,18 @@ int do_writeout(int exiting)
if (i != -1) {
#ifndef DISABLE_BROWSER
if (i == NANO_TOFILES_KEY) {
char *tmp = do_browse_from(answer);
if (tmp != NULL)
answer = mallocstrcpy(answer, tmp);
else
return do_writeout(answer, exiting);
}
#endif
#ifdef DEBUG
fprintf(stderr, _("filename is %s"), answer);
#endif
@@ -544,7 +572,7 @@ int do_writeout(int exiting)
int do_writeout_void(void)
{
return do_writeout(0);
return do_writeout(filename, 0);
}
#ifndef DISABLE_TABCOMP
@@ -561,11 +589,15 @@ char *real_dir_from_tilde(char *buf)
if (buf[0] == '~') {
if (buf[1] == '~')
goto abort; /* Handle ~~ without segfaulting =) */
else if (buf[1] == '/') {
else if (buf[1] == 0 || buf[1] == '/') {
if (getenv("HOME") != NULL) {
dirtmp = nmalloc(strlen(buf) + 2 + strlen(getenv("HOME")));
sprintf(dirtmp, "%s/%s", getenv("HOME"), &buf[2]);
if (strlen(buf) > 2)
sprintf(dirtmp, "%s/%s", getenv("HOME"), &buf[2]);
else
sprintf(dirtmp, "%s/", getenv("HOME"));
}
} else if (buf[1] != 0) {
@@ -688,8 +720,8 @@ char **username_tab_completion(char *buf, int *num_matches)
homedirs = (char **) NULL;
*num_matches = 0;
}
matches = nmalloc(BUFSIZ);
homedirs = nmalloc(BUFSIZ);
matches = nmalloc(BUFSIZ * sizeof(char *));
homedirs = nmalloc(BUFSIZ * sizeof(char *));
strcat(buf, "*");
do {
i = 0;
@@ -757,14 +789,14 @@ char **cwd_tab_completion(char *buf, int *num_matches)
DIR *dir;
struct dirent *next;
matches = nmalloc(BUFSIZ);
matches = nmalloc(BUFSIZ * sizeof(char *));
/* Stick a wildcard onto the buf, for later use */
strcat(buf, "*");
/* Okie, if there's a / in the buffer, strip out the directory part */
if (strcmp(buf, "") && strstr(buf, "/")) {
dirName = malloc(strlen(buf) + 1);
dirName = nmalloc(strlen(buf) + 1);
tmp = buf + strlen(buf);
while (*tmp != '/' && tmp != buf)
tmp--;
@@ -807,11 +839,6 @@ char **cwd_tab_completion(char *buf, int *num_matches)
}
while ((next = readdir(dir)) != NULL) {
/* Some quick sanity checks */
if ((strcmp(next->d_name, "..") == 0)
|| (strcmp(next->d_name, ".") == 0)) {
continue;
}
#ifdef DEBUG
fprintf(stderr, "Comparing \'%s\'\n", next->d_name);
#endif
@@ -855,7 +882,8 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
/* Make a local copy of the string -- up to the position of the
cursor */
matchBuf = (char *) calloc(strlen(buf) + 2, sizeof(char));
matchBuf = (char *) nmalloc((strlen(buf) + 2) * sizeof(char));
memset(matchBuf, '\0', (strlen(buf) + 2));
strncpy(matchBuf, buf, place);
tmp = matchBuf;
@@ -1029,3 +1057,387 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
return buf;
}
#endif
#ifndef DISABLE_BROWSER
/* Return the stat of the file pointed to by path */
struct stat filestat(const char *path) {
struct stat st;
lstat(path, &st);
return st;
}
/* Our sort routine for file listings - sort directories before
* files, and then alphabetically
*/
int diralphasort(const void *va, const void *vb) {
struct stat file1info, file2info;
char *a = *(char **)va, *b = *(char **)vb;
int answer = 0;
if (stat(a, &file1info) == -1)
answer = 1;
else if (stat(b, &file2info) == -1)
answer = 1;
else {
/* If is a is a dir and b isn't, return -1.
Else if b is a dir and a isn't, return 0.
Else return a < b */
if (S_ISDIR(file1info.st_mode) && !S_ISDIR(file2info.st_mode))
return -1;
else if (!S_ISDIR(file1info.st_mode) && S_ISDIR(file2info.st_mode))
return 1;
else
answer = strcmp(a, b);
}
return(answer);
}
/* Initialize the browser code, including the list of files in *path */
char **browser_init(char *path, int *longest, int *numents)
{
DIR *dir;
struct dirent *next;
char **filelist = (char **) NULL;
int i = 0;
dir = opendir(path);
if (!dir)
return NULL;
*numents = 0;
while ((next = readdir(dir)) != NULL) {
if (!strcmp(next->d_name, "."))
continue;
(*numents)++;
if (strlen(next->d_name) > *longest)
*longest = strlen(next->d_name);
}
rewinddir(dir);
*longest += 10;
filelist = nmalloc(*numents * sizeof (char *));
while ((next = readdir(dir)) != NULL) {
if (!strcmp(next->d_name, "."))
continue;
filelist[i] = nmalloc(strlen(next->d_name) + strlen(path) + 2);
if (!strcmp(path, "/"))
snprintf(filelist[i], strlen(next->d_name) + strlen(path) + 1,
"%s%s", path, next->d_name);
else
snprintf(filelist[i], strlen(next->d_name) + strlen(path) + 2,
"%s/%s", path, next->d_name);
i++;
}
if (*longest > COLS - 1)
*longest = COLS - 1;
return filelist;
}
/* Free our malloced memory */
void free_charptrarray(char **array, int len)
{
int i;
for (i = 0; i < len - 1; i++)
free(array[i]);
free(array);
}
/* only print the last part of a path, isn't there a shell
command for this? */
char *tail(char *foo)
{
char *tmp = NULL;
tmp = foo + strlen(foo);
while (*tmp != '/' && tmp != foo)
tmp--;
tmp++;
return tmp;
}
/* Strip one dir from the end of a string */
void striponedir(char *foo)
{
char *tmp = NULL;
/* Don't strip the root dir */
if (!strcmp(foo, "/"))
return;
tmp = foo + strlen(foo);
if (*tmp == '/')
tmp--;
while (*tmp != '/' && tmp != foo)
tmp--;
if (tmp != foo)
*tmp = 0;
else
*(tmp+1) = 0;
return;
}
/* Our browser function. inpath is the path to start browsing from */
char *do_browser(char *inpath)
{
struct stat st;
char *foo, *retval = NULL;
static char *path = NULL;
int numents = 0, i = 0, j = 0, kbinput = 0, longest = 0, abort = 0;
int col = 0, selected = 0, editline = 0, width = 0, filecols = 0;
int lineno = 0, kb;
char **filelist = (char **) NULL;
/* If path isn't the same as inpath, we are being passed a new
dir as an arg. We free it here so it will be copied from
inpath below */
if (path != NULL && strcmp(path, inpath)) {
free(path);
path = NULL;
}
/* if path doesn't exist, make it so */
if (path == NULL)
path = mallocstrcpy(path, inpath);
filelist = browser_init(path, &longest, &numents);
foo = nmalloc(longest + 8);
/* Sort the list by directory first then alphabetically */
qsort(filelist, numents, sizeof(char *), diralphasort);
kb = keypad_on(edit, 1);
titlebar(path);
bottombars(browser_list, BROWSER_LIST_LEN);
curs_set(0);
wmove(edit, 0, 0);
i = 0;
width = 0;
filecols = 0;
/* Loop invariant: Microsoft sucks. */
do {
blank_edit();
blank_statusbar();
editline = 0;
col = 0;
/* Compute line number we're on now so we don't divide by zero later */
if (width == 0)
lineno = selected;
else
lineno = selected / width;
switch (kbinput) {
case KEY_UP:
case 'u':
if (selected - width >= 0)
selected -= width;
break;
case KEY_LEFT:
case 'l':
if (selected > 0)
selected--;
break;
case KEY_DOWN:
case 'd':
if (selected + width <= numents - 1)
selected += width;
break;
case KEY_RIGHT:
case 'r':
if (selected < numents - 1)
selected++;
break;
case NANO_PREVPAGE_KEY:
case NANO_PREVPAGE_FKEY:
case KEY_PPAGE:
case '-':
if (lineno % editwinrows == 0) {
if (selected - (editwinrows * width) >= 0)
selected -= editwinrows * width;
else
selected = 0;
}
else if (selected - (editwinrows +
lineno % editwinrows) * width >= 0)
selected -= (editwinrows + lineno % editwinrows) * width;
else
selected = 0;
break;
case NANO_NEXTPAGE_KEY:
case NANO_NEXTPAGE_FKEY:
case KEY_NPAGE:
case ' ':
if (lineno % editwinrows == 0) {
if (selected + (editwinrows * width) <= numents - 1)
selected += editwinrows * width;
else
selected = numents - 1;
}
else if (selected + (editwinrows -
lineno % editwinrows) * width <= numents - 1)
selected += (editwinrows - lineno % editwinrows) * width;
else
selected = numents - 1;
break;
case KEY_ENTER:
case NANO_CONTROL_M:
case 's': /* More Pico compatibility */
case 'S':
/* You can't cd up from / */
if (!strcmp(filelist[selected], "/..") && !strcmp(path, "/"))
statusbar(_("Can't move up a directory"));
else
path = mallocstrcpy(path, filelist[selected]);
st = filestat(path);
if (S_ISDIR(st.st_mode)) {
if (opendir(path) == NULL) {
/* We can't open this dir for some reason. Complain */
statusbar(_("Can't open \"%s\": %s"), path, strerror(errno));
striponedir(path);
align(&path);
break;
}
if (!strcmp("..", tail(path))) {
/* They want to go up a level, so strip off .. and the
current dir */
striponedir(path);
striponedir(path);
align(&path);
}
/* Start over again with the new path value */
return do_browser(path);
} else {
retval = path;
abort = 1;
}
break;
/* Stuff we want to abort the browser */
case 'q':
case 'Q':
case 'e': /* Pico compatibility, yeech */
case 'E':
case NANO_EXIT_FKEY:
abort = 1;
break;
}
if (abort)
break;
if (width)
i = width * editwinrows * ((selected / width) / editwinrows);
else
i = 0;
wmove(edit, 0, 0);
for (j = i; j < numents && editline <= editwinrows - 1; j++) {
filecols++;
strncpy(foo, tail(filelist[j]), strlen(tail(filelist[j])) + 1);
while (strlen(foo) < longest)
strcat(foo, " ");
col += strlen(foo);
/* Put file info in the string also */
st = filestat(filelist[j]);
if (S_ISDIR(st.st_mode))
strcpy(foo + longest - 5, "(dir)");
else {
if (S_ISLNK(st.st_mode))
strcpy(foo + longest - 2, "--");
else if (st.st_size < 1024) /* less than 1 K */
sprintf(foo + longest - 7, "%4d B", (int) st.st_size);
else if (st.st_size > 1073741824) /* at least 1 gig */
sprintf(foo + longest - 7, "%4d GB", (int) st.st_size / 1073741824);
else if (st.st_size > 1048576) /* at least 1 meg */
sprintf(foo + longest - 7, "%4d MB", (int) st.st_size / 1048576);
else /* Its more than 1 k and less than a meg */
sprintf(foo + longest - 7, "%4d KB", (int) st.st_size / 1024);
}
/* Hilight the currently selected file/dir */
if (j == selected)
wattron(edit, A_REVERSE);
waddnstr(edit, foo, strlen(foo));
if (j == selected)
wattroff(edit, A_REVERSE);
/* And add some space between the cols */
waddstr(edit, " ");
col += 2;
/* And if the next entry isn't going to fit on the
line, move to the next one */
if (col > (COLS - longest)) {
editline++;
wmove(edit, editline, 0);
col = 0;
if (width == 0)
width = filecols;
}
}
wrefresh(edit);
} while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY);
curs_set(1);
blank_edit();
titlebar(NULL);
edit_refresh();
kb = keypad_on(edit, kb);
/* cleanup */
free_charptrarray(filelist, numents);
free(foo);
return retval;
}
/* Browser fron't end, checks to see if inpath has a dir in it and if so
starts do_browser from there, else from the current dir */
char *do_browse_from(char *inpath)
{
struct stat st;
char *tmp = NULL;
tmp = mallocstrcpy(tmp, inpath);
/* If there's no / in the string, we may was well start from . */
if (tmp == NULL || !strstr(tmp, "/"))
return do_browser(getcwd(NULL, 0));
/* If the string is a directory, pass do_browser that */
st = filestat(tmp);
if (S_ISDIR(st.st_mode))
return do_browser(tmp);
/* Okay, there's a dir in there, but not at the end of the string...
try stripping it off */
striponedir(tmp);
align(&tmp);
return do_browser(tmp);
}
#endif

View File

@@ -79,6 +79,10 @@ shortcut goto_list[GOTO_LIST_LEN];
shortcut writefile_list[WRITEFILE_LIST_LEN];
shortcut help_list[HELP_LIST_LEN];
shortcut spell_list[SPELL_LIST_LEN];
#ifndef DISABLE_BROWSER
shortcut browser_list[BROWSER_LIST_LEN];
#endif
toggle toggles[TOGGLE_LEN];
/* Regular expressions */
@@ -173,6 +177,8 @@ void shortcut_init(int unjustify)
"", *nano_cancel_msg = "", *nano_unjustify_msg = "";
#ifndef NANO_SMALL
char *nano_tofiles_msg = "";
nano_help_msg = _("Invoke the help menu");
nano_writeout_msg = _("Write the current file to disk");
nano_exit_msg = _("Exit from nano");
@@ -205,6 +211,7 @@ void shortcut_init(int unjustify)
nano_enter_msg = _("Insert a carriage return at the cursor position");
nano_case_msg =
_("Make the current search or replace case (in)sensitive");
nano_tofiles_msg = _("Go to file browser");
nano_cancel_msg = _("Cancel the current function");
#endif
@@ -403,15 +410,31 @@ void shortcut_init(int unjustify)
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
sc_init_one(&writefile_list[0], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
#ifndef DISABLE_BROWSER
sc_init_one(&writefile_list[0], NANO_TOFILES_KEY, _("To Files"),
nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
#endif
sc_init_one(&writefile_list[0], NANO_CANCEL_KEY, _("Cancel"),
sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 1], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
sc_init_one(&spell_list[0], NANO_CANCEL_KEY, _("Cancel"),
nano_cancel_msg, 0, 0, 0, VIEW, 0);
#ifndef DISABLE_BROWSER
sc_init_one(&browser_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
nano_prevpage_msg,
0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, 0);
sc_init_one(&browser_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
nano_nextpage_msg,
0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, 0);
sc_init_one(&browser_list[2], NANO_EXIT_KEY, _("Exit"),
nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, 0);
#endif
toggle_init();
}

7
move.c
View File

@@ -55,7 +55,12 @@ int page_down(void)
if (current == filebot)
return 0;
if (editbot != filebot || edittop == fileage) {
/* AHEM, if we only have a screen or less of text, DONT do an
edit_update, just move the cursor to editbot! */
if (edittop == fileage && editbot == filebot) {
current = editbot;
reset_cursor();
} else if (editbot != filebot || edittop == fileage) {
current_y = 0;
current = editbot;

232
nano.c
View File

@@ -62,11 +62,15 @@
/* Former globals, now static */
int fill = 0; /* Fill - where to wrap lines, basically */
#ifndef DISABLE_SPELLER
static char *alt_speller; /* Alternative spell command */
#endif
struct termios oldterm; /* The user's original term settings */
static struct sigaction act; /* For all out fun signal handlers */
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP)
#ifndef DISABLE_HELP
static char *help_text_init = ""; /* Initial message, not including shortcuts */
#endif
@@ -74,25 +78,19 @@ char *last_search = NULL; /* Last string we searched for */
char *last_replace = NULL; /* Last replacement string */
int search_last_line; /* Is this the last search line? */
void keypad_on(int yesno)
{
keypad(edit, yesno);
keypad(bottomwin, yesno);
}
/* What we do when we're all set to exit */
RETSIGTYPE finish(int sigage)
{
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
if (!ISSET(NO_HELP)) {
mvwaddstr(bottomwin, 1, 0, hblank);
mvwaddstr(bottomwin, 2, 0, hblank);
} else
mvwaddstr(bottomwin, 0, 0, hblank);
/* Apparently you REALLY can't get away with not calling keypad()
or your window looks awful when it exits. so we just call it right
before we exit, muhaha :-) */
keypad_on(TRUE);
wrefresh(bottomwin);
endwin();
@@ -143,6 +141,16 @@ void die(char *msg, ...)
exit(1); /* We have a problem: exit w/ errorlevel(1) */
}
/* Die with an error message that the screen was too small if, well, the
screen is too small */
void die_too_small(void)
{
char *too_small_msg = _("Window size is too small for Nano...");
die(too_small_msg);
}
void print_view_warning(void)
{
statusbar(_("Key illegal in VIEW mode"));
@@ -165,7 +173,10 @@ void global_init(void)
center_y = LINES / 2;
current_x = 0;
current_y = 0;
editwinrows = LINES - 5 + no_help();
if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
die_too_small();
fileage = NULL;
cutbuffer = NULL;
current = NULL;
@@ -173,8 +184,13 @@ void global_init(void)
editbot = NULL;
totlines = 0;
placewewant = 0;
if (!fill)
fill = COLS - 8;
fill = COLS - CHARS_FROM_EOL;
if (fill < MIN_FILL_LENGTH)
die_too_small();
hblank = nmalloc(COLS + 1);
/* Thanks BG for this bit... */
@@ -183,11 +199,10 @@ void global_init(void)
hblank[i] = 0;
}
#ifndef DISABLE_HELP
void init_help_msg(void)
{
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP)
help_text_init =
_(" nano help text\n\n "
"The nano editor is designed to emulate the functionality and "
@@ -206,9 +221,9 @@ void init_help_msg(void)
"Esc, Alt or Meta key depending on your keyboard setup. The "
"following keystrokes are available in the main editor window. "
"Optional keys are shown in parentheses:\n\n");
#endif
}
#endif
/* Make a copy of a node to a pointer (space will be malloc()ed) */
filestruct *copy_node(filestruct * src)
@@ -367,12 +382,12 @@ void usage(void)
(" -c --const Constantly show cursor position\n"));
printf(_
(" -h --help Show this message\n"));
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
printf(_
(" -i --autoindent Automatically indent new lines\n"));
printf(_
(" -l --nofollow Don't follow symbolic links, overwrite\n"));
#ifndef NANO_SMALL
@@ -380,13 +395,15 @@ void usage(void)
printf(_(" -m --mouse Enable mouse\n"));
#endif
#endif
printf(_
(" -p --pico Emulate Pico as closely as possible\n"));
printf
(_
(" -r [#cols] --fill=[#cols] Set fill cols to (wrap lines at) #cols\n"));
printf(_
(" -p --pico Emulate Pico as closely as possible\n"));
#ifndef DISABLE_SPELLER
printf(_
(" -s [prog] --speller=[prog] Enable alternate speller\n"));
#endif
printf(_
(" -t --tempfile Auto save on exit, don't prompt\n"));
printf(_
@@ -407,10 +424,10 @@ void usage(void)
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(_(" -k Let ^K cut from cursor to end of line\n"));
#endif
printf(_(" -i Automatically indent new lines\n"));
printf(_
(" -l Don't follow symbolic links, overwrite\n"));
#ifndef NANO_SMALL
@@ -418,10 +435,11 @@ void usage(void)
printf(_(" -m Enable mouse\n"));
#endif
#endif
printf(_
(" -r [#cols] Set fill cols to (wrap lines at) #cols\n"));
printf(_(" -s [prog] Enable alternate speller\n"));
printf(_(" -p Emulate Pico as closely as possible\n"));
printf(_(" -r [#cols] Set fill cols to (wrap lines at) #cols\n"));
#ifndef DISABLE_SPELLER
printf(_(" -s [prog] Enable alternate speller\n"));
#endif
printf(_(" -t Auto save on exit, don't prompt\n"));
printf(_(" -v View (read only) mode\n"));
printf(_(" -w Don't wrap long lines\n"));
@@ -440,24 +458,30 @@ void version(void)
(" Email: nano@nano-editor.org Web: http://www.nano-editor.org"));
printf(_("\n Compiled options:"));
#ifdef NANO_SMALL
printf(" --enable-tiny");
#endif
#ifdef NANO_EXTRA
printf(" --enable-extra");
#endif
#ifdef DISABLE_TABCOMP
#ifdef NANO_SMALL
printf(" --enable-tiny");
#else
#ifdef DISABLE_BROWSER
printf(" --disable-browser");
#endif
#ifdef DISABLE_TABCOMP
printf(" --disable-tabcomp");
#endif
#ifdef DISABLE_JUSTIFY
#endif
#ifdef DISABLE_JUSTIFY
printf(" --disable-justify");
#endif
#ifdef DISABLE_SPELLER
#endif
#ifdef DISABLE_SPELLER
printf(" --disable-speller");
#endif
#ifdef DISABLE_HELP
#endif
#ifdef DISABLE_HELP
printf(" --disable-help");
#endif
#endif
#ifdef USE_SLANG
printf(" --with-slang");
#endif
@@ -494,7 +518,7 @@ void splice_node(filestruct * begin, filestruct * new, filestruct * end)
int do_mark()
{
#ifdef NANO_SMALL
nano_small_msg();
nano_disabled_msg();
#else
if (!ISSET(MARK_ISSET)) {
statusbar(_("Mark Set"));
@@ -522,13 +546,6 @@ int no_help(void)
return 0;
}
#ifdef NANO_SMALL
void nano_small_msg(void)
{
statusbar("Sorry, this function not available with nano-tiny option");
}
#endif
#if defined(DISABLE_JUSTIFY) || defined(DISABLE_SPELLER) || defined(DISABLE_HELP)
void nano_disabled_msg(void)
{
@@ -1116,7 +1133,7 @@ void wrap_reset(void)
UNSET(SAMELINEWRAP);
}
#if !defined(NANO_SMALL) && !defined(DISABLE_SPELLER)
#ifndef DISABLE_SPELLER
int do_int_spell_fix(char *word)
{
@@ -1182,9 +1199,6 @@ int do_int_spell_fix(char *word)
return TRUE;
}
#endif
#if !defined(NANO_SMALL) && !defined(DISABLE_SPELLER)
/* Integrated spell checking using 'spell' program */
int do_int_speller(char *tempfile_name)
@@ -1312,9 +1326,6 @@ int do_int_speller(char *tempfile_name)
return TRUE;
}
#endif
#if !defined(NANO_SMALL) && !defined(DISABLE_SPELLER)
/* External spell checking */
int do_alt_speller(char *file_name)
@@ -1366,10 +1377,7 @@ int do_alt_speller(char *file_name)
int do_spell(void)
{
#if defined(NANO_SMALL)
nano_small_msg();
return (TRUE);
#elif defined(DISABLE_SPELLER)
#ifdef DISABLE_SPELLER
nano_disabled_msg();
return (TRUE);
#else
@@ -1425,7 +1433,7 @@ int do_exit(void)
#endif
if (i == 1) {
if (do_writeout(1) > 0)
if (do_writeout(filename, 1) > 0)
finish(0);
} else if (i == 0)
finish(0);
@@ -1565,8 +1573,12 @@ void handle_sigwinch(int s)
center_x = COLS / 2;
center_y = LINES / 2;
editwinrows = LINES - 5 + no_help();
fill = COLS - 8;
if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
die_too_small();
if ((fill = COLS - CHARS_FROM_EOL) < MIN_FILL_LENGTH)
die_too_small();
free(hblank);
hblank = nmalloc(COLS + 1);
@@ -1602,7 +1614,7 @@ void handle_sigwinch(int s)
/* Do these b/c width may have changed... */
refresh();
titlebar();
titlebar(NULL);
edit_refresh();
display_main_list();
total_refresh();
@@ -1639,7 +1651,8 @@ void signal_init(void)
void window_init(void)
{
editwinrows = LINES - 5 + no_help();
if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
die_too_small();
/* Setup up the main text window */
edit = newwin(editwinrows, COLS, 2, 0);
@@ -1647,6 +1660,14 @@ void window_init(void)
/* And the other windows */
topwin = newwin(2, COLS, 0, 0);
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);
#ifdef PDCURSES
/* Oops, I guess we need this again.
Moved here so the keypad still works after a Meta-X, for example */
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
#endif
}
void mouse_init(void)
@@ -1654,15 +1675,14 @@ void mouse_init(void)
#ifndef NANO_SMALL
#ifdef NCURSES_MOUSE_VERSION
if (ISSET(USE_MOUSE)) {
keypad_on(TRUE);
keypad_on(edit, 1);
mousemask(BUTTON1_RELEASED, NULL);
mouseinterval(50);
} else {
} else
mousemask(0, NULL);
keypad_on(FALSE);
}
#endif
#endif
@@ -1674,7 +1694,7 @@ int do_tab(void)
return 1;
}
#if !defined(NANO_SMALL) && !defined(DISABLE_JUSTIFY)
#ifndef DISABLE_JUSTIFY
int empty_line(const char *data)
{
while (*data) {
@@ -1726,15 +1746,12 @@ void justify_format(char *data)
int do_justify(void)
{
#ifdef NANO_SMALL
nano_small_msg();
return 1;
#elif defined(DISABLE_JUSTIFY)
#ifdef DISABLE_JUSTIFY
nano_disabled_msg();
return 1;
#else
int slen = 0; /* length of combined lines on one line. */
int initial_y, kbinput;
int initial_y, kbinput = 0;
filestruct *initial = NULL, *tmpjust = NULL, *cutbak, *tmptop, *tmpbot;
if (empty_line(current->data)) {
@@ -1801,8 +1818,6 @@ int do_justify(void)
delete_node(tmpnode);
}
totsize -= strlen(current->data);
justify_format(current->data);
slen = strlen(current->data);
@@ -1912,7 +1927,7 @@ int do_justify(void)
#endif
}
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP)
#ifndef DISABLE_HELP
void help_init(void)
{
int i, sofar = 0;
@@ -1984,7 +1999,9 @@ void help_init(void)
void do_toggle(int which)
{
#ifndef NANO_SMALL
#ifdef NANO_SMALL
nano_disabled_msg();
#else
char *enabled = _("enabled");
char *disabled = _("disabled");
@@ -2029,11 +2046,40 @@ void do_toggle(int which)
}
SET(DISABLE_CURPOS);
#else
nano_small_msg();
#endif
}
/* If the NumLock key has made the keypad gone awry, print an error
message, hopefully we can address it later. */
void print_numlock_warning(void)
{
static int didmsg = 0;
if (!didmsg) {
statusbar(_("NumLock glitch detected. Keypad will malfunction with NumLock off"));
didmsg = 1;
}
}
/* This function returns the correct keystroke, given the A,B,C or D
input key. This is a common sequence of many terms which send
Esc-O-[A-D] or Esc-[-[A-D]. */
int ABCD(int input)
{
switch(input)
{
case 'A':
return(KEY_UP);
case 'B':
return(KEY_DOWN);
case 'C':
return(KEY_RIGHT);
case 'D':
return(KEY_LEFT);
default:
return 0;
}
}
int main(int argc, char *argv[])
{
int optchr;
@@ -2064,7 +2110,9 @@ int main(int argc, char *argv[])
#endif
{"autoindent", 0, 0, 'i'},
{"tempfile", 0, 0, 't'},
#ifndef DISABLE_SPELLER
{"speller", 1, 0, 's'},
#endif
{"fill", 1, 0, 'r'},
{"mouse", 0, 0, 'm'},
{"pico", 0, 0, 'p'},
@@ -2125,10 +2173,6 @@ int main(int argc, char *argv[])
case 'k':
SET(CUT_TO_END);
break;
#else
case 'k':
usage(); /* Oops! You dont really have that option */
finish(1);
#endif
case 'l':
UNSET(FOLLOW_SYMLINKS);
@@ -2146,10 +2190,12 @@ int main(int argc, char *argv[])
finish(1);
}
break;
#ifndef DISABLE_SPELLER
case 's':
alt_speller = nmalloc(strlen(optarg) + 1);
strcpy(alt_speller, optarg);
break;
#endif
case 't':
SET(TEMP_OPT);
break;
@@ -2213,13 +2259,12 @@ int main(int argc, char *argv[])
nonl();
cbreak();
noecho();
timeout(0);
/* Set up some global variables */
global_init();
shortcut_init(0);
#ifndef DISABLE_HELP
init_help_msg();
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP)
help_init();
#endif
signal_init();
@@ -2231,12 +2276,6 @@ int main(int argc, char *argv[])
window_init();
mouse_init();
#ifdef PDCURSES
/* Must have this for the arrow, et al, keys to even work in
PDCurses+cygwin under Windows */
keypad_on(TRUE);
#endif
#ifdef DEBUG
fprintf(stderr, _("Main: bottom win\n"));
#endif
@@ -2247,7 +2286,7 @@ int main(int argc, char *argv[])
fprintf(stderr, _("Main: open file\n"));
#endif
titlebar();
titlebar(NULL);
/* Now we check to see if argv[optind] is non-null to determine if
we're dealing with a new file or not, not argc == 1... */
@@ -2272,12 +2311,19 @@ int main(int argc, char *argv[])
#endif
kbinput = wgetch(edit);
#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:
kbinput = wgetch(edit);
if (kbinput <= 'S' && kbinput >= 'P')
if (kbinput <= 'D' && kbinput >= 'A')
kbinput = ABCD(kbinput);
else if (kbinput <= 'z' && kbinput >= 'j')
print_numlock_warning();
else if (kbinput <= 'S' && kbinput >= 'P')
kbinput = KEY_F(kbinput - 79);
#ifdef DEBUG
else {
@@ -2294,7 +2340,6 @@ int main(int argc, char *argv[])
keyhandled = 1;
break;
case 91:
switch (kbinput = wgetch(edit)) {
case '1': /* Alt-[-1-[0-5,7-9] = F1-F8 in X at least */
kbinput = wgetch(edit);
@@ -2371,16 +2416,10 @@ int main(int argc, char *argv[])
kbinput = KEY_F(kbinput - 64);
break;
case 'A':
kbinput = KEY_UP;
break;
case 'B':
kbinput = KEY_DOWN;
break;
case 'C':
kbinput = KEY_RIGHT;
break;
case 'D':
kbinput = KEY_LEFT;
kbinput = ABCD(kbinput);
break;
case 'H':
kbinput = KEY_HOME;
@@ -2472,6 +2511,7 @@ int main(int argc, char *argv[])
case 0: /* Erg */
do_next_word();
break;
case 331: /* Stuff that we don't want to do squat */
case -1:
case 410: /* Must ignore this, it gets sent when we resize */

21
nano.h
View File

@@ -226,6 +226,7 @@ know what you're doing */
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
#define NANO_ENTER_KEY NANO_CONTROL_M
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
#define NANO_TOFILES_KEY NANO_CONTROL_T
#define TOGGLE_CONST_KEY NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
@@ -243,10 +244,16 @@ know what you're doing */
#define REPLACE_LIST_LEN 6
#define REPLACE_LIST_2_LEN 3
#define GOTO_LIST_LEN 3
#define WRITEFILE_LIST_LEN 1
#define HELP_LIST_LEN 3
#define SPELL_LIST_LEN 1
#ifndef DISABLE_BROWSER
#define WRITEFILE_LIST_LEN 2
#define BROWSER_LIST_LEN 3
#else
#define WRITEFILE_LIST_LEN 1
#endif
#ifdef HAVE_REGEX_H
#define TOGGLE_LEN 9
#else
@@ -259,4 +266,14 @@ know what you're doing */
#define TOP 2
#define CENTER 1
#define BOTTOM 0
#endif
/* Minimum editor window rows required for Nano to work correctly */
#define MIN_EDITOR_ROWS 3
/* Default number of characters from end-of-line where text wrapping occurs */
#define CHARS_FROM_EOL 8
/* Minimum fill length (space available for text before wrapping occurs) */
#define MIN_FILL_LENGTH 10
#endif /* ifndef NANO_H */

432
po/de.po

File diff suppressed because it is too large Load Diff

468
po/es.po

File diff suppressed because it is too large Load Diff

462
po/fi.po

File diff suppressed because it is too large Load Diff

426
po/fr.po

File diff suppressed because it is too large Load Diff

432
po/id.po

File diff suppressed because it is too large Load Diff

432
po/it.po

File diff suppressed because it is too large Load Diff

20
proto.h
View File

@@ -51,6 +51,9 @@ extern shortcut main_list[MAIN_LIST_LEN], whereis_list[WHEREIS_LIST_LEN];
extern shortcut replace_list[REPLACE_LIST_LEN], goto_list[GOTO_LIST_LEN];
extern shortcut writefile_list[WRITEFILE_LIST_LEN], help_list[HELP_LIST_LEN];
extern shortcut spell_list[SPELL_LIST_LEN], replace_list_2[REPLACE_LIST_LEN];
#ifndef DISABLE_BROWSER
extern shortcut browser_list[BROWSER_LIST_LEN];
#endif
#ifdef HAVE_REGEX_H
extern int use_regexp, regexp_compiled;
@@ -78,7 +81,7 @@ int do_uncut_text(void);
int no_help(void);
int renumber_all(void);
int open_file(char *filename, int insert, int quiet);
int do_writeout(int exiting);
int do_writeout(char *path, int exiting);
int do_gotoline(long defline);
int do_replace_loop(char *prevanswer, filestruct *begin, int *beginx,
int wholewords, int *i);
@@ -109,13 +112,14 @@ void check_statblank(void);
void update_line(filestruct * fileptr, int index);
void fix_editbot(void);
void statusbar(char *msg, ...);
void titlebar(void);
void blank_statusbar(void);
void titlebar(char *path);
void previous_line(void);
void center_cursor(void);
void bottombars(shortcut s[], int slen);
void blank_statusbar_refresh(void);
void *nmalloc (size_t howmuch);
void *mallocstrcpy(void *dest, void *src);
void *mallocstrcpy(char *dest, char *src);
void wrap_reset(void);
void display_main_list(void);
void nano_small_msg(void);
@@ -134,8 +138,8 @@ void search_init_globals(void);
void replace_abort(void);
void add_to_cutbuffer(filestruct * inptr);
void do_replace_highlight(int highlight_flag, char *word);
void keypad_on(int yesno);
void nano_disabled_msg(void);
void window_init(void);
#ifdef NANO_EXTRA
void do_credits(void);
#endif
@@ -148,6 +152,14 @@ int do_home(void), do_end(void), total_refresh(void), do_mark(void);
int do_delete(void), do_backspace(void), do_tab(void), do_justify(void);
int do_first_line(void), do_last_line(void);
int do_replace(void), do_help(void), do_enter_void(void);
int keypad_on(WINDOW * win, int new);
#ifndef DISABLE_BROWSER
char *do_browser(char *path);
struct stat filestat(const char *path);
char *do_browse_from(char *inpath);
#endif
filestruct *copy_node(filestruct * src);
filestruct *copy_filestruct(filestruct * src);

View File

@@ -123,9 +123,13 @@ void *nrealloc(void *ptr, size_t howmuch)
Should be used as dest = mallocstrcpy(dest, src);
*/
void *mallocstrcpy(void *dest, void *src)
void *mallocstrcpy(char *dest, char *src)
{
if (src == dest)
return src;
if (dest != NULL)
free(dest);

100
winio.c
View File

@@ -463,9 +463,13 @@ void horizbar(WINDOW * win, int y)
wattroff(win, A_REVERSE);
}
void titlebar(void)
void titlebar(char *path)
{
int namelen, space;
char *what = path;
if (path == NULL)
what = filename;
horizbar(topwin, 0);
wattron(topwin, A_REVERSE);
@@ -473,17 +477,23 @@ void titlebar(void)
space = COLS - strlen(VERMSG) - strlen(VERSION) - 21;
namelen = strlen(filename);
namelen = strlen(what);
if (!strcmp(filename, ""))
if (!strcmp(what, ""))
mvwaddstr(topwin, 0, center_x - 6, _("New Buffer"));
else {
if (namelen > space) {
waddstr(topwin, _(" File: ..."));
waddstr(topwin, &filename[namelen - space]);
if (path == NULL)
waddstr(topwin, _(" File: ..."));
else
waddstr(topwin, _(" DIR: ..."));
waddstr(topwin, &what[namelen - space]);
} else {
mvwaddstr(topwin, 0, center_x - (namelen / 2 + 1), "File: ");
waddstr(topwin, filename);
if (path == NULL)
mvwaddstr(topwin, 0, center_x - (namelen / 2 + 1), "File: ");
else
mvwaddstr(topwin, 0, center_x - (namelen / 2 + 1), " DIR: ");
waddstr(topwin, what);
}
}
if (ISSET(MODIFIED))
@@ -552,7 +562,7 @@ void set_modified(void)
{
if (!ISSET(MODIFIED)) {
SET(MODIFIED);
titlebar();
titlebar(NULL);
wrefresh(topwin);
}
}
@@ -1119,7 +1129,7 @@ int total_refresh(void)
clearok(topwin, FALSE);
clearok(bottomwin, FALSE);
edit_refresh();
titlebar();
titlebar(NULL);
return 1;
}
@@ -1132,33 +1142,26 @@ void previous_line(void)
int do_cursorpos(void)
{
filestruct *fileptr;
float linepct, bytepct;
int i, tot = 0;
float linepct = 0.0, bytepct = 0.0;
int i = 0;
if (current == NULL || fileage == NULL)
return 0;
for (fileptr = fileage; fileptr != current && fileptr != NULL;
fileptr = fileptr->next)
tot += strlen(fileptr->data) + 1;
i += strlen(fileptr->data) + 1;
if (fileptr == NULL)
return -1;
i = tot + current_x;;
for (fileptr = current->next; fileptr != NULL; fileptr = fileptr->next)
tot += strlen(fileptr->data) + 1;
i += current_x;
if (totlines > 0)
linepct = 100 * current->lineno / totlines;
else
linepct = 0;
if (totsize > 0)
bytepct = 100 * i / totsize;
else
bytepct = 0;
#ifdef DEBUG
fprintf(stderr, _("do_cursorpos: linepct = %f, bytepct = %f\n"),
@@ -1175,30 +1178,26 @@ int do_cursorpos(void)
But hey, it's better than nothing, and it's dynamic! */
int do_help(void)
{
#if !defined(NANO_SMALL) && !defined(DISABLE_HELP)
#ifndef DISABLE_HELP
char *ptr = help_text, *end;
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0;
int i, j, row = 0, page = 1, kbinput = 0, no_more = 0, kp;
int no_help_flag = 0;
/* Oh well, they've asked for the help menu, if the keypad is not on now
we're going to have to turn it on */
keypad_on(TRUE);
blank_edit();
curs_set(0);
blank_statusbar();
kp = keypad_on(edit, 1);
if (ISSET(NO_HELP)) {
/* Well if we're going to do this, we should at least
do it the right way */
no_help_flag = 1;
delwin(bottomwin);
bottomwin = newwin(3, COLS, LINES - 3, 0);
keypad(bottomwin, TRUE);
editwinrows -= no_help();
UNSET(NO_HELP);
window_init();
bottombars(help_list, HELP_LIST_LEN);
} else
bottombars(help_list, HELP_LIST_LEN);
@@ -1274,20 +1273,17 @@ int do_help(void)
kbinput != NANO_EXIT_FKEY);
if (no_help_flag) {
werase(bottomwin);
blank_bottombars();
wrefresh(bottomwin);
delwin(bottomwin);
SET(NO_HELP);
bottomwin = newwin(3 - no_help(), COLS, LINES - 3 + no_help(), 0);
keypad(bottomwin, TRUE);
editwinrows += no_help();
} else
display_main_list();
window_init();
}
display_main_list();
curs_set(1);
edit_refresh();
#elif defined(NANO_SMALL)
nano_small_msg();
kp = keypad_on(edit, kp);
#elif defined(DISABLE_HELP)
nano_disabled_msg();
#endif
@@ -1409,7 +1405,7 @@ void do_credits(void)
"Tedi Heriyanto",
"Bill Soudan",
"Christian Weisgerber",
"Erik Anderson",
"Erik Andersen",
"Big Gaute",
"Joshua Jensen",
"",
@@ -1472,3 +1468,23 @@ void do_credits(void)
total_refresh();
}
#endif
int keypad_on(WINDOW * win, int new)
{
/* This is taken right from aumix. Don't sue me */
#ifdef HAVE_USEKEYPAD
int old;
old = win->_use_keypad;
keypad(win, new);
return old;
#else
keypad(win, new);
return 1;
#endif /* HAVE_USEKEYPAD */
}