Compare commits

...

92 Commits

Author SHA1 Message Date
Chris Allegretta
f81d6fe8d3 GNU nano 2.2.3 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4482 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-02-11 06:13:55 +00:00
Chris Allegretta
1456a10ace 2010-01-28 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Fix for smooth mode not preserving cusor
          position.  Part one of fix for Savannah bug 21178 by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4481 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-29 03:40:58 +00:00
Chris Allegretta
8ff7f33c52 Back to SVN
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4480 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-19 00:05:49 +00:00
Chris Allegretta
3eacb857a1 GNU nano 2.2.2 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4478 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-18 03:47:40 +00:00
Chris Allegretta
2466d933c9 Compile fix with current_stat. Not sure how I missed that.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4477 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-18 03:43:24 +00:00
Chris Allegretta
4e621b5f6b Missed ChangeLog entry frm previous, must have been from wrong cwd
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4476 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-18 00:24:09 +00:00
Chris Allegretta
b916f5cd8b 2010-01-17 Chris Allegretta <chrisa@asty.org>
* nano.c (main), prompt.c (do_statusbar_input): Handle problems with an unmapped 
          function due to key rebinding, fixes crashes on FreeBSD repoted by Eitan 
          Adler <eitanadlerlist@gmail.com>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4475 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-17 05:30:22 +00:00
Chris Allegretta
6cf05d487f 2010-01-14 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Fix for crash / incorrect external modification warning
          due to earlier fix in r4467.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4474 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-14 06:32:37 +00:00
Chris Allegretta
1a7a91b779 2010-01-12 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Fix issues with not enough scrolling down/up
          and cursor centering.
        * winio.c (edit_scroll): Remove lots of needless checking of line length for
          soft wrapping code.
        * winio.c (edit_update) - Remove extra code for when updating with old_current outside
          of the new buffer boundary and centering issues.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4473 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-13 03:21:19 +00:00
Chris Allegretta
df8c3debc8 2010-01-05 Tito <farmatito@tiscali.it>
* search.c (update_history) - Fix bad length check causing search crash on armel platform.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4472 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-05 23:35:50 +00:00
Chris Allegretta
374216fe22 2010-01-04 Chris Allegretta <chrisa@asty.org>
* winio.c: edit_update, edit_redraw - Fix search not scrolling to the middle of the screen 
          (reported by alpha@qzx.com) and places where we rely on maxrows but should not.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4471 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2010-01-04 19:00:55 +00:00
Jordi Mallach
fc6ef3e1e8 doc/man/nano.1: Avoid a groff warning by prepending a zero-width space to a line starting with '.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4470 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-26 01:58:50 +00:00
Chris Allegretta
8d41fb8c3e 2009-12-22 Chris Allegretta <chrisa@asty.org>
* files.c (write_file): Fix compatibility with previous stat fix and tiny mode.

2009-12-22 David Lawrence Ramsey <pooka109@gmail.com>
        * global.c: Add new strings for forward/back in the file browser.  New variables
          nano_forwardfile_msg and nano_backfile_msg.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4469 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-23 05:03:09 +00:00
Chris Allegretta
3c7dda6e7e 2009-12-20 Chris Allegretta <chrisa@asty.org>
* files.c (is_file_writable): remove assert check for f, since it's not
          initialized at the time.  Fixes Savannah bug 28309, reported by Zoltan Kovacs.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4468 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-20 05:55:41 +00:00
Chris Allegretta
869aca4392 2009-12-20 Brian Szymanski <skibrianski via Savannah>
* src/files.c (write_file): Check stat struct exists, and if not use just obtained stat data.    
          Fixes Ubuntu bug 471568, "reproducible crash in nano on trying to save to a file 
          different than the one specified on the command line".



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4467 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-20 05:46:35 +00:00
Chris Allegretta
d9be86f45b 2009-12-15 Chris Allegretta <chrisa@asty.org>
* doc/nanorc.sample.in - Remove erroneous 'set suspendenable' as it's actually a 
          key binding (e.g. 'bind M-Z suspendenable all') and not a settable flag.  Fixes
          Savannah bug 28299 reported by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4466 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-15 18:07:17 +00:00
Chris Allegretta
9c0716a73a Oh snap, back to SVN.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4465 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-13 05:03:24 +00:00
Chris Allegretta
560a8cd0ec GNU nano 2.2.1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4463 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-13 03:31:00 +00:00
Chris Allegretta
a8bc492b8a 2009-12-12 Chris Allegretta <chrisa@asty.org>
* text.c (do_delete), nano.c (do_output): Add check for length of current line
          before and after adding/deleting text, and do full refresh if it is now
          a different multiple of COLS.  Also get rid of superfluous do_refresh
          vars now that we have edit_refresh_needed.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4462 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-12 22:21:20 +00:00
Chris Allegretta
f387f33083 2009-12-07 David Lawrence Ramsey <pooka109@gmail.com>
* global.c (shortcut_init), browser.c (do_browser): Fix M-W not being bound to 
          research in either main menu or browser.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4461 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-09 17:09:37 +00:00
Chris Allegretta
2c7b506fbc 2009-12-09 Chris Allegretta <chrisa@asty.org>
* files.c (read_file) - Add parameter for whether we should even try to check
          file writability, as the message is useless when we're inserting into an
          existing buffer.  Fixes Savannah bug 28219.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4460 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-09 16:51:43 +00:00
Chris Allegretta
5b25e07744 2009-12-07 David Lawrence Ramsey <pooka109@gmail.com>
* global.c (shortcut_init): Many fixes for keybindings code oversights, including
          restore page up/down and GotoDir to browser,
        * browser.c (do_browser): Fix breaking out of a submenu (e.g. gotodir) breaks out
          of browser altogether.
        * doc/nanorc.sample.in: Add missing entries for fortran/ObjC/OCaml entries.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4459 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-07 12:34:23 +00:00
Chris Allegretta
b27b3a18a9 2009-12-03 David Lawrence Ramsey <pooka109@gmail.com>
* global.c (shortcut_init) - Remove help shortcut from help shortcut list :-)  Tweaked
          to reorder exit shortcut to end of list to not mess up prev/next shortcut symmetry.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4458 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-04 04:29:55 +00:00
Chris Allegretta
96466166f1 2009-12-03 Eitan Adler <eitanadlerlist@gmail.com>
* doc/syntax/makefile.nanorc - Fix poor regex for all alpha characters which sometimes leads to
          error messages, reported by gibboris@gmail.com.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4457 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-04 03:46:04 +00:00
Chris Allegretta
671b2d974c Add --disable-wrapping to nano-regress
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4456 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-03 03:20:24 +00:00
Chris Allegretta
c9f0799791 2009-12-02 Chris Allegretta <chrisa@asty.org>
* text.c (add_undo, do_undo, do_redo) - Do not execute cases for SPLIT when DISABLE_WRAPPING
          is defined.  Fixes Savannah bug 28151 (anon).



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4455 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-03 03:12:00 +00:00
Jordi Mallach
42a390416e Fix escaping of hyphens for the -$ option.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4454 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-02 22:47:57 +00:00
Chris Allegretta
8a07a96eef 2009-12-01 David Lawrence Ramsey <pooka109@gmail.com>
* Update documentation for 2.2 features including sample nanorc file, texinfo
          file, man pages, UPGRADE file, and update copyright noticed for the current year.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4453 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-02 03:36:22 +00:00
Chris Allegretta
a97cb819f2 2009-12-01 Kamil Dudka <kdudka@redhat.com>
* chars.c, file.c - Better handle unused results for things like mbtowc(), new
          macro IGNORE_CALL_RESULT.

2009-12-01 Chris Allegretta <chrisa@asty.org>
        * global.c (shortcut_init) - Remove redundant entries for ^Y/^V reported by
          Christian Weisgerber.
        * doc/man/nanorc.5 - Fix typo in Meta documentation, reported by gibboris@gmail.com.

2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
        * global.c (shortcut_init) - Add support for ^P and ^N in the help menu.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4452 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-12-02 03:24:18 +00:00
Chris Allegretta
cb9a5bed8e GNU nano 2.2.0 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4450 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-30 05:26:30 +00:00
Chris Allegretta
b43f6912f3 2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
* global.c: Fix replace and insert file initializations for proper compilation options.
        * nano.c (do_suspend): Update comments to reflect actual code path, bad Chris and thanks for 
          noticing Jordi.   
        * configure.ac: Fix typos



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4449 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-29 06:24:10 +00:00
Chris Allegretta
5a018f0d3a 2009-11-29 Chris Allegretta <chrisa@asty.org>
* prompt.c (get_prompt_string) - Universally handle help key when is disabled.  Fixes Savannah
          bug 28117 by David Lawrence Ramsey <pooka109@gmail.com>.
        * chars.c, files.c: Add junk vars to silence the compiler.  Sigh.

2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
        * Change several *chars to const char, additional cleanups and casts to make compilers happier.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4448 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-29 06:13:22 +00:00
Chris Allegretta
752830573a * doc/dyntax/makefile.nanorc - Sample Makefile highlighting based on wiki.linuxhelp.net version.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4447 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-28 04:11:04 +00:00
Chris Allegretta
daaf468c93 2009-11-27 Chris Allegretta <chrisa@asty.org>
* nano.c (do_suspend): Don't clear the screen but do move the cursor down to the last line
          first in an effort to not corrupt the screen, which contradicts Pico but is consistent
          with almost all other text editors.  Fixes Savannah bug 28110/Debian bug 460510
          reported by Tim Connors <reportbug@rather.puzzling.org>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4446 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-28 03:01:30 +00:00
Chris Allegretta
dcf5cbbf6a * rcfile.c (parse_rcfile), initialize size argument to getline(), fixes crash on FreeBSD
reported by Eitan Adler <eitanadlerlist@gmail.com>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4445 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-27 05:09:56 +00:00
Chris Allegretta
3b830ee194 2009-11-26 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_scroll): Adjust for long lines when scrolling.                    



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4444 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-27 03:04:59 +00:00
Chris Allegretta
d753efdb55 2009-11-26 Jordi Mallach <jordi@gnu.org>
* doc/man/*: Update all man pages to escape unescapred hyphens.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4443 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-27 02:50:12 +00:00
Chris Allegretta
c9199e9e9a Simplify logic in do_down() since we now have maxrows to rely on.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4442 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-26 18:23:00 +00:00
Chris Allegretta
e2df2c899d 2009-11-24 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Make these functions work better with soft
          line wrapping. 
        * winio.c (compute_maxrows): Make maxrows calculation more accurate when all lines are > COLS.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4441 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-24 17:15:53 +00:00
Chris Allegretta
c82f038855 Part 2 of David's fixes for David's bug 71 fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4440 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 23:23:31 +00:00
Chris Allegretta
8b6f6fcc1b 2009-11-22 Chris Allegretta <chrisa@asty.org>
* nano.c (main): Allow edit_refresh_needed to take effect when using --enable-tiny
          (fixes Savannah bug 28076 reported by David Lawrence Ramsey).

2009-11-22 David Lawrence Ramsey <pooka109@gmail.com>
        * nano.c (move_to_filestruct): Fix bug 71 (cut at top of line recenters)
        * Fix compilation with --enable-tiny



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4439 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 21:35:56 +00:00
Chris Allegretta
0bff84ef9c 2009-11-22 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/gentoo.nanorc: Tweak comment highlighting.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4438 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 16:36:53 +00:00
Chris Allegretta
6277f59d24 Back to SVN!
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4437 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 02:52:23 +00:00
Chris Allegretta
6c3d886424 GNU nano 2.1.99pre2 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4435 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 02:49:39 +00:00
Chris Allegretta
879dfbaf40 * prompt.c (update_statusbar_line): Set statusbar_pww when updating the line.
Fixes Savannah bug 24957 by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4434 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-21 17:12:28 +00:00
Chris Allegretta
e9dee887a9 2009-11-21 Chris Allegretta <chrisa@asty.org>
* rcfile.c: Add unbinding keyword, fixes Savannah bug 22852 reported by frankd.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4433 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-21 16:26:59 +00:00
Chris Allegretta
123110c5dc 2009-11-19 Chris Allegretta <chrisa@asty.org>
* nano.c (die_save_file) Try nd match the permissions of the file we were
          editing but only make a minimal effort to do so. Fixes Savannah bug 27273     
          reported by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4432 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-20 05:09:12 +00:00
Chris Allegretta
cbba77558e Typo fix part 2, noticed by j.mader@gmail.com.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4431 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-18 22:10:13 +00:00
Chris Allegretta
e350d7a52a Back to svn, oops.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4430 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-18 21:34:09 +00:00
Chris Allegretta
16e07d5878 2009-11-18 Adrian Bunk <bunk via Savannah>
* nano.c (main) - Allow --fill and --nowrap to override nanorc entries and each other
          on the command line.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4429 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-18 12:39:47 +00:00
Chris Allegretta
8c1edd17e3 Further fixes, also fix some page/up down issues where we go way off course.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4428 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-16 04:28:40 +00:00
Chris Allegretta
fc48347fb8 2009-11-15 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_refresh): Always computer maxsize regardless of whether smooth scrolling
          is enabled.  Fixes Savannah bug 28024 by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4427 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-16 00:15:45 +00:00
Chris Allegretta
2cd2d4b9ae GNU nano 2.1.99pre1 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4425 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-15 06:20:21 +00:00
Chris Allegretta
533b9fa827 * files.c (do_writeout) - Only mention file modification if we're writing the same
file we originally opened.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4424 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-14 20:06:24 +00:00
Chris Allegretta
f9d4fd3755 2009-11-14 Chris Allegretta <chrisa@asty.org>
* move.c (do_first_line, do_last_line): Just set edit_refresh_needed rather than 
          get messy.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4423 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-14 19:57:38 +00:00
Chris Allegretta
f55ada727e * nano.c (do_mouse): Fix mouse support not working with soft wrapping. Fixes
Savannah bug 27549 reported by Hannes Schueller.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4422 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-13 20:38:32 +00:00
Chris Allegretta
99c8d40db1 2009-11-13 Chris Allegretta <chrisa@asty.org>
* winio.c: Add new static maxsize to be able to easier calculation with
          softwrap.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4421 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-13 13:48:56 +00:00
Chris Allegretta
6f08332741 2009-11-11 Chris Allegretta <chrisa@asty.org>
* winio.c: Large tweaking of cursor and text display based on COLS not COLS - 1,
          due to finally understanding that display_string wasn't being called properly
          when softwrap was enabled.  Fixes Savnnah bug 27603, Return key doesn't scroll
          viewport reported by Hannes Schueller.
        * - Fix size_t formatting issues with -pedantic by converting vals to long unsigned
          for printing.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4420 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-11 06:00:33 +00:00
Chris Allegretta
a60910cc54 Better fix, remove unneeded closecode variable and update bug credit.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4419 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-10 03:44:12 +00:00
Chris Allegretta
7be32046b0 2009-11-09 Chris Allegretta <chrisa@asty.org>
* files.c (read_file): - Remove debugging messages from file load  



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4418 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-10 02:46:17 +00:00
Chris Allegretta
795be590d5 2009-11-07 Chris Allegretta <chrisa@asty.org>
* nano.h - Add bogus value at begin of flags enumeration because it
          causes casesens rcfile option to misbehave, reported by Helmut 
          Jarausch <jarausch@igpm.rwth-aachen.de>



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4417 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-07 16:56:17 +00:00
Chris Allegretta
3aad8ab9aa * rcfile.c - Add in specific check for UNDOABLE and fix declaration as
to what flag it toggles.  Fixes undo mode being able to be called from
          the rc file, reported by Helmut Jarausch <jarausch@igpm.rwth-aachen.de>



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4416 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-03 19:31:17 +00:00
Chris Allegretta
1d461475ce 2009-11-03 Chris Allegretta <chrisa@asty.org>
* nano.h - Fix comma at end of enumerator list which angers -pedantic.

2009-11-03 Mike Frysinger <vapier@gentoo.org>
        * files.c - Move up is_file_writable() to stop implicit definition complaints.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4415 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-03 18:47:39 +00:00
Chris Allegretta
a535cecd77 2009-10-27 Chris Allegretta <chrisa@asty.org>
* browser.c (browser_init): Set column width to something sane when 
          initializing in a directory with no file entries.  Fixes Savannah
          bug 24163 found (and initial patch) by Paul Wise.  



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4414 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-10-27 04:09:27 +00:00
Chris Allegretta
d233e7e240 back to svn, and:
* winio.c: Clean up some unused variables from the soft wrapping code.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4413 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-09-15 04:51:09 +00:00
Chris Allegretta
1f218fa859 GNU nano 2.1.11 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4411 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-09-15 03:50:17 +00:00
Chris Allegretta
91e05e64a0 Add softwrap and undo into the sample .nanorc.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4410 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-09-14 21:38:53 +00:00
Chris Allegretta
35afab5eba 2009-09-12 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_update) - properly update edittop when using soft wrapping.
          Fixes lack of centering for searching for off-screen answers, found by
          Hannes <mr_creosote@mutantwatch.de>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4409 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-09-13 04:50:44 +00:00
Chris Allegretta
bce7d404d9 2009-09-03 Chris Allegretta <chrisa@asty.org>
* global.c (shortcut_init): Fix up/down keys not responding in the file browser,
          discovered by Hannes <mr_creosote@mutantwatch.de>.
        * move.c (do_up) - Fix another scrolling issue with softwrap when the
          cursor is beyond COLS, discovered by Hannes <mr_creosote@mutantwatch.de>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4408 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-09-03 23:29:14 +00:00
Chris Allegretta
f8f9027295 2009-09-02 Chris Allegretta <chrisa@asty.org>
* Attempt to check file writability and emit a warning on the status bar
          if nano doesn't think the file can be written to.  Feature originally
          requested by Damien Jolders <madamien@skullsquad.com> et al.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4407 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-09-03 05:45:13 +00:00
Chris Allegretta
5687c3dfa6 Fix regular scrolling with softwrap enabled too. Stop trying to be clever and just
figure out if we need to bail and call edit_refresh().



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4406 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-09-03 02:48:35 +00:00
Chris Allegretta
139934a236 2009-08-29 Chris Allegretta <chrisa@asty.org>
* Fix more soft wrapping issues, particularly with soft scrolling,
          discovered by Hannes <mr_creosote@mutantwatch.de>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4405 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-08-30 03:50:16 +00:00
Chris Allegretta
3de025f8f4 2009-08-19 Chris Allegretta <chrisa@asty.org>
* Fix issue with soft wrapping not displaying the last character of each line,
	  fixed bug discovered by Hannes <mr_creosote@mutantwatch.de>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4404 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-08-19 05:38:07 +00:00
Chris Allegretta
308a7b029d 2009-08-17 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/(gentoo|sh|tcl).nanorc: Fix problems with empty regexes on POSIX.
	  Fixes Savannah bug 27175.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4403 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-08-18 02:55:22 +00:00
Chris Allegretta
05417a2444 2009-08-17 Chris Allegretta <chrisa@asty.org>
* Initial soft line wrapping implementation.  Command line flags
          -$ or --softwrap.
        * nano.c, text.c: Clean up some fprintf warnings in debug mode due to printing
          a size_t without using the zd specifier.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4402 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-08-17 07:52:10 +00:00
Chris Allegretta
13dde2bda4 Back to SVN version
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4401 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-08-15 02:54:35 +00:00
Chris Allegretta
a48507d32a 2009-08-13 Chris Allegretta <chrisa@asty.org>
* New global flag implementation courtesy of Adam Wysocki <gophi@arcabit.pl>, allows
 	  previous undo flag to be implemented consistent with other flags.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4400 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-08-14 03:18:29 +00:00
Chris Allegretta
7f38820fba GNU nano 2.1.10 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4398 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-07-28 05:08:35 +00:00
Chris Allegretta
42726f74cc 2009-07-27 Chris Allegretta <chrisa@asty.org>
* text.c (undo_cut, redo_cut): Don't actually try and undo/redo an empty cut, i.e. the magicline. 
	  Fixes crash on cutting last line discovered by Eitan Adler <eitanadlerlist@gmail.com>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4397 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-07-27 04:16:44 +00:00
Chris Allegretta
0a10e20eec Add in rcfile support for undo since it would be bad to overly punish the masochists who want to try it out and hopefully submit bug reports.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4396 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-07-12 06:13:36 +00:00
Chris Allegretta
ad37e67dd2 2009-07-11 Chris Allegretta <chrisa@asty.org>
* nano-regress: Small tweaks
	* Change undo code to off unless unabled via a command line option (-u/--undo).  Until this code
	  stabilizes this is the only responsible way to treat it.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4395 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-07-12 03:36:58 +00:00
Chris Allegretta
a4c2b99e40 More wrapping redo fixes. Just make do-wrap() undo aware.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4394 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-04-29 22:34:27 +00:00
Chris Allegretta
8b9fb360c2 Comimt point for roll-back of latest undo/redo of split changes.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4393 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-04-29 04:43:58 +00:00
Chris Allegretta
e061a0d604 Add undoing check for do_enter so redo doesn't blow up.
Hate to piecemeal these fixed but system unstability is teh suck.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4392 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-04-25 03:31:30 +00:00
Chris Allegretta
b843a51b79 Add undo for line break via enter, separate from line wrap
Change message for line split to line wrap, since split ~= break



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4391 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-04-21 05:34:08 +00:00
Chris Allegretta
df543e78df - Remove a debug line I left in
- Fix undo line split uglyness.  Still not perfect but switching work envs.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4390 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-04-12 06:13:16 +00:00
Chris Allegretta
12ba55732f First pass at fixing the line splitting undo since it's currently broken beyond belief.
I believe more is broken but committing will motivate me to get closer to a real fix :)



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4389 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-03-26 01:01:48 +00:00
Chris Allegretta
55ca1028ac 2009-03-08 Chris Allegretta <chrisa@asty.org>
* TODO - Break out some targets for various features into 2.2
          and 2.4 series for things which are feasible.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4388 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-03-09 02:04:40 +00:00
Chris Allegretta
5a3464b57b 2009-02-28 Chris Allegretta <chrisa@asty.org>
* configure.ac: Add check for whether _XOPEN_SOURCE_EXTENDED is needed for 
          curses to work w/color.  Fixes compilation on HP-UX with older GCC, 
          reported by jay.krell@cornell.edu.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4387 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-03-01 00:50:19 +00:00
Chris Allegretta
fb6446d826 2009-02-23 Eitan Adler <eitanadlerlist@gmail.com>
* doc/man/Makefile.am: Fix make variable substitution to be more portable

2009-02-23 Chris Allegretta <chrisa@asty.org>
	* doc/man/fr/Makefile.am: Add groff check fix to fr files.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4386 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-02-25 05:06:05 +00:00
Chris Allegretta
f86fa86089 2009-02-23 Chris Allegretta <chrisa@asty.org>
* rcfile.c (parse_keybinding) - Define a var before tryung to use it.  Whoops!
	* fix some redefinitions causing compiler warnings, from Eitan Adler.  Other
	  (hopefully) fixes for uncasted malloc()s, reported by the same.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4385 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-02-25 04:32:15 +00:00
Chris Allegretta
5ba7a93b1a back to SVN, and add header on ChangeLog since I forgot (and its not worth fixing for the release)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4384 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-02-17 04:31:04 +00:00
70 changed files with 16482 additions and 13553 deletions

2
BUGS
View File

@@ -1,5 +1,4 @@
** Open BUGS **
- Cutting the line at the top of the screen recenters to center (71)
** Fixed BUGS **
- Marked cutting sometimes leaves a newline in the file unintelligently,
@@ -156,6 +155,7 @@
assigned to it (79 - may not be worth fixing) [FIXED]
- Segfault editing at COLS presumably due to new color syntax
highlighting (80) [FIXED]
- Cutting the line at the top of the screen recenters to center (71) [FIXED]
$Id$

284
ChangeLog
View File

@@ -1,3 +1,287 @@
GNU nano 2.2.3 - 2010.02.11
2010-01-28 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Fix for smooth mode not preserving cusor
position. Part one of fix for Savannah bug 21178 by Mike Frysinger.
GNU nano 2.2.2 - 2010.01.17
2010-01-17 Chris Allegretta <chrisa@asty.org>
* nano.c (main), prompt.c (do_statusbar_input): Handle problems with an unmapped
function due to key rebinding, fixes crashes on FreeBSD repoted by Eitan
Adler <eitanadlerlist@gmail.com>.
2010-01-14 Chris Allegretta <chrisa@asty.org>
* files.c (do_writeout): Fix for crash / incorrect external modification warning
due to earlier fix in r4467.
2010-01-12 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Fix issues with not enough scrolling down/up
and cursor centering.
* winio.c (edit_scroll): Remove lots of needless checking of line length for
soft wrapping code.
* winio.c (edit_update) - Remove extra code for when updating with old_current outside
of the new buffer boundary and centering issues.
2010-01-05 Tito <farmatito@tiscali.it>
* search.c (update_history): Fix bad length check causing search crash on armel platform.
2010-01-04 Chris Allegretta <chrisa@asty.org>
* winio.c: edit_update, edit_redraw: Fix search not scrolling to the middle of the screen
(reported by alpha@qzx.com) and places where we rely on maxrows but should not.
2009-12-26 Jordi Mallach <jordi@gnu.org>
* doc/man/nano.1: Avoid a groff warning by prepending a zero-width
space to a line starting with '.
2009-12-22 Chris Allegretta <chrisa@asty.org>
* files.c (write_file): Fix compatibility with previous stat fix and tiny mode.
2009-12-22 David Lawrence Ramsey <pooka109@gmail.com>
* global.c: Add new strings for forward/back in the file browser. New variables
nano_forwardfile_msg and nano_backfile_msg.
2009-12-20 Chris Allegretta <chrisa@asty.org>
* files.c (is_file_writable): remove assert check for f, since it's not
initialized at the time. Fixes Savannah bug 28309, reported by Zoltan Kovacs.
2009-12-20 Brian Szymanski <skibrianski via Savannah>
* src/files.c (write_file): Check stat struct exists, and if not use just obtained stat data.
Fixes Ubuntu bug 471568, "reproducible crash in nano on trying to save to a file
different than the one specified on the command line".
2009-12-15 Chris Allegretta <chrisa@asty.org>
* doc/nanorc.sample.in - Remove erroneous 'set suspendenable' as it's actually a
key binding (e.g. 'bind M-Z suspendenable all') and not a settable flag. Fixes
Savannah bug 28299 reported by Mike Frysinger.
GNU nano 2.2.1 - 2009.12.12
2009-12-12 Chris Allegretta <chrisa@asty.org>
* text.c (do_delete), nano.c (do_output): Add check for length of current line
before and after adding/deleting text, and do full refresh if it is now
a different multiple of COLS. Also get rid of superfluous do_refresh
vars now that we have edit_refresh_needed.
2009-12-09 David Lawrence Ramsey <pooka109@gmail.com>
* global.c (shortcut_init), browser.c (do_browser): Fix M-W not being bound to
research in either main menu or browser.
2009-12-09 Chris Allegretta <chrisa@asty.org>
* files.c (read_file) - Add parameter for whether we should even try to check
file writability, as the message is useless when we're inserting into an
existing buffer. Fixes Savannah bug 28219.
2009-12-07 David Lawrence Ramsey <pooka109@gmail.com>
* global.c (shortcut_init): Many fixes for keybindings code oversights, including
restore page up/down and GotoDir to browser,
* browser.c (do_browser): Fix breaking out of a submenu (e.g. gotodir) breaks out
of browser altogether.
* doc/nanorc.sample.in: Add missing entries for fortran/ObjC/OCaml entries.
2009-12-03 David Lawrence Ramsey <pooka109@gmail.com>
* global.c (shortcut_init) - Remove help shortcut from help shortcut list :-) Tweaked
to reorder exit shortcut to end of list to not mess up prev/next shortcut symmetry.
2009-12-03 Eitan Adler <eitanadlerlist@gmail.com>
* doc/syntax/makefile.nanorc - Fix poor regex for all alpha characters which sometimes leads to
error messages, reported by gibboris@gmail.com.
2009-12-02 Chris Allegretta <chrisa@asty.org>
* text.c (add_undo, do_undo, do_redo) - Do not execute cases for SPLIT when DISABLE_WRAPPING
is defined. Fixes Savannah bug 28151 (anon).
2009-12-02 Jordi Mallach <jordi@gnu.org>
* doc/man/nano.1: Fix escaping of hyphens for the -$ option.
2009-12-01 Kamil Dudka <kdudka@redhat.com>
* chars.c, file.c - Better handle unused results for things like mbtowc(), new
macro IGNORE_CALL_RESULT.
2009-12-01 Chris Allegretta <chrisa@asty.org>
* global.c (shortcut_init) - Remove redundant entries for ^Y/^V reported by
Christian Weisgerber.
* doc/man/nanorc.5 - Fix typo in Meta documentation, reported by gibboris@gmail.com.
2009-12-01 David Lawrence Ramsey <pooka109@gmail.com>
* global.c (shortcut_init) - Add support for ^P and ^N in the help menu.
* Update documentation for 2.2 features including sample nanorc file, texinfo
file, man pages, UPGRADE file, and update copyright noticed for the current year.
GNU nano 2.2.0 - 2009.11.30
2009-11-29 Chris Allegretta <chrisa@asty.org>
* prompt.c (get_prompt_string) - Universally handle help key when is
disabled. Fixes Savannah
bug 28117 by David Lawrence Ramsey <pooka109@gmail.com>.
* chars.c, files.c: Add junk vars to silence the compiler. Sigh.
2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
* Change several *chars to const char, additional cleanups and casts to make compilers happier.
* global.c: Fix replace and insert file initializations for proper compilation options.
* nano.c (do_suspend): Update comments to reflect actual code path, bad Chris and thanks for
noticing Jordi.
* configure.ac: Fix typos
2009-11-27 Chris Allegretta <chrisa@asty.org>
* nano.c (do_suspend): Don't clear the screen but do move the cursor down to the last line
first in an effort to not corrupt the screen, which contradicts Pico but is consistent
with almost all other text editors. Fixes Savannah bug 28110/Debian bug 460510
reported by Tim Connors <reportbug@rather.puzzling.org>.
* doc/dyntax/makefile.nanorc - Sample Makefile highlighting based on wiki.linuxhelp.net version.
2009-11-26 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_scroll): Adjust for long lines when scrolling.
* rcfile.c (parse_rcfile), initialize size argument to getline(), fixes crash on FreeBSD
reported by Eitan Adler <eitanadlerlist@gmail.com>.
2009-11-26 Jordi Mallach <jordi@gnu.org>
* doc/man/*: Update all man pages to escape unescaped hyphens.
2009-11-24 Chris Allegretta <chrisa@asty.org>
* move.c (do_page_up, do_page_down): Make these functions work better with soft
line wrapping.
* winio.c (compute_maxrows): Make maxrows calculation more accurate when all lines are > COLS.
2009-11-22 Chris Allegretta <chrisa@asty.org>
* nano.c (main): Allow edit_refresh_needed to take effect when using --enable-tiny
(fixes Savannah bug 28076 reported by David Lawrence Ramsey).
2009-11-22 David Lawrence Ramsey <pooka109@gmail.com>
* nano.c (move_to_filestruct): Fix bug 71 (cut at top of line recenters)
* Fix compilation with --enable-tiny
2009-11-22 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/gentoo.nanorc: Tweak comment highlighting.
GNU nano 2.1.99pre2 - 2009.11.21
2009-11-21 Chris Allegretta <chrisa@asty.org>
* rcfile.c: Add unbinding keyword, fixes Savannah bug 22852 reported by frankd.
* prompt.c (update_statusbar_line): Set statusbar_pww when updating the line.
Fixes Savannah bug 24957 by Mike Frysinger.
2009-11-19 Chris Allegretta <chrisa@asty.org>
* nano.c (die_save_file) Try nd match the permissions of the file we were
editing but only make a minimal effort to do so. Fixes Savannah bug 27273
reported by Mike Frysinger.
2009-11-18 Adrian Bunk <bunk via Savannah>
* nano.c (main): Allow --fill and --nowrap to override nanorc entries and each other
on the command line.
2009-11-15 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_refresh): Always computer maxsize regardless of whether smooth scrolling
is enabled. Fixes Savannah bug 28024 by Mike Frysinger.
GNU nano 2.1.99pre1 - 2009.11.15
2009-11-14 Chris Allegretta <chrisa@asty.org>
* move.c (do_first_line, do_last_line): Just set edit_refresh_needed rather than
get messy.
* files.c (do_writeout) - Only mention file modification if we're writing the same
file we originally opened.
2009-11-13 Chris Allegretta <chrisa@asty.org>
* winio.c: Add new static maxsize to be able to easier calculation with
softwrap.
* nano.c (do_mouse): Fix mouse support not working with soft wrapping. Fixes
Savannah bug 27549 reported by Hannes Schueller.
2009-11-11 Chris Allegretta <chrisa@asty.org>
* winio.c: Large tweaking of cursor and text display based on COLS not COLS - 1,
due to finally understanding that display_string wasn't being called properly
when softwrap was enabled. Fixes Savnnah bug 27603, Return key doesn't scroll
viewport reported by Hannes Schueller.
* - Fix size_t formatting issues with -pedantic
2009-11-09 Chris Allegretta <chrisa@asty.org>
* files.c (read_file): - Remove debugging messages from file load. Fixes
Savannah bug 27838.
2009-11-07 Chris Allegretta <chrisa@asty.org>
* nano.h - Add bogus value at begin of flags enumeration because it
causes casesens rcfile option to misbehave, reported by Helmut
Jarausch <jarausch@igpm.rwth-aachen.de>
2009-11-03 Chris Allegretta <chrisa@asty.org>
* nano.h - Fix comma at end of enumerator list which angers -pedantic.
* rcfile.c - Add in specific check for UNDOABLE and fix declaration as
to what flag it toggles. Fixes undo mode being able to be called from
the rc file, reported by Helmut Jarausch <jarausch@igpm.rwth-aachen.de>
2009-11-03 Mike Frysinger <vapier@gentoo.org>
* files.c - Move up is_file_writable() to stop implicit definition complaints.
2009-10-27 Chris Allegretta <chrisa@asty.org>
* browser.c (browser_init): Set column width to something sane when
initializing in a directory with no file entries. Fixes Savannah
bug 24163 found (and initial patch) by Paul Wise.
2009-09-15 Chris Allegretta <chrisa@asty.org>
* winio.c: Clean up some unused variables from the soft wrapping code.
GNU nano 2.1.11 - 2009.09.14
2009-09-12 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_update) - properly update edittop when using soft wrapping.
Fixes lack of centering for searching for off-screen answers, found by
Hannes <mr_creosote@mutantwatch.de>.
2009-09-03 Chris Allegretta <chrisa@asty.org>
* global.c (shortcut_init): Fix up/down keys not responding in the file browser,
discovered by Hannes <mr_creosote@mutantwatch.de>.
* move.c (do_up) - Fix another scrolling issue with softwrap when the
cursor is beyond COLS, discovered by Hannes <mr_creosote@mutantwatch.de>.
2009-09-02 Chris Allegretta <chrisa@asty.org>
* Attempt to check file writability and emit a warning on the status bar
if nano doesn't think the file can be written to. Feature originally
requested by Damien Jolders <madamien@skullsquad.com> et al.
2009-08-29 Chris Allegretta <chrisa@asty.org>
* Fix more soft wrapping issues, particularly with scrolling,
discovered by Hannes <mr_creosote@mutantwatch.de>.
2009-08-19 Chris Allegretta <chrisa@asty.org>
* Fix issue with soft wrapping not displaying the last character of each line,
fixed bug discovered by Hannes <mr_creosote@mutantwatch.de>.
2009-08-17 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/(gentoo|sh|tcl).nanorc: Fix problems with empty regexes on POSIX.
Fixes Savannah bug 27175.
2009-08-17 Chris Allegretta <chrisa@asty.org>
* Initial soft line wrapping implementation. Command line flags
-$ or --softwrap.
* nano.c, text.c: Clean up some fprintf warnings in debug mode due to printing
a size_t without using the zd specifier.
2009-08-13 Chris Allegretta <chrisa@asty.org>
* New global flag implementation courtesy of Adam Wysocki <gophi@arcabit.pl>, allows
previous undo flag to be implemented consistent with other flags.
GNU nano 2.1.10 - 2009.07.28
2009-07-27 Chris Allegretta <chrisa@asty.org>
* text.c (undo_cut, redo_cut): Don't actually try and undo/redo an empty cut, i.e. the magicline.
Fixes crash on cutting last line discovered by Eitan Adler <eitanadlerlist@gmail.com>.
2009-07-11 Chris Allegretta <chrisa@asty.org>
* nano-regress: Small tweaks
* Change undo code to off unless unabled via a command line option (-u/--undo). Until this code
stabilizes this is the only responsible way to treat it.
2009-03-08 Chris Allegretta <chrisa@asty.org>
* TODO - Break out some targets for various features into 2.2
and 2.4 series for things which are feasible.
2009-02-28 Chris Allegretta <chrisa@asty.org>
* configure.ac: Add check for whether _XOPEN_SOURCE_EXTENDED is needed for
curses to work w/color. Fixes compilation on HP-UX with older GCC,
reported by jay.krell@cornell.edu.
2009-02-23 Eitan Adler <eitanadlerlist@gmail.com>
* doc/man/Makefile.am: Fix make variable substitution to be more portable
2009-02-23 Chris Allegretta <chrisa@asty.org>
* rcfile.c (parse_keybinding) - Define a var before tryung to use it. Whoops!
* fix some redefinitions causing compiler warnings, from Eitan Adler. Other
(hopefully) fixes for uncasted malloc()s, reported by the same.
* doc/man/fr/Makefile.am: Add groff check fix to fr files.
GNU nano 2.1.9 - 2009.02.16
2009-02-16 Chris Allegretta <chrisa@asty.org>
* Add new argument to reset_multis for force redraws without attempting to
guess whether we need to, for functions that we don't have good info about

108
NEWS
View File

@@ -1,3 +1,111 @@
2010.02.11 - GNU nano 2.2.3 "fumbling toward stability" is released.
This release contains a fix for only one bug, but a
rather irritating one: when paging up/down with smooth
scrolling, the cursor position was not being preserved
due to a bug in 2.2.2. With such a targeted fix
like this what could POSSIBLY go WRONG? Hahaha.
Enjoy and if you find new bugs, as always please
use Savannah's bug tracker.
http://savannah.gnu.org/bugs/?func=additem&group=nano
2010.01.17 - GNU nano 2.2.2 is released for you, you, you. This
release includes fixes for: crashed when writing
backup files in certain conditions, improper
screen centering when moving up/down in various
combination of smooth scrolling and soft wrapping modes,
a search crash on the armel arch, and issues with
lots of keybinding customizations causing crashing
particularly on FreeBSD. Also included are better
help menu entries for forward/back in the file browser,
some man page tweaks and one assert fix. As always,
share and enjoy!
2009.12.12 - GNU nano 2.2.1 "DLR strikes back" is open for business.
This release fixes many bugs, including: missing
keybindings for page up/down and GotoDir in the browser,
^P/^N in the help menu, and restoration of M-W as the
default re-search binding. Other fixes include several
issues with compiler warnings and configure options, and
documentation updates, including the nano texinfo manual,
nano and nanorc man pages, and UPGRADE file, and some
missing syntax highliting entries for the saple nanorc.
And no release would be complete without the latest round
of 'final' soft wrapping fixes! Finally, nano will no
longer print a warning when attempting to insert the
contents of a read-only file into an existing buffer.
Enjoy and Happy Hanukkah.
2009.11.30 - GNU nano 2.2.0 "Doc Brown" is released! The culmination
of almost two years of development and hot on the heels
of nano's 10th birthday is available for all your
editing needs! Bugs fixed since the last release
include several fixes for tiny mode (involving both
the help keys and replace menu text), more 'final'
fixes for soft wrapping, and several typo and documentation
updates including nanorc tweaks and a new syntax
highlighting file for makefiles. Also included is a long
standing fix for random crashing when using nanorc on
FreeBSD, and nano will no longer clear the screen on
suspend to maintain compatibility with other *nix editors.
For those who haven't been playing along at home, please
see the official web page for the summary of new
features since 2.0. Special thanks to all who have
submitted bug reports recently in support of our new
stable release, and apologies for all those bugs we
didn't yet find :-) Peace to all.
2009.11.21 - GNU nano 2.1.99pre2 is available for a special pre-Black
Friday discount. Included are some (hopefully
final) fixes for issues with last page display
caused by the soft wrapping code, and a fix for
a long standing issue with hittig the home key when
going through the search history. On the features
front, nano will now attempt to retain the proper
ownership and permissions when trying to create a
.save file due to receiving a signal. Nano can also
now unbind keys from one or more menus via the 'unbind'
keyword. Finally, passing --fill or --nowrap on
the command line will now override any related
.nanorc entries. Speak now or forever hold your bugs!
2009.11.15 - GNU nano 2.1.99pre1 "take a bow" is out there, man, it's
out there all right. This release contains mainly
bugfixes, underscoring that we are preparing for the
next stable series release. Included are many fixes
for the new soft wrapping code, compiler warning tweaks,
and the modification time warning no longer triggers
when saving a file as a new name. Also include are
some fixes for various nanorc options, and there are
surely more bugs to find before we call the code base
stable, so please keep those reports coming!
2009.09.14 - GNU nano 2.1.11 is on very thin ice, very thin ice, very thin
ice. This release includes two new features: first, nano
will check whether the current file is writable when it
is opened, and warn if it is not on the status bar. Secondly,
a new soft-wrapping (AKA full line display) option is
available, which will attempt to fully display the contents
of lines longer than the width of the screen without the
usual truncation and a '$' symbol at the end of the line.
It can be enabled via Meta-$ inside the editor, via the
-$ or --softwrap command line flags, or "set softwrap"
in your .nanorc). As always please report any bugs to the
nano Savannah project page
(http://savannah.gnu.org/bugs/?func=additem&group=nano)
Remember: data loss happens, back up your files.
2009.07.28 - GNU nano 2.1.10 "Ellie" is released. This version includes
various fixes for portability including some older HP-UX
compiler combos, various compiler warnings, and some crash
fixes in the undo code. On the topic of the latter item,
the undo code is now marked as experimental since it can
cause severe stability and memory issues, and thus now
requires a flag (-u, --undo) in order to enable it.
Please feel free to continue to test the undo code and
thanks again for using nano for your text editing needs.
Go team Nano!
2009.02.16 - GNU nano 2.1.9 wonders what all that glass is doing on the
floor! This release is primarily meant as a less buggy
version of 2.1.8, particularly for issues with the new

50
TODO
View File

@@ -1,9 +1,9 @@
TODO file (? means the feature may be implemented, but not definitely)
------------------------------------------------------------------------
For the next version:
- Undo/Redo keys (M-U and M-E)?
- Rebindable keys?
For the future (no targeted version, catch-all)
- Compatibility with vi/emacs status files so we can let other editors
know we're in a file?
- FriBidi support?
- Port to DJGPP?
- Make matching bracket searches sophisticated enough to skip over
@@ -11,37 +11,43 @@ For the next version:
- Allow indentation of marked text by spaces as well as tabs?
- Allow indentation to add just enough columns to reach the nearest
multiple of tabsize, rather than always adding tabsize columns?
- Allow piping marked text to an external command and replacing it with
the command's output (as the internal spell checker already does with
the "spell" command)?
- Rewrite the nano FAQ in SGML.
- Allow conversion between different character sets. Maybe use glib's
iconv() if the system's iconv() is inadequate, since we already use
glib's vsnprintf() if the system lacks vsnprintf()?
- Handle window resizes better. After we resize, we should stay
wherever we were before we resized, as Pico does.
- Fix problems with color syntaxes' highlighting lines too aggressively.
- Allow color syntaxes to apply to more than just color, so that we can
e.g. specify a different alternate spell checker depending on which
file type we have open.
- Allow color syntaxes to be selected based on more than just filename
extension, e.g. through libmagic?
- Allow text searches in the help browser.
- Allow even better file type detection than we have currently, e.g.
through libmagic?
- Allow setting marks (saved positions, not to be confused with the mark
set via Ctrl-^) at various lines and/or columns in the buffer, and
allow movement between them with a single keystroke.
- Add the ability to move to different lines of the screen with a single
keystroke, e.g. M-` (M-~) to go to the top line, M-& (M-7) to go to
the center line, and M-' (M-") to go to the last line.
allow movement between them with a single keystroke? (we're running
out of keystrokes)
- Allow searching for and replacing newlines.
- Allow soft wrapping as well as hard wrapping?
- Detect when we're pasting text, so that we can handle it differently
from normal typing?
- Make pasting text work as fast as it does in Pico.
- Fix handling of bad/incomplete UTF-8 sequences to display one Unicode
FFFD (Replacement Character) per sequence instead of one per byte.
Old requests:
For version 2.4:
- Allow text searches in the help browser.
- Handle window resizes better. After we resize, we should stay
wherever we were before we resized, as Pico does.
- Add the ability to move to different lines of the screen with a single
keystroke, e.g. M-` (M-~) to go to the top line, M-& (M-7) to go to
the center line, and M-' (M-") to go to the last line.
- Detect when we're pasting text, so that we can handle it differently
(i.e. faster than currently with screen redraws)
- Allow piping marked text to an external command and replacing it with
the command's output (as the internal spell checker already does with
the "spell" command)?
For version 2.2:
- Rebindable keys? [DONE]
- Undo/Redo keys (M-U and M-E)? [DONE]
- Fix problems with color syntaxes' highlighting lines too aggressively [DONE]
- Allow nano to work like a pager (read from stdin) [DONE]
- Allow color syntaxes to be selected based on more than just filename
extension, [DONE]
- Allow soft wrapping as well as hard wrapping? [DONE]
For version 2.0:
- UTF-8 support. [DONE]

16
UPGRADE
View File

@@ -1,6 +1,22 @@
GNU nano upgrading information
==============================
Visible changes since 2.0
-------------------------
* Editor Features
- The ability to rebind (reassign) keys using the nanorc.
- The ability to read standard input like a pager ("nano -").
- Color syntax highlighting can be set by the first line of a file.
- The ability to silence nanorc error messages (-q).
- Undo/redo operations (-u).
- Soft wrapping of text (-$).
* File Handling
- Better handling of backup files: if nano can't write a backup file,
it won't try to write the original file afterward.
- Emergency savefiles retain ownerships and permissions when possible.
- Performance improvements in color syntax highlighting.
Visible changes since 1.2
-------------------------
* Editor Features

View File

@@ -20,7 +20,7 @@
#
# $Id$
AC_INIT([GNU nano], [2.1.9], [nano-devel@gnu.org], [nano])
AC_INIT([GNU nano], [2.2.3], [nano-devel@gnu.org], [nano])
AC_CONFIG_SRCDIR([src/nano.c])
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE
@@ -50,7 +50,7 @@ AC_DEFINE_DIR([PKGDATADIR], [pkgdatadir], [Where data are placed to.])
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h)
AC_CHECK_HEADERS(getopt.h libintl.h limits.h regex.h sys/param.h wchar.h wctype.h stdarg.h)
dnl Checks for options.
@@ -144,7 +144,7 @@ fi])
AC_ARG_ENABLE(color,
[ --disable-color Disable color and syntax highlighting],
[if test x$enableval != xno; then
if test x$enableval != xno; then
if test x$ac_cv_header_regex_h = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
AC_DEFINE(ENABLE_COLOR, 1, [Define this to have syntax highlighting, requires regex.h and ENABLE_NANORC too!]) color_support=yes
@@ -155,7 +155,7 @@ AC_ARG_ENABLE(color,
*** libraries that include the regex.h file or call the configure
*** script with --disable-color.])
fi
fi], [
fi,
if test x$enable_tiny != xyes; then
if test x$ac_cv_header_regex_h = xyes; then
AC_DEFINE(ENABLE_NANORC, 1, [Define this to use .nanorc files.]) nanorc_support=yes
@@ -168,7 +168,7 @@ fi], [
*** script with --disable-color.])
fi
fi
])
)
AC_ARG_ENABLE(multibuffer,
[ --disable-multibuffer Disable multiple file buffers],
@@ -191,37 +191,9 @@ fi],
AC_ARG_ENABLE(all,
[ --enable-all Enable ALL extra nano functionality (ignored for compatibility as all options default to on)],
[if test x$enableval = xyes; then
echo "--enable-all option no longer needed, ignoring for compatiblity"
echo "--enable-all option no longer needed, ignoring for compatibility"
fi])
if test x$color_support = xyes; then
# now check for the end of word boundary support (/< and />)
AC_MSG_CHECKING([for GNU-style word boundary regex support])
AC_TRY_RUN([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <regex.h>
int main(void)
{
regex_t r;
size_t nmatch;
regmatch_t pmatch;
if (regcomp(&r, "\\\\>", REG_EXTENDED|REG_NOSUB))
return 1;
if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
return 1;
return 0;
}],
AC_MSG_RESULT(yes)
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
AC_MSG_RESULT(no),
AC_MSG_WARN([*** Can't check for gnu word boundary support when cross-compiling])
)
fi
AC_MSG_CHECKING([whether to enable UTF-8 support])
AC_ARG_ENABLE(utf8,
[ --enable-utf8 Enable UTF-8 support],
@@ -464,7 +436,6 @@ dnl Checks for library functions.
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(getopt_long)
dnl Checks for libraries.
if eval "test x$CURSES_LIB_NAME = x"; then
@@ -545,6 +516,59 @@ else
fi
fi
if test x$color_support = xyes; then
# now check for the end of word boundary support (/< and />)
AC_MSG_CHECKING([for GNU-style word boundary regex support])
AC_TRY_RUN([
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <regex.h>
int main(void)
{
regex_t r;
size_t nmatch;
regmatch_t pmatch;
if (regcomp(&r, "\\\\>", REG_EXTENDED|REG_NOSUB))
return 1;
if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
return 1;
return 0;
}],
AC_MSG_RESULT(yes)
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
AC_MSG_RESULT(no),
AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
)
# if test x$CURSES_LIB_NAME = xcurses; then
AC_MSG_CHECKING([whether _XOPEN_SOURCE_EXTENDED is needed])
AC_TRY_RUN([
#include <curses.h>
int main(void)
{
int testcolor = COLOR_WHITE;
return 0;
}], AC_MSG_RESULT(no),
AC_TRY_RUN([
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED 1
#endif
#include <curses.h>
int main(void)
{
int testcolor = COLOR_WHITE;
return 0;
}],
AC_DEFINE(NEED_XOPEN_SOURCE_EXTENDED, 1, [Define this if you need the _XOPEN_SOURCE_EXTENDED macro for color support])
AC_MSG_RESULT(yes),
AC_MSG_RESULT(not sure)
AC_MSG_WARN([*** Couldn't successfully compile basic color test with or without _XOPEN_SOURCE_EXTENDED])
AC_MSG_WARN([*** This build may not compile. Consider configuring with --disable-color or installing ncurses])),
AC_MSG_WARN([*** Can't check need for _XOPEN_SOURCE_EXTENDED when cross-compiling]))
fi
#fi
# Check for groff html support
AC_MSG_CHECKING([for HTML support in groff])
groff -t -mandoc -Thtml </dev/null >/dev/null

View File

@@ -83,9 +83,9 @@
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program &quot;establishes a full duplex terminal connection to a remote host&quot;, and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
<blockquote><p>The current version of nano *should* be 2.0.7. Of course, you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
<blockquote><p>The current version of nano *should* be 2.2.0. Of course, you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.0/nano.1.html">here</a>.</p></blockquote>
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.2/nano.1.html">here</a>.</p></blockquote>
<hr width="100%">
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
@@ -99,8 +99,8 @@
<h2><a name="2.2"></a>2.2. RedHat and derivatives (.rpm) packages.</h2>
<blockquote>
<ul>
<li><a href="http://www.nano-editor.org/dist/v2.0/RPMS/">http://www.nano-editor.org/dist/v2.0/RPMS/</a></li>
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v2.0/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v2.0/RPMS/</a></li>
<li><a href="http://www.nano-editor.org/dist/v2.2/RPMS/">http://www.nano-editor.org/dist/v2.2/RPMS/</a></li>
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v2.2/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v2.2/RPMS/</a></li>
</ul>
</blockquote>
<h2><a name="2.3"></a>2.3. Debian (.deb) packages.</h2>
@@ -116,7 +116,7 @@
<blockquote><p>For the 'bleeding edge' current version of nano, you can use subversion to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://svn.savannah.gnu.org/viewvc/trunk/nano/README.SVN?root=nano&view=markup">the nano SVN document</a> for info on anonymous SVN access to the nano source.</p></blockquote>
<hr width="100%">
<h1><a name="3"></a>3. Installation and Configuration</h1>
<h2><a name="3.1"></a>3.1. How do install the RPM or DEB package?</h2>
<h2><a name="3.1"></a>3.1. How do I install the RPM or DEB package?</h2>
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y.z-1.i386.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where <b>x.y.z</b> is the release of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
<h2><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h2>
<blockquote><p>Okay, take a deep breath, this really isn't hard. Unpack the nano source with a command like:</p>
@@ -246,7 +246,7 @@ Of course, due to the license change you can now use the <A HREF="http://www.was
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v2.0/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v2.0/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v2.2/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v2.2/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
<h2><a name="7.3"></a>7.3. How do I submit a bug report or patch?</h2>
<blockquote>
<p>The best place to submit bugs is to the <A HREF="https://savannah.gnu.org/bugs/?group=nano">Savannah bug tracker</A> as you can check whether the bug you are submitting has already been submitted.
@@ -256,8 +256,10 @@ Of course, due to the license change you can now use the <A HREF="http://www.was
<h2><a name="7.5"></a>7.5. Can I have write access to the subversion tree?</h2>
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
<h2><a name="8"></a>8. ChangeLog</h2>
<blockquote><p>2007/12/21 - Update maintainer information. (DLR)<br>
2008/03/16 - Update docs to refer to subversion instead of CVS, add more words about Apline, and refer to Savannah for bugs and patches. (chrisa)
<blockquote><p>2009/11/30 - Update various bits for nano 2.2.x. (DLR)<br>
2009/11/18 - Typo fix. (j.mader@gmail.com)<br>
2008/03/16 - Update docs to refer to subversion instead of CVS, add more words about Alpine, and refer to Savannah for bugs and patches. (chrisa)<br>
2007/12/21 - Update maintainer information. (DLR)<br>
2007/12/09 - Add minor punctuation and wording fixes, and update various sections to account for Alpine. (DLR)<br>
2007/08/26 - Update links to the Free Translation Project. (DLR)<br>
2007/07/29 - Update RPM links for nano 2.0.x. (DLR)<br>

View File

@@ -16,18 +16,18 @@ BUILT_SOURCES = nano.1.html rnano.1.html
endif
endif
if GROFF_HTML
nano_man_mans = nano.1 nanorc.5 rnano.1
if GROFF_HTML
htmlman_DATA = nano.1.html nanorc.5.html rnano.1.html
htmlmandir = $(datadir)/nano/man-html
nano_built_sources = nano.1.html nanorc.5.html rnano.1.html
nano.1.html: nano.1
groff -t -mandoc -Thtml < $< > $@
groff -t -mandoc -Thtml < $? > $@
nanorc.5.html: nanorc.5
groff -t -mandoc -Thtml < $< > $@
groff -t -mandoc -Thtml < $? > $@
rnano.1.html: rnano.1
groff -t -mandoc -Thtml < $< > $@
groff -t -mandoc -Thtml < $? > $@
EXTRA_DIST = $(nano_man_mans) $(nano_built_sources)
else

View File

@@ -2,20 +2,32 @@ mandir = @mandir@/fr
if USE_NANORC
man_MANS = nano.1 nanorc.5 rnano.1
if GROFF_HTML
BUILT_SOURCES = nano.1.html nanorc.5.html rnano.1.html
endif
else
man_MANS = nano.1 rnano.1
if GROFF_HTML
BUILT_SOURCES = nano.1.html rnano.1.html
endif
endif
nano_man_mans = nano.1 nanorc.5 rnano.1
if GROFF_HTML
htmlman_DATA = nano.1.html nanorc.5.html rnano.1.html
htmlmandir = $(datadir)/nano/man-html/fr
nano_built_sources = nano.1.html nanorc.5.html rnano.1.html
nano.1.html: nano.1
groff -t -mandoc -Thtml < $< > $@
groff -t -mandoc -Thtml < $? > $@
nanorc.5.html: nanorc.5
groff -t -mandoc -Thtml < $< > $@
groff -t -mandoc -Thtml < $? > $@
rnano.1.html: rnano.1
groff -t -mandoc -Thtml < $< > $@
groff -t -mandoc -Thtml < $? > $@
EXTRA_DIST = $(nano_man_mans) $(nano_built_sources)
else
EXTRA_DIST = $(nano_man_mans)
endif

View File

@@ -230,7 +230,7 @@ Passe automatiquement
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
Cela permet de faire varier le point de passage à la ligne lorsque l'on
change la taille de l'écran. La valeur par défaut est de -8.
change la taille de l'écran. La valeur par défaut est de \-8.
.TP
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
Choix d'un correcteur orthographique de remplacement.

View File

@@ -143,7 +143,7 @@ Passe automatiquement
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
faire varier le point de passage à la ligne lorsque l'on change la
taille de l'écran. La valeur par défaut est de -8.
taille de l'écran. La valeur par défaut est de \-8.
.TP
.B set/unset historylog
Active l'utilisation de

View File

@@ -1,6 +1,6 @@
.\" Hey, EMACS: -*- nroff -*-
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
.\" Free Software Foundation, Inc.
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
.\" 2008, 2009 Free Software Foundation, Inc.
.\"
.\" This document is dual-licensed. You may distribute and/or modify it
.\" under the terms of either of the following licenses:
@@ -19,7 +19,7 @@
.\" <http://www.gnu.org/licenses/>.
.\"
.\" $Id$
.TH NANO 1 "version 2.0.0" "August 23, 2007"
.TH NANO 1 "version 2.2.0" "November 30, 2009"
.\" Please adjust this date whenever revising the manpage.
.\"
@@ -79,11 +79,11 @@ Enable multiple file buffers, if available.
.TP
.B \-H (\-\-historylog)
Log search and replace strings to \fI~/.nano_history\fP, so they can be
retrieved in later sessions, if nanorc support is available.
retrieved in later sessions, if \fInanorc\fP support is available.
.TP
.B \-I (\-\-ignorercfiles)
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if nanorc
support is available.
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if
\fInanorc\fP support is available.
.TP
.B \-K (\-\-rebindkeypad)
Interpret the numeric keypad keys so that they all work properly. You
@@ -107,10 +107,11 @@ Tab.
.TP
.B \-R (\-\-restricted)
Restricted mode: don't read or write to any file not specified on the
command line; read any nanorc files; allow suspending; allow a file
to be appended to, prepended to, or saved under a different name if it
already has one; or use backup files or spell checking. Also accessible
by invoking \fBnano\fP with any name beginning with 'r' (e.g. "rnano").
command line; read any \fInanorc\fP files; allow suspending; allow a
file to be appended to, prepended to, or saved under a different name if
it already has one; or use backup files or spell checking. Also
accessible by invoking \fBnano\fP with any name beginning with 'r' (e.g.
"rnano").
.TP
.B \-S (\-\-smooth)
Enable smooth scrolling. Text will scroll line-by-line, instead of the
@@ -173,14 +174,14 @@ Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
by the terminal.
.TP
.B \-q (\-\-quiet)
Do not report errors in the nanorc file and ask them to
be acknowledged by pressing enter at startup.
Do not report errors in the \fInanorc\fP file and ask them to be
acknowledged by pressing Enter at startup.
.TP
.B \-r \fIcols\fP (\-\-fill=\fIcols\fP)
Wrap lines at column \fIcols\fP. If this value is 0 or less, wrapping
will occur at the width of the screen less \fIcols\fP columns, allowing
the wrap point to vary along with the width of the screen if the screen
is resized. The default value is -8.
is resized. The default value is \-8.
.TP
.B \-s \fIprog\fP (\-\-speller=\fIprog\fP)
Enable alternative spell checker command.
@@ -189,6 +190,10 @@ Enable alternative spell checker command.
Always save changed buffer without prompting. Same as Pico's \fB-t\fP
option.
.TP
.B \-u (\-\-undo)
Enable experimental generic-purpose undo code. By default, the undo and redo
shortcuts are Meta-U and Meta-E, respectively.
.TP
.B \-v (\-\-view)
View file (read only) mode.
.TP
@@ -201,6 +206,13 @@ Disable help screen at bottom of editor.
.B \-z (\-\-suspend)
Enable suspend ability.
.TP
.B \-$ (\-\-softwrap)
Enable 'soft wrapping'. \fBnano\fP will attempt to display the entire
contents of a line, even if it is longer than the screen width. Since
\&'$' normally refers to a variable in the Unix shell, you should specify
this option last when using other options (e.g. 'nano \-wS$') or pass it
separately (e.g. 'nano \-wS \-$').
.TP
.B \-a, \-b, \-e, \-f, \-g, \-j
Ignored, for compatibility with Pico.
@@ -212,7 +224,7 @@ should be provided with \fBnano\fP.
.SH NOTES
If no alternative spell checker command is specified on the command
line or in one of the nanorc files, \fBnano\fP will check the
line or in one of the \fInanorc\fP files, \fBnano\fP will check the
\fBSPELL\fP environment variable for one.
In some cases \fBnano\fP will try to dump the buffer into an emergency

View File

@@ -1,5 +1,5 @@
.\" Hey, EMACS: -*- nroff -*-
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
.\" Free Software Foundation, Inc.
.\"
.\" This document is dual-licensed. You may distribute and/or modify it
@@ -45,9 +45,9 @@ the command line options. Additionally, the \fBsyntax\fP, \fBcolor\fP,
and \fBicolor\fP keywords are used to define syntax highlighting rules
for different text patterns. \fBnano\fP will read one command per line.
Options in nanorc files take precedence over nano's defaults, and
command line options override nanorc settings. Also, options are unset
by default, except for those that take arguments.
Options in \fInanorc\fP files take precedence over nano's defaults, and
command line options override \fInanorc\fP settings. Also, options are
unset by default, except for those that take arguments.
Quotes inside string parameters don't have to be escaped with
backslashes. The last double quote in the string will be treated as its
@@ -91,7 +91,7 @@ Use cut to end of line by default.
.B set fill \fIn\fP
Wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
maximum line length will be the screen width less \fIn\fP columns. The
default value is -8.
default value is \-8.
.TP
.B set/unset historylog
Enable \fI~/.nano_history\fP for saving and reading search/replace
@@ -146,9 +146,9 @@ punctuation, optionally followed by closing brackets, can end sentences.
The default value is "\fI!.?\fP".
.TP
.B set/unset quiet
\fBnano\fP will not report errors in the nanorc file and ask them to
be acknowledged by pressing enter at startup. If this is used it should
be placed at the top of the file to be fully effective.
\fBnano\fP will not report errors in the \fInanorc\fP file and ask them
to be acknowledged by pressing enter at startup. If this is used it
should be placed at the top of the file to be fully effective.
.TP
.B set/unset quickblank
Do quick statusbar blanking. Statusbar messages will disappear after 1
@@ -185,6 +185,9 @@ line.
.B set/unset smooth
Use smooth scrolling by default.
.TP
.B set/unset softwrap
Enable soft line wrapping for easier viewing of very long lones.
.TP
.B set speller "\fIspellprog\fP"
Use spelling checker \fIspellprog\fP instead of the built-in one, which
calls \fIspell\fP.
@@ -202,9 +205,15 @@ Convert typed tabs to spaces.
.B set/unset tempfile
Save automatically on exit, don't prompt.
.TP
.B set/unset undo
Enable experimental generic-purpose undo code.
.TP
.B set/unset view
Disallow file modification.
.TP
.B set/unset softwrap
Enable soft line wrapping for easier viewing of very long lones.
.TP
.B set whitespace "\fIstring\fP"
Set the two characters used to display the first characters of tabs and
spaces. They must be single-column characters.
@@ -215,7 +224,7 @@ characters as parts of words.
.TP
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
Defines a syntax named \fIstr\fP which can be activated via the
-Y/--syntax command line option, or will be automatically activated if
\-Y/\-\-syntax command line option, or will be automatically activated if
the current filename matches the extended regular expression
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
will apply to \fIsyntax\fP until a new syntax is defined.
@@ -267,7 +276,7 @@ followed by an alpha character or the word "Space".
Example: ^C
.TP
.B M-
followed by a prinable character or the word "Space".
followed by a printable character or the word "Space".
Example: M-C
.TP
.B F
@@ -405,7 +414,7 @@ Refresh the screen.
Undo the text action peformed (add text, delete text, etc).
.TP
.B redo
"Re-do" the last undone action (i.e. undo an undo)
Redo the last undone action (i.e., undo an undo).
.TP
.B suspend
Suspend the editor (if the suspend function is enabled, see the
@@ -525,6 +534,13 @@ The 'go to directory' menu.
.TP
.B all
A special name meaning: apply to all menus where this function exists.
.TP
.B unbind \fIkey\fP \fImenu\fP
Unbind the key \fIkey\fP from the menu named \fImenu\fP or from all
menus by using \fIall\fP. Same key syntax as for binding.
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
context of menu \fImenu\fP. The format of \fIkey\fP should be one of:
.SH FILES
.TP
.I SYSCONFDIR/nanorc

View File

@@ -141,6 +141,9 @@
## Use smooth scrolling as the default.
# set smooth
## Enable soft line wrapping (AKA full line display).
# set softwrap
## Use this spelling checker instead of the internal one. This option
## does not properly have a default value.
##
@@ -158,6 +161,10 @@
## Save automatically on exit, don't prompt.
# set tempfile
## Enable the new (EXPERIMENTAL) generic undo code, not just for line
## cuts.
# set undo
## Disallow file modification. Why would you want this in an rcfile? ;)
# set view
@@ -232,6 +239,9 @@
## C/C++
# include "@PKGDATADIR@/c.nanorc"
## Makefiles
# include "@PKGDATADIR@/makefile.nanorc"
## Cascading Style Sheets
# include "@PKGDATADIR@/css.nanorc"
@@ -277,6 +287,15 @@
## Java
# include "@PKGDATADIR@/java.nanorc"
## Fortran
# include "@PKGDATADIR@/fortran.nanorc"
## Objective-C
# include "@PKGDATADIR@/objc.nanorc"
## OCaml
# include "@PKGDATADIR@/ocaml.nanorc"
## AWK
# include "@PKGDATADIR@/awk.nanorc"

View File

@@ -22,6 +22,7 @@ pkgdata_DATA = asm.nanorc \
xml.nanorc \
ocaml.nanorc \
objc.nanorc \
fortran.nanorc
fortran.nanorc \
makefile.nanorc
EXTRA_DIST = $(pkgdata_DATA)

View File

@@ -20,14 +20,14 @@ color brightblue "\<e(begin|end|conf|install|make|qmake[34]|ant|(qa)?warn|infon?
color brightblue "\<e(pause|beep|mktemp|(cvs|svn)_clean|punt_cxx)\>" "\<e(aclocal|auto(reconf|header|conf|make))\>"
color brightblue "\<built_with_use\>" "\<make_desktop_entry\>" "\<unpack(_(makeself|pdv))?\>"
color brightblue "\<die\>" "\<use(_(with|enable))?\>" "\<inherit\>" "\<has\>" "\<(has|best)_version\>"
color brightblue "\<(do|new)(ins|(games)?s?bin|doc|lib(|\.so|\.a)|man|info|exe|initd|confd|envd|pam|menu|icon)\>"
color brightblue "\<(do|new)(ins|(games)?s?bin|doc|lib(\.so|\.a)?|man|info|exe|initd|confd|envd|pam|menu|icon)\>"
color brightblue "\<do(python|sed|dir|hard|sym|html|jar|mo)\>" "\<keepdir\>"
color brightblue "prepall(|docs|info|man|strip)" "prep(info|lib|lib\.(so|a)|man|strip|gamesdirs)"
color brightblue "\<(|doc|ins|exe)into\>" "\<(f|games)(owners|perms)\>" "\<(exe|ins|dir)opts\>"
color brightblue "prepall(docs|info|man|strip)?" "prep(info|lib|lib\.(so|a)|man|strip|gamesdirs)"
color brightblue "\<(doc|ins|exe)?into\>" "\<(f|games)(owners|perms)\>" "\<(exe|ins|dir)opts\>"
## Highlight common commands used in ebuilds
color blue "\<make\>" "\<(awk|cat|cd|chmod|chown|cp|echo|env|export|find|e?grep|ln|mkdir|mv|rm|sed|set|tar|touch|unset|xargs)\>"
## Highlight comments (doesnt work that well)
color yellow "#.*$"
color yellow "(^|[[:space:]])#.*$"
## Highlight strings (doesnt work that well)
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
## Trailing space is bad!

View File

@@ -0,0 +1,8 @@
# unattributed syntax highlighting example from wiki.linuxhelp.net/
syntax "makefile" "Makefile[^/]*$"
color red "[:=]"
color magenta "\<(if|ifeq|else|endif)\>"
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
color brightblue "^[^ ]+:"
color green "#.*$"

View File

@@ -4,7 +4,7 @@ syntax "nanorc" "\.?nanorc$"
## Possible errors and parameters
icolor brightwhite "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
## Keywords
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|speller|suspend|suspendenable|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\>"
icolor green "^[[:space:]]*(set|unset|include|syntax|header)\>"
## Colors
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"

View File

@@ -1,7 +1,7 @@
## Here is an example for Bourne shell scripts.
##
syntax "sh" "\.sh$"
header "^#!.*/(ba|k|pdk|)sh[-0-9_]*"
header "^#!.*/(ba|k|pdk)?sh[-0-9_]*"
icolor brightgreen "^[0-9A-Z_]+\(\)"
color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"

View File

@@ -13,4 +13,4 @@ color green "(\(|\)|\;|`|\\|\$|<|>|!|=|&|\|)"
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color ,green "[[:space:]]+$"
color ,magenta "^([[:space:]]+|)#.*"
color ,magenta "^[[:space:]]*#.*"

View File

@@ -8,8 +8,8 @@
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
@smallbook
@set EDITION 0.1
@set VERSION 2.0.0
@set UPDATED 17 Dec 2007
@set VERSION 2.2.0
@set UPDATED 30 Nov 2009
@dircategory Editors
@direntry
@@ -23,7 +23,7 @@
@titlepage
@title GNU @code{nano}
@subtitle a small and friendly text editor.
@subtitle version 2.0.0
@subtitle version 2.2.0
@author Chris Allegretta
@page
@@ -33,8 +33,8 @@ editor.
This manual is part of the GNU @code{nano} distribution.@*
@sp4
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009 Free Software Foundation, Inc.
This document is dual-licensed. You may distribute and/or modify it
under the terms of either of the following licenses:
@@ -249,6 +249,10 @@ a chroot.
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
editor can be can be stopped and started.
@item -q, --quiet
Do not report errors in the nanorc file and ask them to be acknowledged
by pressing Enter at startup.
@item -r <#cols>, --fill=<#cols>
Wrap lines at column #cols. If this value is 0 or less, wrapping will
occur at the width of the screen less #cols, allowing it to vary along
@@ -266,6 +270,10 @@ Don't ask whether or not to save the current contents of the file when
exiting, assume yes. This is most useful when using @code{nano} as the
composer of a mailer program.
@item -u, --undo
Enable experimental generic-purpose undo code. By default, the undo and
redo shortcuts are Meta-U and Meta-E, respectively.
@item -v, --view
Don't allow the contents of the file to be altered. Note that this
option should NOT be used in place of correct file permissions to
@@ -288,6 +296,13 @@ disabled to display the help system navigation keys.
Enable @code{nano}'s suspend ability using the system's suspend
keystroke (usually ^Z).
@item -$, --softwrap
Enable 'soft wrapping'. @code{nano} will attempt to display the entire
contents of a line, even if it is longer than the screen width. Since
'$' normally refers to a variable in the Unix shell, you should specify
this option last when using other options (e.g. 'nano -wS$') or pass it
separately (e.g. 'nano -wS -$').
@item -a, -b, -e, -f, -g, -j
Ignored, for compatibility with Pico.
@end table
@@ -447,6 +462,9 @@ nanorc. See @xref{Nanorc Files}, for more info.
@item Suspend Toggle (Meta-Z)
toggles the -z (@code{--suspend}) command line option.
@item Soft Wrapping Toggle (Meta-$)
toggles the -$ (@code{--softwrap}) command line option.
@end table
@@ -615,6 +633,9 @@ line.
@item set/unset smooth
Use smooth scrolling by default.
@item set/unset softwrap
Use soft wrapping by default.
@item set speller "spellprog"
Use spelling checker "spellprog" instead of the built-in one, which
calls "spell".
@@ -622,6 +643,10 @@ calls "spell".
@item set/unset suspend
Allow @code{nano} to be suspended.
@item set/unset suspendenable
If @code{nano} is allowed to be suspended, allow the suspend key
(usually ^Z) to actually suspend it.
@item set tabsize "n"
Use a tab size of "n" columns. The value of "n" must be greater than 0.
The default value is 8.
@@ -632,6 +657,9 @@ Convert typed tabs to spaces.
@item set/unset tempfile
Save automatically on exit, don't prompt.
@item set/unset undo
Enable experimental generic-purpose undo code.
@item set/unset view
Disallow file modification.

View File

@@ -8,7 +8,7 @@ sub combinations {
return @rest, map { [$first, @$_] } @rest;
}
my @allargs=("--enable-debug", "--disable-justify", "--disable-extra", "--enable-tiny", "--disable-browser --disable-help --disable-mouse --disable-operatingdir --disable-speller", "--disable-multibuffer", "--disable-nanorc", "--with-slang");
my @allargs=("--enable-debug", "--disable-wrapping", "--disable-justify", "--disable-extra", "--enable-tiny", "--disable-browser --disable-help --disable-mouse --disable-operatingdir --disable-speller", "--disable-multibuffer", "--disable-nanorc", "--with-slang");
my @combos = combinations(@allargs);
my $i = 0;
@@ -16,10 +16,11 @@ foreach my $name (@combos) {
my @args = @$name;
my $pct = $i / $#combos * 100;
printf "Trying with options: @args, %d%% done...\n", $pct;
system("(./configure @args && make clean all) >/dev/null 2>&1");
my $cmd = "./configure @args && make clean all";
system("($cmd) >/dev/null 2>&1");
if ($? != 0) {
print "Build failed for args: @args\n";
print "Try running make to reproduce\n";
print "To reproduce, run:\n $cmd\n";
exit(1);
}
$i++;

800
po/bg.po

File diff suppressed because it is too large Load Diff

819
po/ca.po

File diff suppressed because it is too large Load Diff

815
po/cs.po

File diff suppressed because it is too large Load Diff

795
po/da.po

File diff suppressed because it is too large Load Diff

816
po/de.po

File diff suppressed because it is too large Load Diff

809
po/es.po

File diff suppressed because it is too large Load Diff

800
po/eu.po

File diff suppressed because it is too large Load Diff

2233
po/fi.po

File diff suppressed because it is too large Load Diff

851
po/fr.po

File diff suppressed because it is too large Load Diff

815
po/ga.po

File diff suppressed because it is too large Load Diff

803
po/gl.po

File diff suppressed because it is too large Load Diff

930
po/hu.po

File diff suppressed because it is too large Load Diff

791
po/id.po

File diff suppressed because it is too large Load Diff

824
po/it.po

File diff suppressed because it is too large Load Diff

799
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

800
po/nb.po

File diff suppressed because it is too large Load Diff

848
po/nl.po

File diff suppressed because it is too large Load Diff

795
po/nn.po

File diff suppressed because it is too large Load Diff

799
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

799
po/ro.po

File diff suppressed because it is too large Load Diff

804
po/ru.po

File diff suppressed because it is too large Load Diff

878
po/rw.po

File diff suppressed because it is too large Load Diff

799
po/sr.po

File diff suppressed because it is too large Load Diff

800
po/sv.po

File diff suppressed because it is too large Load Diff

791
po/tr.po

File diff suppressed because it is too large Load Diff

799
po/uk.po

File diff suppressed because it is too large Load Diff

809
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* browser.c *
* *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 *
* Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -184,7 +184,7 @@ char *do_browser(char *path, DIR *dir)
do_filesearch();
curs_set(0);
/* Search for another filename. */
} else if (f->scfunc == WHEREIS_NEXT_MSG) {
} else if (f->scfunc == DO_RESEARCH) {
do_fileresearch();
} else if (f->scfunc == DO_PAGE_UP) {
if (selected >= (editwinrows + fileline % editwinrows) *
@@ -232,7 +232,7 @@ char *do_browser(char *path, DIR *dir)
* blank out ans, since we're done with it. */
statusbar(_("Cancelled"));
ans = mallocstrcpy(ans, "");
break;
continue;
} else if (i != 0) {
/* Put back the "Go to Directory" key and save
* answer in ans, so that the file list is displayed
@@ -240,7 +240,7 @@ char *do_browser(char *path, DIR *dir)
* typed before at the prompt is displayed again. */
unget_kbinput(sc_seq_or(DO_GOTOLINECOLUMN_VOID, 0), FALSE, FALSE);
ans = mallocstrcpy(ans, answer);
break;
continue;
}
/* We have a directory. Blank out ans, since we're done
@@ -266,7 +266,7 @@ char *do_browser(char *path, DIR *dir)
_("Can't go outside of %s in restricted mode"),
operating_dir);
free(new_path);
break;
continue;
}
#endif
@@ -278,7 +278,7 @@ char *do_browser(char *path, DIR *dir)
strerror(errno));
beep();
free(new_path);
break;
continue;
}
/* Start over again with the new path value. */
@@ -302,7 +302,7 @@ char *do_browser(char *path, DIR *dir)
if (strcmp(filelist[selected], "/..") == 0) {
statusbar(_("Can't move up a directory"));
beep();
break;
continue;
}
#ifndef DISABLE_OPERATINGDIR
@@ -314,7 +314,7 @@ char *do_browser(char *path, DIR *dir)
_("Can't go outside of %s in restricted mode"),
operating_dir);
beep();
break;
continue;
}
#endif
@@ -324,7 +324,7 @@ char *do_browser(char *path, DIR *dir)
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
break;
continue;
}
/* If we've successfully opened a file, we're done, so
@@ -332,7 +332,7 @@ char *do_browser(char *path, DIR *dir)
if (!S_ISDIR(st.st_mode)) {
retval = mallocstrcpy(NULL, filelist[selected]);
abort = TRUE;
break;
continue;
/* If we've successfully opened a directory, and it's
* "..", save the current directory in prev_dir, so that
* we can select it later. */
@@ -347,7 +347,7 @@ char *do_browser(char *path, DIR *dir)
statusbar(_("Error reading %s: %s"),
filelist[selected], strerror(errno));
beep();
break;
continue;
}
path = mallocstrcpy(path, filelist[selected]);
@@ -534,9 +534,9 @@ void browser_init(const char *path, DIR *dir)
}
/* If width isn't initialized yet, and we've taken up only one line,
* it means that width is equal to (COLS % longest). */
* it means that width is equal to longest. */
if (width == 0)
width = COLS % longest;
width = longest;
}
/* Determine the shortcut key corresponding to the values of kbinput

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* chars.c *
* *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 *
* Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -79,6 +79,16 @@ bool is_byte(int c)
return ((unsigned int)c == (unsigned char)c);
}
static void mbtowc_reset(void)
{
IGNORE_CALL_RESULT(mbtowc(NULL, NULL, 0));
}
static void wctomb_reset(void)
{
IGNORE_CALL_RESULT(wctomb(NULL, 0));
}
/* This function is equivalent to isalnum() for multibyte characters. */
bool is_alnum_mbchar(const char *c)
{
@@ -89,7 +99,7 @@ bool is_alnum_mbchar(const char *c)
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
wc = bad_wchar;
}
@@ -109,7 +119,7 @@ bool is_blank_mbchar(const char *c)
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
wc = bad_wchar;
}
@@ -156,7 +166,7 @@ bool is_cntrl_mbchar(const char *c)
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
wc = bad_wchar;
}
@@ -177,7 +187,7 @@ bool is_punct_mbchar(const char *c)
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
wc = bad_wchar;
}
@@ -243,14 +253,14 @@ char *control_mbrep(const char *c, char *crep, int *crep_len)
wchar_t wc;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
*crep_len = bad_mbchar_len;
strncpy(crep, bad_mbchar, *crep_len);
} else {
*crep_len = wctomb(crep, control_wrep(wc));
if (*crep_len < 0) {
wctomb(NULL, 0);
wctomb_reset();
*crep_len = 0;
}
}
@@ -278,14 +288,14 @@ char *mbrep(const char *c, char *crep, int *crep_len)
/* Reject invalid Unicode characters. */
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
*crep_len = bad_mbchar_len;
strncpy(crep, bad_mbchar, *crep_len);
} else {
*crep_len = wctomb(crep, wc);
if (*crep_len < 0) {
wctomb(NULL, 0);
wctomb_reset();
*crep_len = 0;
}
}
@@ -311,7 +321,7 @@ int mbwidth(const char *c)
int width;
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
wc = bad_wchar;
}
@@ -356,7 +366,7 @@ char *make_mbchar(long chr, int *chr_mb_len)
/* Reject invalid Unicode characters. */
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
wctomb(NULL, 0);
wctomb_reset();
*chr_mb_len = 0;
}
} else {
@@ -388,7 +398,7 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
/* If buf contains an invalid multibyte character, only
* interpret buf's first byte. */
if (buf_mb_len < 0) {
mblen(NULL, 0);
IGNORE_CALL_RESULT(mblen(NULL, 0));
buf_mb_len = 1;
} else if (buf_mb_len == 0)
buf_mb_len++;
@@ -545,7 +555,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
ws1 = (unsigned char)*s1_mb;
bad_s1_mb = TRUE;
}
@@ -553,7 +563,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
ws2 = (unsigned char)*s2_mb;
bad_s2_mb = TRUE;
}
@@ -781,7 +791,7 @@ char *mbstrchr(const char *s, const char *c)
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
if (c_mb_len < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
wc = (unsigned char)*c;
bad_c_mb = TRUE;
}
@@ -790,7 +800,7 @@ char *mbstrchr(const char *s, const char *c)
int s_mb_len = parse_mbchar(s, s_mb, NULL);
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
mbtowc(NULL, NULL, 0);
mbtowc_reset();
ws = (unsigned char)*s;
bad_s_mb = TRUE;
}

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* color.c *
* *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 *
* Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* cut.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* files.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -145,8 +145,8 @@ void open_buffer(const char *filename, bool undoable)
/* If we have a non-new file, read it in. Then, if the buffer has
* no stat, update the stat, if applicable. */
if (rc == 0) {
read_file(f, filename, undoable);
if (rc > 0) {
read_file(f, rc, filename, undoable, new_buffer);
#ifndef NANO_TINY
if (openfile->current_stat == NULL) {
openfile->current_stat =
@@ -195,8 +195,8 @@ void replace_buffer(const char *filename)
initialize_buffer_text();
/* If we have a non-new file, read it in. */
if (rc == 0)
read_file(f, filename, FALSE);
if (rc > 0)
read_file(f, rc, filename, FALSE, TRUE);
/* Move back to the beginning of the first line of the buffer. */
openfile->current = openfile->fileage;
@@ -291,6 +291,47 @@ bool close_buffer(void)
}
#endif /* ENABLE_MULTIBUFFER */
/* A bit of a copy and paste from open_file(), is_file_writable()
* just checks whether the file is appendable as a quick
* permissions check, and we tend to err on the side of permissiveness
* (reporting TRUE when it might be wrong) to not fluster users
* editing on odd filesystems by printing incorrect warnings.
*/
int is_file_writable(const char *filename)
{
struct stat fileinfo, fileinfo2;
int fd;
FILE *f;
char *full_filename;
bool ans = TRUE;
if (ISSET(VIEW_MODE))
return TRUE;
assert(filename != NULL);
/* Get the specified file's full path. */
full_filename = get_full_path(filename);
/* Okay, if we can't stat the path due to a component's
permissions, just try the relative one */
if (full_filename == NULL
|| (stat(full_filename, &fileinfo) == -1 && stat(filename, &fileinfo2) != -1))
full_filename = mallocstrcpy(NULL, filename);
if ((fd = open(full_filename, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR |
S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) == -1
|| (f = fdopen(fd, "a")) == NULL)
ans = FALSE;
else
fclose(f);
close(fd);
free(full_filename);
return ans;
}
/* We make a new line of text from buf. buf is length buf_len. If
* first_line_ins is TRUE, then we put the new line at the top of the
* file. Otherwise, we assume prevnode is the last line of the file,
@@ -348,8 +389,10 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
/* Read an open file into the current buffer. f should be set to the
* open file, and filename should be set to the name of the file.
undoable means do we want to create undo records to try and undo this */
void read_file(FILE *f, const char *filename, bool undoable)
* undoable means do we want to create undo records to try and undo this.
* Will also attempt to check file writability if fd > 0 and checkwritable == TRUE
*/
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable)
{
size_t num_lines = 0;
/* The number of lines in the file. */
@@ -370,6 +413,8 @@ void read_file(FILE *f, const char *filename, bool undoable)
int input_int;
/* The current value we read from the file, whether an input
* character or EOF. */
bool writable = TRUE;
/* Is the file writable (if we care) */
#ifndef NANO_TINY
int format = 0;
/* 0 = *nix, 1 = DOS, 2 = Mac, 3 = both DOS and Mac. */
@@ -469,6 +514,10 @@ void read_file(FILE *f, const char *filename, bool undoable)
if (ferror(f))
nperror(filename);
fclose(f);
if (fd > 0 && checkwritable) {
close(fd);
writable = is_file_writable(filename);
}
#ifndef NANO_TINY
/* If file conversion isn't disabled and the last character in this
@@ -578,24 +627,45 @@ void read_file(FILE *f, const char *filename, bool undoable)
if (undoable)
update_undo(INSERT);
if (format == 3)
statusbar(
if (format == 3) {
if (writable)
statusbar(
P_("Read %lu line (Converted from DOS and Mac format)",
"Read %lu lines (Converted from DOS and Mac format)",
(unsigned long)num_lines), (unsigned long)num_lines);
else if (format == 2) {
else
statusbar(
P_("Read %lu line (Converted from DOS and Mac format - Warning: No write permission)",
"Read %lu lines (Converted from DOS and Mac format - Warning: No write permission)",
(unsigned long)num_lines), (unsigned long)num_lines);
} else if (format == 2) {
openfile->fmt = MAC_FILE;
statusbar(P_("Read %lu line (Converted from Mac format)",
if (writable)
statusbar(P_("Read %lu line (Converted from Mac format)",
"Read %lu lines (Converted from Mac format)",
(unsigned long)num_lines), (unsigned long)num_lines);
else
statusbar(P_("Read %lu line (Converted from Mac format - Warning: No write permission)",
"Read %lu lines (Converted from Mac format - Warning: No write permission)",
(unsigned long)num_lines), (unsigned long)num_lines);
} else if (format == 1) {
openfile->fmt = DOS_FILE;
statusbar(P_("Read %lu line (Converted from DOS format)",
if (writable)
statusbar(P_("Read %lu line (Converted from DOS format)",
"Read %lu lines (Converted from DOS format)",
(unsigned long)num_lines), (unsigned long)num_lines);
else
statusbar(P_("Read %lu line (Converted from DOS format - Warning: No write permission)",
"Read %lu lines (Converted from DOS format - Warning: No write permission)",
(unsigned long)num_lines), (unsigned long)num_lines);
} else
#endif
statusbar(P_("Read %lu line", "Read %lu lines",
if (writable)
statusbar(P_("Read %lu line", "Read %lu lines",
(unsigned long)num_lines), (unsigned long)num_lines);
else
statusbar(P_("Read %lu line ( Warning: No write permission)",
"Read %lu lines (Warning: No write permission)",
(unsigned long)num_lines), (unsigned long)num_lines);
}
@@ -603,9 +673,9 @@ void read_file(FILE *f, const char *filename, bool undoable)
* "New File" if the file is missing. Otherwise, say "[filename] not
* found".
*
* Return -2 if we say "New File", -1 if the file isn't opened, and 0
* otherwise. The file might still have an error while reading with a 0
* return value. *f is set to the opened file. */
* Return -2 if we say "New File", -1 if the file isn't opened, and the
* fd opened otherwise. The file might still have an error while reading
* with a 0 return value. *f is set to the opened file. */
int open_file(const char *filename, bool newfie, FILE **f)
{
struct stat fileinfo, fileinfo2;
@@ -668,7 +738,7 @@ int open_file(const char *filename, bool newfie, FILE **f)
free(full_filename);
return 0;
return fd;
}
/* This function will return the name of the first available extension
@@ -1120,7 +1190,7 @@ char *get_full_path(const char *origpath)
/* Finally, go back to the path specified in d_here,
* where we were before. We don't check for a chdir()
* error, since we can do nothing if we get one. */
chdir(d_here);
IGNORE_CALL_RESULT(chdir(d_here));
/* Free d_here, since we're done using it. */
free(d_here);
@@ -1430,6 +1500,13 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
realexists = (stat(realname, &st) != -1);
#ifndef NANO_TINY
/* if we have not stat()d this file before (say, the user just
* specified it interactively), use the info we just got from
* stat()ing or else we will chase null pointers when we do
* modtime checks, preserve file times, etc. during backup */
if (openfile->current_stat == NULL && realexists)
openfile->current_stat = &st;
/* We backup only if the backup toggle is set, the file isn't
* temporary, and the file already exists. Furthermore, if we
* aren't appending, prepending, or writing a selection, we backup
@@ -2048,7 +2125,8 @@ bool do_writeout(bool exiting)
}
}
#ifndef NANO_TINY
if (openfile->current_stat && openfile->current_stat->st_mtime < st.st_mtime) {
if (name_exists && openfile->current_stat && openfile->current_stat->st_mtime < st.st_mtime) {
i = do_yesno_prompt(FALSE,
_("File was modified since you opened it, continue saving ? "));
if (i == 0 || i == -1)

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* global.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -52,7 +52,7 @@ char *last_search = NULL;
char *last_replace = NULL;
/* The last replacement string we searched for. */
long flags = 0;
unsigned flags[4] = {0, 0, 0, 0};
/* Our flag containing the states of all global options. */
WINDOW *topwin;
/* The top portion of the window, where we display the version
@@ -66,6 +66,8 @@ WINDOW *bottomwin;
* messages, the statusbar prompt, and a list of shortcuts. */
int editwinrows = 0;
/* How many rows does the edit window take up? */
int maxrows = 0;
/* How many usable lines are there (due to soft wrapping) */
filestruct *cutbuffer = NULL;
/* The buffer where we store cut text. */
@@ -212,7 +214,7 @@ size_t length_of_list(int menu)
}
/* Set type of function based on the string */
function_type strtokeytype(char *str)
function_type strtokeytype(const char *str)
{
if (str[0] == 'M' || str[0] == 'm')
return META;
@@ -232,7 +234,7 @@ void add_to_funcs(short func, int menus, const char *desc, const char *help,
subnfunc *f;
if (allfuncs == NULL) {
allfuncs = nmalloc(sizeof(subnfunc));
allfuncs = (subnfunc *) nmalloc(sizeof(subnfunc));
f = allfuncs;
} else {
for (f = allfuncs; f->next != NULL; f = f->next)
@@ -287,12 +289,12 @@ const sc *first_sc_for(int menu, short func) {
/* Add a string to the new shortcut list implementation
Allows updates to existing entries in the list */
void add_to_sclist(int menu, char *scstring, short func, int toggle, int execute)
void add_to_sclist(int menu, const char *scstring, short func, int toggle, int execute)
{
sc *s;
if (sclist == NULL) {
sclist = nmalloc(sizeof(sc));
sclist = (sc *) nmalloc(sizeof(sc));
s = sclist;
s->next = NULL;
} else {
@@ -313,7 +315,7 @@ void add_to_sclist(int menu, char *scstring, short func, int toggle, int execute
s->type = strtokeytype(scstring);
s->menu = menu;
s->toggle = toggle;
s->keystr = scstring;
s->keystr = (char *) scstring;
s->scfunc = func;
s->execute = execute;
assign_keyinfo(s);
@@ -409,7 +411,10 @@ void print_sclist(void)
/* Stuff we need to make at least static here so we can access it below */
/* TRANSLATORS: Try to keep the next five strings at most 10 characters. */
const char *cancel_msg = N_("Cancel");
const char *replace_msg = N_("Replace");
const char *no_replace_msg = N_("No Replace");
#ifndef NANO_TINY
const char *case_sens_msg = N_("Case Sens");
@@ -445,8 +450,6 @@ const char *ext_cmd_msg = "";
/* TRANSLATORS: Try to keep the next five strings at most 10 characters. */
const char *prev_history_msg = N_("PrevHstory");
const char *next_history_msg = N_("NextHstory");
const char *replace_msg = N_("Replace");
const char *no_replace_msg = N_("No Replace");
const char *gototext_msg = N_("Go To Text");
/* TRANSLATORS: Try to keep the next three strings at most 12 characters. */
const char *whereis_next_msg = N_("WhereIs Next");
@@ -488,7 +491,9 @@ void shortcut_init(bool unjustify)
const char *fulljstify_msg = N_("FullJstify");
#endif
const char *refresh_msg = N_("Refresh");
#ifndef NANO_TINY
const char *insert_file_msg = N_("Insert File");
#endif
const char *go_to_line_msg = N_("Go To Line");
#ifndef DISABLE_JUSTIFY
@@ -633,8 +638,9 @@ void shortcut_init(bool unjustify)
N_("Go to the first file in the list");
const char *nano_lastfile_msg =
N_("Go to the last file in the list");
const char *nano_forwardfile_msg = N_("Go to the next file in the list");
const char *nano_backfile_msg = N_("Go to the previous file in the list");
const char *nano_gotodir_msg = N_("Go to directory");
#endif
#endif /* !DISABLE_HELP */
@@ -650,8 +656,9 @@ void shortcut_init(bool unjustify)
free(f);
}
add_to_funcs(DO_HELP_VOID, MALL, get_help_msg, IFSCHELP(nano_help_msg),
FALSE, VIEW);
add_to_funcs(DO_HELP_VOID,
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR),
get_help_msg, IFSCHELP(nano_help_msg), FALSE, VIEW);
add_to_funcs( CANCEL_MSG,
(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO),
@@ -664,8 +671,6 @@ void shortcut_init(bool unjustify)
#endif
exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
add_to_funcs(DO_EXIT, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
#ifndef DISABLE_BROWSER
add_to_funcs(DO_EXIT, MBROWSER, exit_msg, IFSCHELP(nano_exitbrowser_msg), FALSE, VIEW);
#endif
@@ -697,9 +702,9 @@ void shortcut_init(bool unjustify)
add_to_funcs(DO_SEARCH, MMAIN|MBROWSER, whereis_msg,
IFSCHELP(nano_whereis_msg), FALSE, VIEW);
add_to_funcs(DO_PAGE_UP, MMAIN|MHELP,
add_to_funcs(DO_PAGE_UP, MMAIN|MHELP|MBROWSER,
prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW);
add_to_funcs(DO_PAGE_DOWN, MMAIN|MHELP,
add_to_funcs(DO_PAGE_DOWN, MMAIN|MHELP|MBROWSER,
next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
@@ -734,11 +739,11 @@ void shortcut_init(bool unjustify)
#endif
add_to_funcs(DO_FIRST_LINE,
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
first_line_msg, IFSCHELP(nano_firstline_msg), FALSE, VIEW);
add_to_funcs(DO_LAST_LINE,
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW);
@@ -778,26 +783,34 @@ void shortcut_init(bool unjustify)
add_to_funcs(DO_UNINDENT, MMAIN, N_("Unindent Text"),
IFSCHELP(nano_unindent_msg), FALSE, NOVIEW);
add_to_funcs(DO_UNDO, MMAIN, N_("Undo"),
IFSCHELP(nano_undo_msg), FALSE, NOVIEW);
if (ISSET(UNDOABLE)) {
add_to_funcs(DO_UNDO, MMAIN, N_("Undo"),
IFSCHELP(nano_undo_msg), FALSE, NOVIEW);
add_to_funcs(DO_REDO, MMAIN, N_("Redo"),
IFSCHELP(nano_redo_msg), TRUE, NOVIEW);
add_to_funcs(DO_REDO, MMAIN, N_("Redo"),
IFSCHELP(nano_redo_msg), TRUE, NOVIEW);
}
#endif
add_to_funcs(DO_PAGE_UP, MBROWSER,
prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW);
add_to_funcs(DO_PAGE_DOWN, MBROWSER,
next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
add_to_funcs(DO_RIGHT, (MMAIN|MBROWSER), N_("Forward"), IFSCHELP(nano_forward_msg),
add_to_funcs(DO_RIGHT, MMAIN, N_("Forward"), IFSCHELP(nano_forward_msg),
FALSE, VIEW);
#ifndef DISABLE_BROWSER
add_to_funcs(DO_RIGHT, MBROWSER, N_("Forward"), IFSCHELP(nano_forwardfile_msg),
FALSE, VIEW);
#endif
add_to_funcs(DO_RIGHT, MALL, "", "", FALSE, VIEW);
add_to_funcs(DO_LEFT, (MMAIN|MBROWSER), N_("Back"), IFSCHELP(nano_back_msg),
add_to_funcs(DO_LEFT, MMAIN, N_("Back"), IFSCHELP(nano_back_msg),
FALSE, VIEW);
#ifndef DISABLE_BROWSER
add_to_funcs(DO_LEFT, MBROWSER, N_("Back"), IFSCHELP(nano_backfile_msg),
FALSE, VIEW);
#endif
add_to_funcs(DO_LEFT, MALL, "", "", FALSE, VIEW);
#ifndef NANO_TINY
@@ -994,6 +1007,10 @@ void shortcut_init(bool unjustify)
#ifndef DISABLE_HELP
add_to_funcs( REFRESH_MSG, MHELP,
refresh_msg, nano_refresh_msg, FALSE, VIEW);
add_to_funcs(DO_EXIT, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
#endif
#ifndef DISABLE_BROWSER
@@ -1012,12 +1029,15 @@ void shortcut_init(bool unjustify)
currmenu = MMAIN;
add_to_sclist(MALL, "^G", DO_HELP_VOID, 0, TRUE);
add_to_sclist(MALL, "F1", DO_HELP_VOID, 0, TRUE);
add_to_sclist(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR,
"^G", DO_HELP_VOID, 0, TRUE);
add_to_sclist(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR,
"F1", DO_HELP_VOID, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", DO_EXIT, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", DO_EXIT, 0, TRUE);
add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
add_to_sclist(MMAIN, "M-G", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
add_to_sclist(MMAIN, "^O", DO_WRITEOUT_VOID, 0, TRUE);
add_to_sclist(MMAIN, "F3", DO_WRITEOUT_VOID, 0, TRUE);
#ifndef DISABLE_JUSTIFY
@@ -1045,9 +1065,6 @@ void shortcut_init(bool unjustify)
add_to_sclist(MMAIN, "^T", DO_SPELL, 0, TRUE);
add_to_sclist(MMAIN, "F12", DO_SPELL, 0, TRUE);
#endif
add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
add_to_sclist(MMAIN, "M-G", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
add_to_sclist(MMAIN, "^\\", DO_REPLACE, 0, TRUE);
add_to_sclist(MMAIN, "F14", DO_REPLACE, 0, TRUE);
add_to_sclist(MMAIN, "M-R", DO_REPLACE, 0, TRUE);
@@ -1058,14 +1075,16 @@ void shortcut_init(bool unjustify)
add_to_sclist(MMAIN, "^^", DO_MARK, 0, TRUE);
add_to_sclist(MMAIN, "F15", DO_MARK, 0, TRUE);
add_to_sclist(MMAIN, "M-A", DO_MARK, 0, TRUE);
add_to_sclist(MALL, "M-W", DO_RESEARCH, 0, TRUE);
add_to_sclist(MALL, "F16", DO_RESEARCH, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER, "M-W", DO_RESEARCH, 0, TRUE);
add_to_sclist(MMAIN|MBROWSER, "F16", DO_RESEARCH, 0, TRUE);
add_to_sclist(MMAIN, "M-^", DO_COPY_TEXT, 0, TRUE);
add_to_sclist(MMAIN, "M-6", DO_COPY_TEXT, 0, TRUE);
add_to_sclist(MMAIN, "M-}", DO_INDENT_VOID, 0, TRUE);
add_to_sclist(MMAIN, "M-{", DO_UNINDENT, 0, TRUE);
add_to_sclist(MMAIN, "M-U", DO_UNDO, 0, TRUE);
add_to_sclist(MMAIN, "M-E", DO_REDO, 0, TRUE);
if (ISSET(UNDOABLE)) {
add_to_sclist(MMAIN, "M-U", DO_UNDO, 0, TRUE);
add_to_sclist(MMAIN, "M-E", DO_REDO, 0, TRUE);
}
add_to_sclist(MALL, "^F", DO_RIGHT, 0, TRUE);
add_to_sclist(MALL, "^B", DO_LEFT, 0, TRUE);
add_to_sclist(MMAIN, "^Space", DO_NEXT_WORD_VOID, 0, TRUE);
@@ -1075,10 +1094,10 @@ void shortcut_init(bool unjustify)
add_to_sclist(MALL, "kleft", DO_LEFT, 0, TRUE);
add_to_sclist(MMAIN, "^Q", XON_COMPLAINT, 0, TRUE);
add_to_sclist(MMAIN, "^S", XOFF_COMPLAINT, 0, TRUE);
add_to_sclist(MMAIN, "^P", DO_UP_VOID, 0, TRUE);
add_to_sclist(MMAIN, "kup", DO_UP_VOID, 0, TRUE);
add_to_sclist(MMAIN, "^N", DO_DOWN_VOID, 0, TRUE);
add_to_sclist(MMAIN, "kdown", DO_DOWN_VOID, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", DO_UP_VOID, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "kup", DO_UP_VOID, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", DO_DOWN_VOID, 0, TRUE);
add_to_sclist(MMAIN|MHELP|MBROWSER, "kdown", DO_DOWN_VOID, 0, TRUE);
add_to_sclist(MALL, "^A", DO_HOME, 0, TRUE);
add_to_sclist(MALL, "khome", DO_HOME, 0, TRUE);
add_to_sclist(MALL, "^E", DO_END, 0, TRUE);
@@ -1123,6 +1142,9 @@ void shortcut_init(bool unjustify)
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", FIRST_FILE_MSG, 0, TRUE);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", LAST_FILE_MSG, 0, TRUE);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", LAST_FILE_MSG, 0, TRUE);
add_to_sclist(MBROWSER|MWHEREISFILE, "^_", GOTO_DIR_MSG, 0, TRUE);
add_to_sclist(MBROWSER|MWHEREISFILE, "F13", GOTO_DIR_MSG, 0, TRUE);
add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", GOTO_DIR_MSG, 0, TRUE);
#ifndef NANO_TINY
add_to_sclist(MMAIN, "M-]", DO_FIND_BRACKET, 0, TRUE);
add_to_sclist(MMAIN, "M--", DO_SCROLL_UP, 0, TRUE);
@@ -1160,6 +1182,7 @@ void shortcut_init(bool unjustify)
add_to_sclist(MMAIN, "M-M", DO_TOGGLE, USE_MOUSE, TRUE);
add_to_sclist(MMAIN, "M-N", DO_TOGGLE, NO_CONVERT, TRUE);
add_to_sclist(MMAIN, "M-Z", DO_TOGGLE, SUSPEND, TRUE);
add_to_sclist(MMAIN, "M-$", DO_TOGGLE, SOFTWRAP, TRUE);
#endif
add_to_sclist(MGOTOLINE, "^T", GOTOTEXT_MSG, 0, FALSE);
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", NEW_BUFFER_MSG, 0, FALSE);
@@ -1214,7 +1237,7 @@ void iso_me_harder_funcmap(short func)
else if (func == DO_RIGHT)
do_right();
else if (func == DO_ENTER)
do_enter();
do_enter(FALSE);
else if (func == DO_EXIT)
do_exit();
else if (func == DO_FIRST_LINE)
@@ -1337,7 +1360,7 @@ const subnfunc *sctofunc(sc *s)
#ifndef NANO_TINY
/* Now lets come up with a single (hopefully)
function to get a string for each flag */
char *flagtostr(int flag)
const char *flagtostr(int flag)
{
switch (flag) {
case NO_HELP:
@@ -1372,6 +1395,8 @@ char *flagtostr(int flag)
return N_("No conversion from DOS/Mac format");
case SUSPEND:
return N_("Suspension");
case SOFTWRAP:
return N_("Soft line wrapping");
default:
return "?????";
}

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* help.c *
* *
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, *
* 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* move.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -29,45 +29,41 @@
/* Move to the first line of the file. */
void do_first_line(void)
{
filestruct *current_save = openfile->current;
size_t pww_save = openfile->placewewant;
openfile->current = openfile->fileage;
openfile->current = openfile->edittop = openfile->fileage;
openfile->current_x = 0;
openfile->placewewant = 0;
edit_redraw(current_save, pww_save);
edit_refresh_needed = 1;
}
/* Move to the last line of the file. */
void do_last_line(void)
{
filestruct *current_save = openfile->current;
size_t pww_save = openfile->placewewant;
openfile->current = openfile->filebot;
openfile->current_x = strlen(openfile->filebot->data);
openfile->placewewant = xplustabs();
openfile->current_y = editwinrows - 1;
edit_redraw(current_save, pww_save);
edit_refresh_needed = 1;
}
/* Move up one page. */
void do_page_up(void)
{
int i;
int i, skipped = 0;
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the first line of the file, and then
* update the edit window. */
if (openfile->current->lineno <= editwinrows - 2) {
if (openfile->current->lineno == 1 || (!ISSET(SOFTWRAP) &&
openfile->current->lineno <= editwinrows - 2)) {
do_first_line();
return;
}
/* If we're not in smooth scrolling mode, put the cursor at the
* beginning of the top line of the edit window, as Pico does. */
#ifndef NANO_TINY
if (!ISSET(SMOOTH_SCROLL)) {
#endif
@@ -77,15 +73,27 @@ void do_page_up(void)
}
#endif
for (i = editwinrows - 2; i > 0 && openfile->current !=
openfile->fileage; i--)
for (i = editwinrows - 2; i - skipped > 0 && openfile->current !=
openfile->fileage; i--) {
openfile->current = openfile->current->prev;
if (ISSET(SOFTWRAP) && openfile->current) {
skipped += strlenpt(openfile->current->data) / COLS;
#ifdef DEBUG
fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %ld len %d\n", i, (unsigned long) skipped,
openfile->current->lineno, strlenpt(openfile->current->data));
#endif
}
}
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
#ifdef DEBUG
fprintf(stderr, "do_page_up: openfile->current->lineno = %lu, skipped = %d\n", (unsigned long) openfile->current->lineno, skipped);
#endif
/* Scroll the edit window up a page. */
edit_scroll(UP_DIR, editwinrows - 2);
edit_update(NONE);
}
/* Move down one page. */
@@ -96,7 +104,7 @@ void do_page_down(void)
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the last line of the file, and then
* update the edit window. */
if (openfile->current->lineno + editwinrows - 2 >=
if (openfile->current->lineno + maxrows - 2 >=
openfile->filebot->lineno) {
do_last_line();
return;
@@ -113,15 +121,20 @@ void do_page_down(void)
}
#endif
for (i = editwinrows - 2; i > 0 && openfile->current !=
openfile->filebot; i--)
for (i = maxrows - 2; i > 0 && openfile->current !=
openfile->filebot; i--) {
openfile->current = openfile->current->next;
#ifdef DEBUG
fprintf(stderr, "do_page_down: moving to line %lu\n", (unsigned long) openfile->current->lineno);
#endif
}
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
/* Scroll the edit window down a page. */
edit_scroll(DOWN_DIR, editwinrows - 2);
edit_update(NONE);
}
#ifndef DISABLE_JUSTIFY
@@ -488,7 +501,7 @@ void do_up(
)
return;
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
/* Move the current line of the edit window up. */
openfile->current = openfile->current->prev;
@@ -500,7 +513,7 @@ void do_up(
* smooth scrolling mode, or up half a page if we're not. If
* scroll_only is TRUE, scroll the edit window up one line
* unconditionally. */
if (openfile->current_y == 0
if (openfile->current_y == 0 || (ISSET(SOFTWRAP) && openfile->edittop->lineno == openfile->current->next->lineno)
#ifndef NANO_TINY
|| scroll_only
#endif
@@ -509,7 +522,7 @@ void do_up(
#ifndef NANO_TINY
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
#endif
editwinrows / 2);
editwinrows / 2 + 1);
/* If we're below the first line of the edit window, update the
* line we were on before and the line we're on now. The former
@@ -550,38 +563,48 @@ void do_down(
#endif
)
{
bool onlastline = FALSE;
/* If we're at the bottom of the file, get out. */
if (openfile->current == openfile->filebot)
return;
assert(openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
assert(ISSET(SOFTWRAP) || openfile->current_y == openfile->current->lineno - openfile->edittop->lineno);
/* Move the current line of the edit window down. */
openfile->current = openfile->current->next;
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
if (ISSET(SOFTWRAP)) {
if (openfile->current->lineno - openfile->edittop->lineno >= maxrows)
onlastline = TRUE;
}
/* If scroll_only is FALSE and if we're on the first line of the
* edit window, scroll the edit window down one line if we're in
* smooth scrolling mode, or down half a page if we're not. If
* scroll_only is TRUE, scroll the edit window down one line
* unconditionally. */
if (openfile->current_y == editwinrows - 1
if (onlastline || openfile->current_y == editwinrows - 1
#ifndef NANO_TINY
|| scroll_only
#endif
)
) {
edit_scroll(DOWN_DIR,
#ifndef NANO_TINY
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
#endif
editwinrows / 2);
editwinrows / 2 + 1);
edit_refresh_needed = TRUE;
}
/* If we're above the last line of the edit window, update the line
* we were on before and the line we're on now. The former needs to
* be redrawn if we're not on the first page, and the latter needs
* to be drawn unconditionally. */
if (openfile->current_y < editwinrows - 1) {
if (ISSET(SOFTWRAP) || openfile->current_y < editwinrows - 1) {
if (need_vertical_update(0))
update_line(openfile->current->prev, 0);
update_line(openfile->current, openfile->current_x);

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* nano.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -394,11 +394,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
/* If the top of the edit window was inside the old partition, put
* it in range of current. */
if (edittop_inside)
edit_update(
#ifndef NANO_TINY
ISSET(SMOOTH_SCROLL) ? NONE :
#endif
CENTER);
edit_update(NONE);
/* Renumber starting with the beginning line of the old
* partition. */
@@ -522,6 +518,7 @@ openfilestruct *make_new_opennode(void)
newnode->edittop = NULL;
newnode->current = NULL;
#ifndef NANO_TINY
newnode->current_stat = NULL;
newnode->last_action = OTHER;
#endif
@@ -638,7 +635,11 @@ void die(const char *msg, ...)
if (filepart != NULL)
unpartition_filestruct(&filepart);
die_save_file(openfile->filename);
die_save_file(openfile->filename
#ifndef NANO_TINY
, openfile->current_stat
#endif
);
}
#ifdef ENABLE_MULTIBUFFER
@@ -651,7 +652,11 @@ void die(const char *msg, ...)
/* Save the current file buffer if it's been modified. */
if (openfile->modified)
die_save_file(openfile->filename);
die_save_file(openfile->filename
#ifndef NANO_TINY
, openfile->current_stat
#endif
);
}
}
#endif
@@ -662,7 +667,11 @@ void die(const char *msg, ...)
/* Save the current file under the name spacified in die_filename, which
* is modified to be unique if necessary. */
void die_save_file(const char *die_filename)
void die_save_file(const char *die_filename
#ifndef NANO_TINY
, struct stat *die_stat
#endif
)
{
char *retval;
bool failed = TRUE;
@@ -691,6 +700,17 @@ void die_save_file(const char *die_filename)
fprintf(stderr, _("\nBuffer not written: %s\n"),
_("Too many backup files?"));
#ifndef NANO_TINY
/* Try and chmod/chown the save file to the values of the original file, but
dont worry if it fails because we're supposed to be bailing as fast
as possible. */
if (die_stat) {
int shush;
shush = chmod(retval, die_stat->st_mode);
shush = chown(retval, die_stat->st_uid, die_stat->st_gid);
}
#endif
free(retval);
}
@@ -891,12 +911,17 @@ void usage(void)
#endif
print_opt("-t", "--tempfile",
N_("Auto save on exit, don't prompt"));
#ifndef NANO_TINY
print_opt("-u", "--undo", N_("Allow generic undo [EXPERIMENTAL]"));
#endif
print_opt("-v", "--view", N_("View mode (read-only)"));
#ifndef DISABLE_WRAPPING
print_opt("-w", "--nowrap", N_("Don't wrap long lines"));
#endif
print_opt("-x", "--nohelp", N_("Don't show the two help lines"));
print_opt("-z", "--suspend", N_("Enable suspension"));
print_opt("-$", "--softwrap", N_("Enable soft line wrapping"));
/* This is a special case. */
print_opt("-a, -b, -e,", "", NULL);
@@ -912,8 +937,8 @@ void version(void)
{
printf(_(" GNU nano version %s (compiled %s, %s)\n"), VERSION,
__TIME__, __DATE__);
printf(" (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007\n");
printf(" Free Software Foundation, Inc.\n");
printf(" (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,\n");
printf(" 2008, 2009 Free Software Foundation, Inc.\n");
printf(
_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org/"));
printf(_("\n Compiled options:"));
@@ -1055,7 +1080,7 @@ void finish_stdin_pager(void)
if (f == NULL)
nperror("fopen");
read_file(f, "stdin", TRUE);
read_file(f, 0, "stdin", TRUE, FALSE);
ttystdin = open("/dev/tty", O_RDONLY);
if (!ttystdin)
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
@@ -1160,11 +1185,9 @@ RETSIGTYPE do_suspend(int signal)
disable_mouse_support();
#endif
/* Blank the screen, and move the cursor to the last line of the
* screen. */
erase();
/* Move the cursor to the last line of the screen. */
move(LINES - 1, 0);
refresh();
endwin();
/* Display our helpful message. */
printf(_("Use \"fg\" to return to nano.\n"));
@@ -1329,6 +1352,9 @@ void do_toggle(int flag)
edit_refresh();
break;
#endif
case SOFTWRAP:
total_refresh();
break;
}
enabled = ISSET(flag);
@@ -1600,10 +1626,11 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
#endif
iso_me_harder_funcmap(s->scfunc);
#ifdef ENABLE_COLOR
if (!f->viewok && openfile->syntax != NULL
if (f && !f->viewok && openfile->syntax != NULL
&& openfile->syntax->nmultis > 0) {
reset_multis(openfile->current, FALSE);
}
#endif
if (edit_refresh_needed) {
#ifdef DEBUG
fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n");
@@ -1612,7 +1639,6 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
edit_refresh_needed = FALSE;
}
#endif
}
}
}
@@ -1659,17 +1685,53 @@ int do_mouse(void)
sameline = (mouse_y == openfile->current_y);
/* Move to where the click occurred. */
for (; openfile->current_y < mouse_y && openfile->current !=
openfile->filebot; openfile->current_y++)
openfile->current = openfile->current->next;
for (; openfile->current_y > mouse_y && openfile->current !=
openfile->fileage; openfile->current_y--)
openfile->current = openfile->current->prev;
#ifdef DEBUG
fprintf(stderr, "mouse_y = %d, current_y = %d\n", mouse_y, openfile->current_y);
#endif
openfile->current_x = actual_x(openfile->current->data,
if (ISSET(SOFTWRAP)) {
int i = 0;
for (openfile->current = openfile->edittop;
openfile->current->next && i < mouse_y;
openfile->current = openfile->current->next, i++) {
openfile->current_y = i;
i += strlenpt(openfile->current->data) / COLS;
}
#ifdef DEBUG
fprintf(stderr, "do_mouse(): moving to current_y = %d, i %d\n", openfile->current_y, i);
fprintf(stderr, " openfile->current->data = \"%s\"\n", openfile->current->data);
#endif
if (i > mouse_y) {
openfile->current = openfile->current->prev;
openfile->current_x = actual_x(openfile->current->data, mouse_x + (mouse_y - openfile->current_y) * COLS);
#ifdef DEBUG
fprintf(stderr, "do_mouse(): i > mouse_y, mouse_x = %d, current_x to = %d\n", mouse_x, openfile->current_x);
#endif
} else {
openfile->current_x = actual_x(openfile->current->data, mouse_x);
#ifdef DEBUG
fprintf(stderr, "do_mouse(): i <= mouse_y, mouse_x = %d, setting current_x to = %d\n", mouse_x, openfile->current_x);
#endif
}
openfile->placewewant = xplustabs();
} else {
/* Move to where the click occurred. */
for (; openfile->current_y < mouse_y && openfile->current !=
openfile->filebot; openfile->current_y++)
openfile->current = openfile->current->next;
for (; openfile->current_y > mouse_y && openfile->current !=
openfile->fileage; openfile->current_y--)
openfile->current = openfile->current->prev;
openfile->current_x = actual_x(openfile->current->data,
get_page_start(xplustabs()) + mouse_x);
openfile->placewewant = xplustabs();
openfile->placewewant = xplustabs();
}
#ifndef NANO_TINY
/* Clicking where the cursor is toggles the mark, as does
@@ -1690,7 +1752,7 @@ int do_mouse(void)
void alloc_multidata_if_needed(filestruct *fileptr)
{
if (!fileptr->multidata)
fileptr->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
}
/* Precalculate the multi-line start and end regex info so we can speed up
@@ -1729,7 +1791,7 @@ void precalc_multicolorinfo(void)
#ifdef DEBUG
fprintf(stderr, "working on lineno %d\n", fileptr->lineno);
fprintf(stderr, "working on lineno %lu\n", (unsigned long) fileptr->lineno);
#endif
alloc_multidata_if_needed(fileptr);
@@ -1762,7 +1824,7 @@ void precalc_multicolorinfo(void)
for (endptr = fileptr->next; endptr != NULL; endptr = endptr->next) {
#ifdef DEBUG
fprintf(stderr, "advancing to line %d to find end...\n", endptr->lineno);
fprintf(stderr, "advancing to line %lu to find end...\n", (unsigned long) endptr->lineno);
#endif
/* Check for keyboard input again */
if ((cur_check = time(NULL)) - last_check > 1) {
@@ -1790,18 +1852,18 @@ void precalc_multicolorinfo(void)
lines in between and the ends properly */
fileptr->multidata[tmpcolor->id] |= CENDAFTER;
#ifdef DEBUG
fprintf(stderr, "marking line %d as CENDAFTER\n", fileptr->lineno);
fprintf(stderr, "marking line %lu as CENDAFTER\n", (unsigned long) fileptr->lineno);
#endif
for (fileptr = fileptr->next; fileptr != endptr; fileptr = fileptr->next) {
alloc_multidata_if_needed(fileptr);
fileptr->multidata[tmpcolor->id] = CWHOLELINE;
#ifdef DEBUG
fprintf(stderr, "marking intermediary line %d as CWHOLELINE\n", fileptr->lineno);
fprintf(stderr, "marking intermediary line %lu as CWHOLELINE\n", (unsigned long) fileptr->lineno);
#endif
}
alloc_multidata_if_needed(endptr);
#ifdef DEBUG
fprintf(stderr, "marking line %d as BEGINBEFORE\n", fileptr->lineno);
fprintf(stderr, "marking line %lu as BEGINBEFORE\n", (unsigned long) fileptr->lineno);
#endif
endptr->multidata[tmpcolor->id] |= CBEGINBEFORE;
/* We should be able to skip all the way to the line of the match.
@@ -1809,12 +1871,12 @@ void precalc_multicolorinfo(void)
fileptr = endptr;
startx = endmatch.rm_eo;
#ifdef DEBUG
fprintf(stderr, "jumping to line %d pos %d to continue\n", endptr->lineno, startx);
fprintf(stderr, "jumping to line %lu pos %d to continue\n", (unsigned long) endptr->lineno, startx);
#endif
}
if (nostart && startx == 0) {
#ifdef DEBUG
fprintf(stderr, "no start found on line %d, continuing\n", fileptr->lineno);
fprintf(stderr, "no start found on line %lu, continuing\n", (unsigned long) fileptr->lineno);
#endif
fileptr->multidata[tmpcolor->id] = CNONE;
continue;
@@ -1832,17 +1894,15 @@ precalc_cleanup:
* TRUE. */
void do_output(char *output, size_t output_len, bool allow_cntrls)
{
size_t current_len, i = 0;
bool do_refresh = FALSE;
/* Do we have to call edit_refresh(), or can we get away with
* just update_line()? */
size_t current_len, orig_lenpt, i = 0;
char *char_buf = charalloc(mb_cur_max());
int char_buf_len;
assert(openfile->current != NULL && openfile->current->data != NULL);
current_len = strlen(openfile->current->data);
if (ISSET(SOFTWRAP))
orig_lenpt = strlenpt(openfile->current->data);
while (i < output_len) {
/* If allow_cntrls is TRUE, convert nulls and newlines
@@ -1853,7 +1913,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
output[i] = '\n';
/* Newline to Enter, if needed. */
else if (output[i] == '\n') {
do_enter();
do_enter(FALSE);
i++;
continue;
}
@@ -1906,26 +1966,25 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifndef DISABLE_WRAPPING
/* If we're wrapping text, we need to call edit_refresh(). */
if (!ISSET(NO_WRAP)) {
bool do_refresh_save = do_refresh;
do_refresh = do_wrap(openfile->current);
/* If we needed to call edit_refresh() before this, we'll
* still need to after this. */
if (do_refresh_save)
do_refresh = TRUE;
}
if (!ISSET(NO_WRAP))
if (do_wrap(openfile->current, FALSE))
edit_refresh_needed = TRUE;
#endif
#ifdef ENABLE_COLOR
/* If color syntaxes are available and turned on, we need to
* call edit_refresh(). */
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
do_refresh = TRUE;
edit_refresh_needed = TRUE;
#endif
}
/* Well we might also need a full refresh if we've changed the
line length to be a new multiple of COLS */
if (ISSET(SOFTWRAP) && edit_refresh_needed == FALSE)
if (strlenpt(openfile->current->data) / COLS != orig_lenpt / COLS)
edit_refresh_needed = TRUE;
free(char_buf);
openfile->placewewant = xplustabs();
@@ -1934,7 +1993,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
#ifdef ENABLE_COLOR
reset_multis(openfile->current, FALSE);
#endif
if (do_refresh) {
if (edit_refresh_needed == TRUE) {
edit_refresh();
edit_refresh_needed = FALSE;
} else
@@ -2012,9 +2071,11 @@ int main(int argc, char **argv)
{"noconvert", 0, NULL, 'N'},
{"smooth", 0, NULL, 'S'},
{"quickblank", 0, NULL, 'U'},
{"undo", 0, NULL, 'u'},
{"wordbounds", 0, NULL, 'W'},
{"autoindent", 0, NULL, 'i'},
{"cut", 0, NULL, 'k'},
{"softwrap", 0, NULL, '$'},
#endif
{NULL, 0, NULL, 0}
};
@@ -2053,11 +2114,11 @@ int main(int argc, char **argv)
while ((optchr =
#ifdef HAVE_GETOPT_LONG
getopt_long(argc, argv,
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tvwxz",
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz$",
long_options, NULL)
#else
getopt(argc, argv,
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tvwxz")
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz$")
#endif
) != -1) {
switch (optchr) {
@@ -2206,12 +2267,22 @@ int main(int argc, char **argv)
case 't':
SET(TEMP_FILE);
break;
#ifndef NANO_TINY
case 'u':
SET(UNDOABLE);
break;
#endif
case 'v':
SET(VIEW_MODE);
break;
#ifndef DISABLE_WRAPPING
case 'w':
SET(NO_WRAP);
/* If both --fill and --nowrap are given on the command line,
the last option wins, */
fill_used = FALSE;
break;
#endif
case 'x':
@@ -2220,6 +2291,11 @@ int main(int argc, char **argv)
case 'z':
SET(SUSPEND);
break;
#ifndef NANO_TINY
case '$':
SET(SOFTWRAP);
break;
#endif
default:
usage();
}
@@ -2267,7 +2343,10 @@ int main(int argc, char **argv)
char *alt_speller_cpy = alt_speller;
#endif
ssize_t tabsize_cpy = tabsize;
long flags_cpy = flags;
unsigned flags_cpy[sizeof(flags) / sizeof(flags[0])];
size_t i;
memcpy(flags_cpy, flags, sizeof(flags_cpy));
#ifndef DISABLE_OPERATINGDIR
operating_dir = NULL;
@@ -2319,7 +2398,9 @@ int main(int argc, char **argv)
#endif
if (tabsize_cpy != -1)
tabsize = tabsize_cpy;
flags |= flags_cpy;
for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++)
flags[i] |= flags_cpy[i];
}
#ifdef DISABLE_ROOTWRAPPING
/* If we don't have any rcfiles, --disable-wrapping-as-root is used,
@@ -2329,6 +2410,13 @@ int main(int argc, char **argv)
#endif
#endif /* ENABLE_NANORC */
#ifndef DISABLE_WRAPPING
/* Overwrite an rcfile "set nowrap" or --disable-wrapping-as-root
if a --fill option was given on the command line. */
if (fill_used)
UNSET(NO_WRAP);
#endif
/* If we're using bold text instead of reverse video text, set it up
* now. */
if (ISSET(BOLD_TEXT))

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* nano.h *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -28,6 +28,12 @@
#include <config.h>
#endif
#ifdef NEED_XOPEN_SOURCE_EXTENDED
#ifndef _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED 1
#endif /* _XOPEN_SOURCE_EXTENDED */
#endif /* NEED_XOPEN_SOURCE_EXTENDED */
#ifdef __TANDEM
/* Tandem NonStop Kernel support. */
#include <floss.h>
@@ -44,11 +50,21 @@
#include <sys/param.h>
#endif
#ifdef HAVE_STDARG_H
#include <stdarg.h>
#endif
/* Suppress warnings for __attribute__((warn_unused_result)) */
#define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0)
/* Macros for flags. */
#define SET(bit) flags |= bit
#define UNSET(bit) flags &= ~bit
#define ISSET(bit) ((flags & bit) != 0)
#define TOGGLE(bit) flags ^= bit
#define FLAGOFF(flag) ((flag) / (sizeof(unsigned) * 8))
#define FLAGMASK(flag) (1 << ((flag) % (sizeof(unsigned) * 8)))
#define FLAGS(flag) flags[FLAGOFF(flag)]
#define SET(flag) FLAGS(flag) |= FLAGMASK(flag)
#define UNSET(flag) FLAGS(flag) &= ~FLAGMASK(flag)
#define ISSET(flag) ((FLAGS(flag) & FLAGMASK(flag)) != 0)
#define TOGGLE(flag) FLAGS(flag) ^= FLAGMASK(flag)
/* Macros for character allocation and more. */
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
@@ -170,7 +186,7 @@ typedef enum {
} function_type;
typedef enum {
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, INSERT, OTHER
ADD, DEL, REPLACE, SPLIT, UNSPLIT, CUT, UNCUT, ENTER, INSERT, OTHER
} undo_type;
#ifdef ENABLE_COLOR
@@ -282,6 +298,8 @@ typedef struct undo {
/* Where did this action begin or end */
char *strdata;
/* String type data we will use for ccopying the affected line back */
char *strdata2;
/* Sigh, need this too it looks like */
int xflags;
/* Some flag data we need */
@@ -438,40 +456,46 @@ typedef struct subnfunc {
} subnfunc;
/* Bitwise flags so that we can save space (or, more correctly, not
* waste it). */
#define CASE_SENSITIVE (1<<0)
#define CONST_UPDATE (1<<1)
#define NO_HELP (1<<2)
#define NOFOLLOW_SYMLINKS (1<<3)
#define SUSPEND (1<<4)
#define NO_WRAP (1<<5)
#define AUTOINDENT (1<<6)
#define VIEW_MODE (1<<7)
#define USE_MOUSE (1<<8)
#define USE_REGEXP (1<<9)
#define TEMP_FILE (1<<10)
#define CUT_TO_END (1<<11)
#define BACKWARDS_SEARCH (1<<12)
#define MULTIBUFFER (1<<13)
#define SMOOTH_SCROLL (1<<14)
#define REBIND_DELETE (1<<15)
#define REBIND_KEYPAD (1<<16)
#define NO_CONVERT (1<<17)
#define BACKUP_FILE (1<<18)
#define NO_COLOR_SYNTAX (1<<19)
#define PRESERVE (1<<20)
#define HISTORYLOG (1<<21)
#define RESTRICTED (1<<22)
#define SMART_HOME (1<<23)
#define WHITESPACE_DISPLAY (1<<24)
#define MORE_SPACE (1<<25)
#define TABS_TO_SPACES (1<<26)
#define QUICK_BLANK (1<<27)
#define WORD_BOUNDS (1<<28)
#define NO_NEWLINES (1<<29)
#define BOLD_TEXT (1<<30)
#define QUIET (1<<31)
/* Enumeration to be used in flags table. See FLAGBIT and FLAGOFF
* definitions. */
enum
{
DONTUSE,
CASE_SENSITIVE,
CONST_UPDATE,
NO_HELP,
NOFOLLOW_SYMLINKS,
SUSPEND,
NO_WRAP,
AUTOINDENT,
VIEW_MODE,
USE_MOUSE,
USE_REGEXP,
TEMP_FILE,
CUT_TO_END,
BACKWARDS_SEARCH,
MULTIBUFFER,
SMOOTH_SCROLL,
REBIND_DELETE,
REBIND_KEYPAD,
NO_CONVERT,
BACKUP_FILE,
NO_COLOR_SYNTAX,
PRESERVE,
HISTORYLOG,
RESTRICTED,
SMART_HOME,
WHITESPACE_DISPLAY,
MORE_SPACE,
TABS_TO_SPACES,
QUICK_BLANK,
WORD_BOUNDS,
NO_NEWLINES,
BOLD_TEXT,
QUIET,
UNDOABLE,
SOFTWRAP
};
/* Flags for which menus in which a given function should be present */
#define MMAIN (1<<0)
@@ -720,6 +744,7 @@ typedef struct subnfunc {
/* Extra bits for the undo function */
#define UNDO_DEL_DEL (1<<0)
#define UNDO_DEL_BACKSPACE (1<<1)
#define UNDO_SPLIT_MADENEW (1<<2)
/* Since in ISO C you can't pass around function pointers anymore,
let's make some integer macros for function names, and then I

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* prompt.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -229,7 +229,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
f = sctofunc((sc *) s);
if (s->scfunc != 0 && s->execute == TRUE) {
*ran_func = TRUE;
if (!ISSET(VIEW_MODE) || f->viewok)
if (f && (!ISSET(VIEW_MODE) || (f->viewok)))
iso_me_harder_funcmap(f->scfunc);
}
*finished = TRUE;
@@ -868,7 +868,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
free(expanded);
wattroff(bottomwin, reverse_attr);
statusbar_pww = statusbar_xplustabs();
reset_statusbar_cursor();
wnoutrefresh(bottomwin);
}
@@ -956,7 +956,7 @@ const sc *get_prompt_string(int *actual, bool allow_tabs,
currmenu = menu;
#ifdef DEBUG
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer, statusbar_x);
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
#endif
update_statusbar_line(answer, statusbar_x);
@@ -1070,7 +1070,6 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
}
} else
#endif /* !NANO_TINY */
#ifndef DISABLE_HELP
if (s && s->scfunc == DO_HELP_VOID) {
update_statusbar_line(answer, statusbar_x);
@@ -1082,7 +1081,6 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
* prompt. */
finished = FALSE;
}
#endif
/* If we have a shortcut with an associated function, break out
* if we're finished after running or trying to run the

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* proto.h *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -30,6 +30,7 @@
#ifndef NANO_TINY
extern sigjmp_buf jump_buf;
extern bool jump_buf_main;
extern bool use_undo;
#endif
#ifndef DISABLE_WRAPJUSTIFY
@@ -40,11 +41,12 @@ extern ssize_t wrap_at;
extern char *last_search;
extern char *last_replace;
extern long flags;
extern unsigned flags[4];
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
extern int maxrows;
extern filestruct *cutbuffer;
extern filestruct *cutbottom;
@@ -76,7 +78,7 @@ extern char *quoteerr;
extern size_t quotelen;
#endif
#endif
bool nodelay_mode;
extern bool nodelay_mode;
extern char *answer;
extern ssize_t tabsize;
@@ -269,7 +271,7 @@ bool close_buffer(void);
#endif
filestruct *read_line(char *buf, filestruct *prevnode, bool
*first_line_ins, size_t buf_len);
void read_file(FILE *f, const char *filename, bool undoable);
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
int open_file(const char *filename, bool newfie, FILE **f);
char *get_next_filename(const char *name, const char *suffix);
void do_insertfile(
@@ -426,7 +428,11 @@ void free_openfilestruct(openfilestruct *src);
void print_view_warning(void);
void finish(void);
void die(const char *msg, ...);
void die_save_file(const char *die_filename);
void die_save_file(const char *die_filename
#ifndef NANO_TINY
, struct stat *die_stat
#endif
);
void window_init(void);
#ifndef DISABLE_MOUSE
void disable_mouse_support(void);
@@ -624,14 +630,14 @@ void do_unindent(void);
void do_undo(void);
void do_redo(void);
#endif
void do_enter(void);
void do_enter(bool undoing);
#ifndef NANO_TINY
RETSIGTYPE cancel_command(int signal);
bool execute_command(const char *command);
#endif
#ifndef DISABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
bool do_wrap(filestruct *line, bool undoing);
#endif
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal
@@ -764,7 +770,7 @@ void onekey(const char *keystroke, const char *desc, size_t len);
void reset_cursor(void);
void edit_draw(filestruct *fileptr, const char *converted, int
line, size_t start);
void update_line(filestruct *fileptr, size_t index);
int update_line(filestruct *fileptr, size_t index);
bool need_horizontal_update(size_t pww_save);
bool need_vertical_update(size_t pww_save);
void edit_scroll(scroll_dir direction, ssize_t nlines);
@@ -777,12 +783,12 @@ void display_main_list(void);
void do_cursorpos(bool constant);
void do_cursorpos_void(void);
void do_replace_highlight(bool highlight, const char *word);
char *flagtostr(int flag);
const char *flagtostr(int flag);
const subnfunc *sctofunc(sc *s);
const subnfunc *getfuncfromkey(WINDOW *win);
void print_sclist(void);
sc *strtosc(int menu, char *input);
function_type strtokeytype(char *str);
function_type strtokeytype(const char *str);
int strtomenu(char *input);
void assign_keyinfo(sc *s);
void xon_complaint(void);
@@ -790,40 +796,36 @@ void xoff_complaint(void);
int sc_seq_or (short func, int defaultval);
void do_suspend_void(void);
const char *cancel_msg;
extern const char *cancel_msg;
#ifndef NANO_TINY
const char *case_sens_msg;
const char *backwards_msg;
const char *prev_history_msg;
const char *next_history_msg;
extern const char *case_sens_msg;
extern const char *backwards_msg;
extern const char *prev_history_msg;
extern const char *next_history_msg;
#endif
const char *replace_msg;
const char *no_replace_msg;
const char *go_to_line_msg;
const char *whereis_next_msg;
const char *first_file_msg;
const char *last_file_msg;
const char *goto_dir_msg;
const char *ext_cmd_msg;
const char *to_files_msg;
const char *dos_format_msg;
const char *mac_format_msg;
const char *append_msg;
const char *prepend_msg;
const char *backup_file_msg;
const char *dos_format_msg;
const char *mac_format_msg;
const char *append_msg;
const char *prepend_msg;
const char *backup_file_msg;
const char *gototext_msg;
const char *new_buffer_msg;
extern const char *replace_msg;
extern const char *no_replace_msg;
extern const char *go_to_line_msg;
extern const char *whereis_next_msg;
extern const char *first_file_msg;
extern const char *last_file_msg;
extern const char *goto_dir_msg;
extern const char *ext_cmd_msg;
extern const char *to_files_msg;
extern const char *dos_format_msg;
extern const char *mac_format_msg;
extern const char *append_msg;
extern const char *prepend_msg;
extern const char *backup_file_msg;
extern const char *gototext_msg;
extern const char *new_buffer_msg;
void iso_me_harder_funcmap(short func);
void enable_nodelay(void);
void disable_nodelay(void);
#ifdef HAVE_REGEX_H
const char *regexp_msg;
extern const char *regexp_msg;
#endif
#ifdef NANO_EXTRA

View File

@@ -2,7 +2,7 @@
/**************************************************************************
* rcfile.c *
* *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 *
* Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@@ -89,8 +89,10 @@ static const rcoption rcopts[] = {
{"smarthome", SMART_HOME},
{"smooth", SMOOTH_SCROLL},
{"tabstospaces", TABS_TO_SPACES},
{"undo", UNDOABLE},
{"whitespace", 0},
{"wordbounds", WORD_BOUNDS},
{"softwrap", SOFTWRAP},
#endif
{NULL, 0}
};
@@ -416,6 +418,7 @@ void parse_keybinding(char *ptr)
return;
}
menu = strtomenu(menuptr);
newsc = strtosc(menu, funcptr);
if (newsc == NULL) {
rcfile_error(
@@ -423,7 +426,6 @@ void parse_keybinding(char *ptr)
return;
}
menu = strtomenu(menuptr);
if (menu < 1) {
rcfile_error(
N_("Could not map name \"%s\" to a menu"), menuptr);
@@ -452,7 +454,6 @@ void parse_keybinding(char *ptr)
return;
}
/* now let's have some fun. Try and delete the other entries
we found for the same menu, then make this new new
beginning */
@@ -468,6 +469,70 @@ void parse_keybinding(char *ptr)
sclist = newsc;
}
/* Let user unbind a sequence from a given (or all) menus */
void parse_unbinding(char *ptr)
{
char *keyptr = NULL, *keycopy = NULL, *menuptr = NULL;
sc *s;
int i, menu;
assert(ptr != NULL);
if (*ptr == '\0') {
rcfile_error(N_("Missing key name"));
return;
}
keyptr = ptr;
ptr = parse_next_word(ptr);
keycopy = mallocstrcpy(NULL, keyptr);
for (i = 0; i < strlen(keycopy); i++)
keycopy[i] = toupper(keycopy[i]);
#ifdef DEBUG
fprintf(stderr, "Starting unbinding code");
#endif
if (keycopy[0] != 'M' && keycopy[0] != '^' && keycopy[0] != 'F' && keycopy[0] != 'K') {
rcfile_error(
N_("keybindings must begin with \"^\", \"M\", or \"F\""));
return;
}
menuptr = ptr;
ptr = parse_next_word(ptr);
if (!strcmp(menuptr, "")) {
rcfile_error(
/* Note to translators, do not translate the word "all"
in the sentence below, everything else is fine */
N_("Must specify menu to bind key to (or \"all\")"));
return;
}
menu = strtomenu(menuptr);
if (menu < 1) {
rcfile_error(
N_("Could not map name \"%s\" to a menu"), menuptr);
return;
}
#ifdef DEBUG
fprintf(stderr, "unbinding \"%s\" from menu = %d\n", keycopy, menu);
#endif
/* Now find the apropriate entries in the menu to delete */
for (s = sclist; s != NULL; s = s->next) {
if (((s->menu & menu)) && !strcmp(s->keystr,keycopy)) {
s->menu &= ~menu;
#ifdef DEBUG
fprintf(stderr, "deleted menu entry %d\n", s->menu);
#endif
}
}
}
/* Read and parse additional syntax files. */
void parse_include(char *ptr)
@@ -827,7 +892,7 @@ void parse_rcfile(FILE *rcstream
{
char *buf = NULL;
ssize_t len;
size_t n;
size_t n = 0;
while ((len = getline(&buf, &n, rcstream)) > 0) {
char *ptr, *keyword, *option;
@@ -893,6 +958,8 @@ void parse_rcfile(FILE *rcstream
parse_colors(ptr, TRUE);
else if (strcasecmp(keyword, "bind") == 0)
parse_keybinding(ptr);
else if (strcasecmp(keyword, "unbind") == 0)
parse_unbinding(ptr);
#endif /* ENABLE_COLOR */
else
rcfile_error(N_("Command \"%s\" not understood"), keyword);
@@ -1045,6 +1112,9 @@ void parse_rcfile(FILE *rcstream
else
rcfile_error(N_("Cannot unset flag \"%s\""),
rcopts[i].name);
/* Looks like we still need this specific hack for undo */
if (strcasecmp(rcopts[i].name, "undo") == 0)
shortcut_init(0);
break;
}
}

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* search.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -1357,7 +1357,7 @@ void update_history(filestruct **h, const char *s)
assert(hage != NULL && hbot != NULL);
/* If this string is already in the history, delete it. */
p = find_history(*hage, *hbot, s, (size_t)-1);
p = find_history(*hage, *hbot, s, strlen(s));
if (p != NULL) {
filestruct *foo, *bar;

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* text.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -66,9 +66,7 @@ void do_mark(void)
/* Delete the character under the cursor. */
void do_delete(void)
{
bool do_refresh = FALSE;
/* Do we have to call edit_refresh(), or can we get away with
* just update_line()? */
size_t orig_lenpt = 0;
#ifndef NANO_TINY
update_undo(DEL);
@@ -86,6 +84,9 @@ void do_delete(void)
assert(openfile->current_x < strlen(openfile->current->data));
if (ISSET(SOFTWRAP))
orig_lenpt = strlenpt(openfile->current->data);
/* Let's get dangerous. */
charmove(&openfile->current->data[openfile->current_x],
&openfile->current->data[openfile->current_x +
@@ -108,7 +109,7 @@ void do_delete(void)
/* If we're deleting at the end of a line, we need to call
* edit_refresh(). */
if (openfile->current->data[openfile->current_x] == '\0')
do_refresh = TRUE;
edit_refresh_needed = TRUE;
openfile->current->data = charealloc(openfile->current->data,
openfile->current_x + strlen(foo->data) + 1);
@@ -138,11 +139,13 @@ void do_delete(void)
} else
return;
if (ISSET(SOFTWRAP) && edit_refresh_needed == FALSE)
if (strlenpt(openfile->current->data) / COLS != orig_lenpt / COLS)
edit_refresh_needed = TRUE;
set_modified();
if (do_refresh)
edit_refresh_needed = TRUE;
else
if (edit_refresh_needed == FALSE)
update_line(openfile->current, openfile->current_x);
}
@@ -181,7 +184,7 @@ void do_tab(void)
free(output);
} else {
#endif
do_output("\t", 1, TRUE);
do_output((char *) "\t", 1, TRUE);
#ifndef NANO_TINY
}
#endif
@@ -360,21 +363,25 @@ void do_unindent(void)
/* undo a cut, or re-do an uncut */
void undo_cut(undo *u)
{
cutbuffer = copy_filestruct(u->cutbuffer);
/* If we cut the magicline may was well not crash :/ */
if (!u->cutbuffer)
return;
/* Compute cutbottom for the uncut using out copy */
for (cutbottom = cutbuffer; cutbottom->next != NULL; cutbottom = cutbottom->next)
;
cutbuffer = copy_filestruct(u->cutbuffer);
/* Get to where we need to uncut from */
if (u->mark_set && u->mark_begin_lineno < u->lineno)
do_gotolinecolumn(u->mark_begin_lineno, u->mark_begin_x+1, FALSE, FALSE, FALSE, FALSE);
else
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
/* Compute cutbottom for the uncut using out copy */
for (cutbottom = cutbuffer; cutbottom->next != NULL; cutbottom = cutbottom->next)
;
copy_from_filestruct(cutbuffer, cutbottom);
free_filestruct(cutbuffer);
cutbuffer = NULL;
/* Get to where we need to uncut from */
if (u->mark_set && u->mark_begin_lineno < u->lineno)
do_gotolinecolumn(u->mark_begin_lineno, u->mark_begin_x+1, FALSE, FALSE, FALSE, FALSE);
else
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
copy_from_filestruct(cutbuffer, cutbottom);
free_filestruct(cutbuffer);
cutbuffer = NULL;
}
@@ -383,40 +390,44 @@ void redo_cut(undo *u) {
int i;
filestruct *t, *c;
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
openfile->mark_set = u->mark_set;
if (cutbuffer)
free(cutbuffer);
cutbuffer = NULL;
/* If we cut the magicline may was well not crash :/ */
if (!u->cutbuffer)
return;
/* Move ahead the same # lines we had if a marked cut */
if (u->mark_set) {
for (i = 1, t = openfile->fileage; i != u->mark_begin_lineno; i++)
t = t->next;
openfile->mark_begin = t;
} else if (!u->to_end) {
/* Here we have a regular old potentially multi-line ^K cut. We'll
need to trick nano into thinking it's a marked cut to cut more
than one line again */
for (c = u->cutbuffer, t = openfile->current; c->next != NULL && t->next != NULL; ) {
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
openfile->mark_set = u->mark_set;
if (cutbuffer)
free(cutbuffer);
cutbuffer = NULL;
/* Move ahead the same # lines we had if a marked cut */
if (u->mark_set) {
for (i = 1, t = openfile->fileage; i != u->mark_begin_lineno; i++)
t = t->next;
openfile->mark_begin = t;
} else if (!u->to_end) {
/* Here we have a regular old potentially multi-line ^K cut. We'll
need to trick nano into thinking it's a marked cut to cut more
than one line again */
for (c = u->cutbuffer, t = openfile->current; c->next != NULL && t->next != NULL; ) {
#ifdef DEBUG
fprintf(stderr, "Advancing, lineno = %d, data = \"%s\"\n", t->lineno, t->data);
fprintf(stderr, "Advancing, lineno = %lu, data = \"%s\"\n", (unsigned long) t->lineno, t->data);
#endif
c = c->next;
t = t->next;
}
openfile->mark_begin = t;
openfile->mark_begin_x = 0;
openfile->mark_set = TRUE;
}
c = c->next;
t = t->next;
}
openfile->mark_begin = t;
openfile->mark_begin_x = 0;
openfile->mark_set = TRUE;
}
openfile->mark_begin_x = u->mark_begin_x;
do_cut_text(FALSE, u->to_end, TRUE);
openfile->mark_set = FALSE;
openfile->mark_begin = NULL;
openfile->mark_begin_x = 0;
edit_refresh_needed = TRUE;
openfile->mark_begin_x = u->mark_begin_x;
do_cut_text(FALSE, u->to_end, TRUE);
openfile->mark_set = FALSE;
openfile->mark_begin = NULL;
openfile->mark_begin_x = 0;
edit_refresh_needed = TRUE;
}
/* Undo the last thing(s) we did */
@@ -473,17 +484,21 @@ void do_undo(void)
if (u->xflags == UNDO_DEL_BACKSPACE)
openfile->current_x += strlen(u->strdata);
break;
#ifndef DISABLE_WRAPPING
case SPLIT:
undidmsg = _("line split");
free(f->data);
f->data = mallocstrcpy(NULL, u->strdata);
if (f->next != NULL) {
filestruct *tmp = f->next;
unlink_node(tmp);
delete_node(tmp);
undidmsg = _("line wrap");
f->data = (char *) nrealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
strcpy(&f->data[strlen(f->data) - 1], u->strdata);
if (u->strdata2 != NULL)
f->next->data = mallocstrcpy(f->next->data, u->strdata2);
else {
filestruct *foo = openfile->current->next;
unlink_node(foo);
delete_node(foo);
}
renumber(f);
break;
#endif /* DISABLE_WRAPPING */
case UNSPLIT:
undidmsg = _("line join");
t = make_new_node(f);
@@ -503,6 +518,16 @@ void do_undo(void)
undidmsg = _("text uncut");
redo_cut(u);
break;
case ENTER:
undidmsg = _("line break");
if (f->next) {
filestruct *foo = f->next;
f->data = (char *) nrealloc(f->data, strlen(f->data) + strlen(f->next->data) + 1);
strcat(f->data, f->next->data);
unlink_node(foo);
delete_node(foo);
}
break;
case INSERT:
undidmsg = _("text insert");
cutbuffer = NULL;
@@ -527,11 +552,13 @@ void do_undo(void)
u->strdata = f->data;
f->data = data;
break;
default:
undidmsg = _("Internal error: unknown type. Please save your work");
break;
}
renumber(f);
do_gotolinecolumn(u->lineno, u->begin, FALSE, FALSE, FALSE, TRUE);
statusbar(_("Undid action (%s)"), undidmsg);
openfile->current_undo = openfile->current_undo->next;
@@ -541,7 +568,7 @@ void do_undo(void)
void do_redo(void)
{
undo *u = openfile->undotop;
filestruct *f = openfile->current, *t;
filestruct *f = openfile->current;
int len = 0;
char *undidmsg, *data;
@@ -591,17 +618,20 @@ void do_redo(void)
free(f->data);
f->data = data;
break;
case ENTER:
undidmsg = _("line break");
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
do_enter(TRUE);
break;
#ifndef DISABLE_WRAPPING
case SPLIT:
undidmsg = _("line split");
t = make_new_node(f);
t->data = mallocstrcpy(NULL, &u->strdata[u->begin]);
data = mallocstrncpy(NULL, f->data, u->begin);
data[u->begin] = '\0';
free(f->data);
f->data = data;
splice_node(f, t, f->next);
undidmsg = _("line wrap");
if (u->xflags & UNDO_SPLIT_MADENEW)
prepend_wrap = TRUE;
do_wrap(f, TRUE);
renumber(f);
break;
#endif /* DISABLE_WRAPPING */
case UNSPLIT:
undidmsg = _("line join");
len = strlen(f->data) + strlen(u->strdata + 1);
@@ -652,7 +682,7 @@ void do_redo(void)
#endif /* !NANO_TINY */
/* Someone hits Enter *gasp!* */
void do_enter(void)
void do_enter(bool undoing)
{
filestruct *newnode = make_new_node(openfile->current);
size_t extra = 0;
@@ -660,7 +690,8 @@ void do_enter(void)
assert(openfile->current != NULL && openfile->current->data != NULL);
#ifndef NANO_TINY
update_undo(SPLIT);
if (!undoing)
add_undo(ENTER);
/* Do auto-indenting, like the neolithic Turbo Pascal editor. */
@@ -741,7 +772,7 @@ bool execute_command(const char *command)
* arguments. */
shellenv = getenv("SHELL");
if (shellenv == NULL)
shellenv = "/bin/sh";
shellenv = (char *) "/bin/sh";
/* Fork a child. */
if ((pid = fork()) == 0) {
@@ -788,7 +819,7 @@ bool execute_command(const char *command)
if (f == NULL)
nperror("fdopen");
read_file(f, "stdin", TRUE);
read_file(f, 0, "stdin", TRUE, FALSE);
if (wait(NULL) == -1)
nperror("wait");
@@ -811,6 +842,10 @@ void add_undo(undo_type current_action)
char *data;
openfilestruct *fs = openfile;
static undo *last_cutu = NULL; /* Last thing we cut to set up the undo for uncut */
ssize_t wrap_loc; /* For calculating split beginning */
if (!ISSET(UNDOABLE))
return;
/* Ugh, if we were called while cutting not-to-end, non-marked and on the same lineno,
we need to abort here */
@@ -831,7 +866,7 @@ void add_undo(undo_type current_action)
}
/* Allocate and initialize a new undo type */
u = nmalloc(sizeof(undo));
u = (undo *) nmalloc(sizeof(undo));
u->type = current_action;
u->lineno = fs->current->lineno;
u->begin = fs->current_x;
@@ -839,6 +874,7 @@ void add_undo(undo_type current_action)
fs->undotop = u;
fs->current_undo = u;
u->strdata = NULL;
u->strdata2 = NULL;
u->cutbuffer = NULL;
u->cutbottom = NULL;
u->mark_set = 0;
@@ -871,8 +907,22 @@ void add_undo(undo_type current_action)
u->strdata = data;
}
break;
case INSERT:
#ifndef DISABLE_WRAPPING
case SPLIT:
wrap_loc = break_line(openfile->current->data, fill
#ifndef DISABLE_HELP
, FALSE
#endif
);
u->strdata = mallocstrcpy(NULL, &openfile->current->data[wrap_loc]);
/* Don't both saving the next line if we're not prepending as a new line
will be created */
if (prepend_wrap)
u->strdata2 = mallocstrcpy(NULL, fs->current->next->data);
u->begin = wrap_loc;
break;
#endif /* DISABLE_WRAPPING */
case INSERT:
case REPLACE:
data = mallocstrcpy(NULL, fs->current->data);
u->strdata = data;
@@ -894,15 +944,17 @@ void add_undo(undo_type current_action)
u->cutbottom = last_cutu->cutbottom;
}
break;
case ENTER:
break;
case OTHER:
statusbar(_("Internal error: unknown type. Please save your work."));
break;
}
#ifdef DEBUG
fprintf(stderr, "fs->current->data = \"%s\", current_x = %d, u->begin = %d, type = %d\n",
fs->current->data, fs->current_x, u->begin, current_action);
fprintf(stderr, "left update_add...\n");
fprintf(stderr, "fs->current->data = \"%s\", current_x = %lu, u->begin = %d, type = %d\n",
fs->current->data, (unsigned long) fs->current_x, u->begin, current_action);
fprintf(stderr, "left add_undo...\n");
#endif
fs->last_action = current_action;
}
@@ -919,11 +971,14 @@ void update_undo(undo_type action)
int len = 0;
openfilestruct *fs = openfile;
if (!ISSET(UNDOABLE))
return;
#ifdef DEBUG
fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno = %d",
action, fs->last_action, openfile->current->lineno);
fprintf(stderr, "action = %d, fs->last_action = %d, openfile->current->lineno = %lu",
action, fs->last_action, (unsigned long) openfile->current->lineno);
if (fs->current_undo)
fprintf(stderr, "fs->current_undo->lineno = %d\n", fs->current_undo->lineno);
fprintf(stderr, "fs->current_undo->lineno = %lu\n", (unsigned long) fs->current_undo->lineno);
else
fprintf(stderr, "\n");
#endif
@@ -931,7 +986,7 @@ void update_undo(undo_type action)
/* Change to an add if we're not using the same undo struct
that we should be using */
if (action != fs->last_action
|| (action != CUT && action != INSERT
|| (action != CUT && action != INSERT && action != SPLIT
&& openfile->current->lineno != fs->current_undo->lineno)) {
add_undo(action);
return;
@@ -943,11 +998,11 @@ void update_undo(undo_type action)
switch (u->type) {
case ADD:
#ifdef DEBUG
fprintf(stderr, "fs->current->data = \"%s\", current_x = %d, u->begin = %d\n",
fs->current->data, fs->current_x, u->begin);
fprintf(stderr, "fs->current->data = \"%s\", current_x = %lu, u->begin = %d\n",
fs->current->data, (unsigned long) fs->current_x, u->begin);
#endif
len = strlen(u->strdata) + 2;
data = nrealloc((void *) u->strdata, len * sizeof(char *));
data = (char *) nrealloc((void *) u->strdata, len * sizeof(char *));
data[len-2] = fs->current->data[fs->current_x];
data[len-1] = '\0';
u->strdata = (char *) data;
@@ -1011,9 +1066,17 @@ void update_undo(undo_type action)
break;
case INSERT:
u->mark_begin_lineno = openfile->current->lineno;
break;
#ifndef DISABLE_WRAPPING
case SPLIT:
/* This will only be called if we made a completely new line,
and as such we should note that so we can destroy it later */
u->xflags = UNDO_SPLIT_MADENEW;
break;
#endif /* DISABLE_WRAPPING */
case UNSPLIT:
/* These cases are handled by the earlier check for a new line and action */
case ENTER:
case OTHER:
break;
}
@@ -1043,7 +1106,7 @@ void wrap_reset(void)
/* We wrap the given line. Precondition: we assume the cursor has been
* moved forward since the last typed character. Return TRUE if we
* wrapped, and FALSE otherwise. */
bool do_wrap(filestruct *line)
bool do_wrap(filestruct *line, bool undoing)
{
size_t line_len;
/* The length of the line we wrap. */
@@ -1108,6 +1171,9 @@ bool do_wrap(filestruct *line)
return FALSE;
#ifndef NANO_TINY
if (!undoing)
add_undo(SPLIT);
/* If autoindent is turned on, and we're on the character just after
* the indentation, we don't wrap. */
if (ISSET(AUTOINDENT)) {
@@ -1202,6 +1268,8 @@ bool do_wrap(filestruct *line)
null_at(&line->data, wrap_loc);
if (prepending) {
if (!undoing)
update_undo(SPLIT);
/* If we're prepending, copy the text from the next line, minus
* the indentation that we already copied above. */
strcat(new_line, next_line);

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* utils.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *

View File

@@ -2,8 +2,8 @@
/**************************************************************************
* winio.c *
* *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
* Free Software Foundation, Inc. *
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
* 2008, 2009 Free Software Foundation, Inc. *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 3, or (at your option) *
@@ -2426,6 +2426,7 @@ void onekey(const char *keystroke, const char *desc, size_t len)
* in the edit window at (current_y, current_x). */
void reset_cursor(void)
{
size_t xpt;
/* If we haven't opened any files yet, put the cursor in the top
* left corner of the edit window and get out. */
if (openfile == NULL) {
@@ -2433,13 +2434,25 @@ void reset_cursor(void)
return;
}
openfile->current_y = openfile->current->lineno -
openfile->edittop->lineno;
if (openfile->current_y < editwinrows) {
size_t xpt = xplustabs();
xpt = xplustabs();
wmove(edit, openfile->current_y, xpt - get_page_start(xpt));
}
if (ISSET(SOFTWRAP)) {
filestruct *tmp;
openfile->current_y = 0;
for (tmp = openfile->edittop; tmp && tmp != openfile->current; tmp = tmp->next)
openfile->current_y += 1 + strlenpt(tmp->data) / COLS;
openfile->current_y += xplustabs() / COLS;
if (openfile->current_y < editwinrows)
wmove(edit, openfile->current_y, xpt % COLS);
} else {
openfile->current_y = openfile->current->lineno -
openfile->edittop->lineno;
if (openfile->current_y < editwinrows)
wmove(edit, openfile->current_y, xpt - get_page_start(xpt));
}
}
/* edit_draw() takes care of the job of actually painting a line into
@@ -2482,7 +2495,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
if (fileptr->multidata == NULL && openfile->syntax
&& openfile->syntax->nmultis > 0) {
int i;
fileptr->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
for (i = 0; i < openfile->syntax->nmultis; i++)
fileptr->multidata[i] = -1; /* Assue this applies until we know otherwise */
}
@@ -2813,43 +2826,86 @@ void edit_draw(filestruct *fileptr, const char *converted, int
/* Just update one line in the edit buffer. This is basically a wrapper
* for edit_draw(). The line will be displayed starting with
* fileptr->data[index]. Likely arguments are current_x or zero. */
void update_line(filestruct *fileptr, size_t index)
* fileptr->data[index]. Likely arguments are current_x or zero.
* Returns: Number of additiona lines consumed (needed for SOFTWRAP)
*/
int update_line(filestruct *fileptr, size_t index)
{
int line;
int line = 0;
int extralinesused = 0;
/* The line in the edit window that we want to update. */
char *converted;
/* fileptr->data converted to have tabs and control characters
* expanded. */
size_t page_start;
filestruct *tmp;
assert(fileptr != NULL);
line = fileptr->lineno - openfile->edittop->lineno;
if (ISSET(SOFTWRAP)) {
for (tmp = openfile->edittop; tmp && tmp != fileptr; tmp = tmp->next) {
line += 1 + (strlenpt(tmp->data) / COLS);
}
} else
line = fileptr->lineno - openfile->edittop->lineno;
if (line < 0 || line >= editwinrows)
return;
return 1;
/* First, blank out the line. */
blank_line(edit, line, 0, COLS);
/* Next, convert variables that index the line to their equivalent
* positions in the expanded line. */
index = strnlenpt(fileptr->data, index);
if (ISSET(SOFTWRAP))
index = 0;
else
index = strnlenpt(fileptr->data, index);
page_start = get_page_start(index);
/* Expand the line, replacing tabs with spaces, and control
* characters with their displayed forms. */
converted = display_string(fileptr->data, page_start, COLS, TRUE);
converted = display_string(fileptr->data, page_start, COLS, !ISSET(SOFTWRAP));
#ifdef DEBUG
if (ISSET(SOFTWRAP) && strlen(converted) >= COLS - 2)
fprintf(stderr, "update_line(): converted(1) line = %s\n", converted);
#endif
/* Paint the line. */
edit_draw(fileptr, converted, line, page_start);
free(converted);
if (page_start > 0)
mvwaddch(edit, line, 0, '$');
if (strlenpt(fileptr->data) > page_start + COLS)
mvwaddch(edit, line, COLS - 1, '$');
if (!ISSET(SOFTWRAP)) {
if (page_start > 0)
mvwaddch(edit, line, 0, '$');
if (strlenpt(fileptr->data) > page_start + COLS)
mvwaddch(edit, line, COLS - 1, '$');
} else {
int full_length = strlenpt(fileptr->data);
for (index += COLS; index <= full_length && line < editwinrows; index += COLS) {
line++;
#ifdef DEBUG
fprintf(stderr, "update_line(): Softwrap code, moving to %d index %lu\n", line, (unsigned long) index);
#endif
blank_line(edit, line, 0, COLS);
/* Expand the line, replacing tabs with spaces, and control
* characters with their displayed forms. */
converted = display_string(fileptr->data, index, COLS, !ISSET(SOFTWRAP));
#ifdef DEBUG
if (ISSET(SOFTWRAP) && strlen(converted) >= COLS - 2)
fprintf(stderr, "update_line(): converted(2) line = %s\n", converted);
#endif
/* Paint the line. */
edit_draw(fileptr, converted, line, index);
free(converted);
extralinesused++;
}
}
return extralinesused;
}
/* Return TRUE if we need an update after moving horizontally, and FALSE
@@ -2878,6 +2934,34 @@ bool need_vertical_update(size_t pww_save)
get_page_start(openfile->placewewant);
}
/* When edittop changes, try and figure out how many lines
* we really have to work with (i.e. set maxrows)
*/
void compute_maxrows(void)
{
int n;
filestruct *foo = openfile->edittop;
if (!ISSET(SOFTWRAP)) {
maxrows = editwinrows;
return;
}
maxrows = 0;
for (n = 0; n < editwinrows && foo; n++) {
maxrows ++;
n += strlenpt(foo->data) / COLS;
foo = foo->next;
}
if (n < editwinrows)
maxrows += editwinrows - n;
#ifdef DEBUG
fprintf(stderr, "compute_maxrows(): maxrows = %ld\n", maxrows);
#endif
}
/* Scroll the edit window in the given direction and the given number
* of lines, and draw new lines on the blank lines left after the
* scrolling. direction is the direction to scroll, either UP_DIR or
@@ -2886,14 +2970,47 @@ bool need_vertical_update(size_t pww_save)
* also assume that scrollok(edit) is FALSE. */
void edit_scroll(scroll_dir direction, ssize_t nlines)
{
bool do_redraw = need_vertical_update(0);
filestruct *foo;
ssize_t i;
ssize_t i, extracuzsoft = 0;
bool do_redraw = FALSE;
/* Don't bother scrolling less than one line. */
if (nlines < 1)
return;
if (need_vertical_update(0))
do_redraw = TRUE;
/* If using soft wrapping, we want to scroll down enough to display the entire next
line, if possible... */
if (ISSET(SOFTWRAP) && direction == DOWN_DIR) {
#ifdef DEBUG
fprintf(stderr, "Softwrap: Entering check for extracuzsoft\n");
#endif
for (i = maxrows, foo = openfile->edittop; foo && i > 0; i--, foo = foo->next)
;
if (foo) {
extracuzsoft += strlenpt(foo->data) / COLS;
#ifdef DEBUG
fprintf(stderr, "Setting extracuzsoft to %lu due to strlen %lu of line %lu\n", (unsigned long) extracuzsoft,
(unsigned long) strlenpt(foo->data), (unsigned long) foo->lineno);
#endif
/* Now account for whether the edittop line itself is >COLS, if scrolling down */
for (foo = openfile->edittop; foo && extracuzsoft > 0; nlines++) {
extracuzsoft -= 1 + strlenpt(foo->data) / COLS;
#ifdef DEBUG
fprintf(stderr, "Edittop adjustment, setting nlines to %lu\n", (unsigned long) nlines);
#endif
if (foo == openfile->filebot)
break;
foo = foo->next;
}
}
}
/* Part 1: nlines is the number of lines we're going to scroll the
* text of the edit window. */
@@ -2910,6 +3027,13 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
break;
openfile->edittop = openfile->edittop->next;
}
/* Don't over-scroll on long lines */
if (ISSET(SOFTWRAP)) {
ssize_t len = strlenpt(openfile->edittop->data) / COLS;
i -= len;
if (len > 0)
do_redraw = TRUE;
}
}
/* Limit nlines to the number of lines we could scroll. */
@@ -2918,9 +3042,9 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
/* Don't bother scrolling zero lines or more than the number of
* lines in the edit window minus one; in both cases, get out, and
* call edit_refresh() beforehand if we need to. */
if (nlines == 0 || nlines >= editwinrows) {
if (nlines == 0 || do_redraw || nlines >= editwinrows) {
if (do_redraw || nlines >= editwinrows)
edit_refresh();
edit_refresh_needed = TRUE;
return;
}
@@ -2992,9 +3116,14 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
* window until it's onscreen and get out. */
if (old_current->lineno < openfile->edittop->lineno ||
old_current->lineno >= openfile->edittop->lineno +
editwinrows || openfile->current->lineno <
maxrows || openfile->current->lineno <
openfile->edittop->lineno || openfile->current->lineno >=
openfile->edittop->lineno + editwinrows) {
openfile->edittop->lineno + maxrows) {
#ifdef DEBUG
fprintf(stderr, "edit_redraw(): line %lu was offscreen, oldcurrent = %lu edittop = %lu", openfile->current->lineno,
old_current->lineno, openfile->edittop->lineno);
#endif
filestruct *old_edittop = openfile->edittop;
ssize_t nlines;
@@ -3008,7 +3137,7 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
if (old_edittop->lineno < openfile->edittop->lineno)
old_lineno = old_edittop->lineno;
else
old_lineno = (old_edittop->lineno + editwinrows <=
old_lineno = (old_edittop->lineno + maxrows <=
openfile->filebot->lineno) ?
old_edittop->lineno + editwinrows :
openfile->filebot->lineno;
@@ -3027,28 +3156,13 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
/* Put edittop in range of current, get the difference in lines
* between the original edittop and the current edittop, and
* then restore the original edittop. */
edit_update(
#ifndef NANO_TINY
ISSET(SMOOTH_SCROLL) ? NONE :
#endif
CENTER);
nlines = openfile->edittop->lineno - old_edittop->lineno;
openfile->edittop = old_edittop;
edit_update(CENTER);
/* Update old_current if we're not on the same page as
* before. */
if (do_redraw)
update_line(old_current, 0);
/* Scroll the edit window up or down until edittop is in range
* of current. */
if (nlines < 0)
edit_scroll(UP_DIR, -nlines);
else
edit_scroll(DOWN_DIR, nlines);
#ifndef NANO_TINY
/* If the mark is on, update all the lines between the old first
* line or old last line of the edit window (depending on
@@ -3097,16 +3211,21 @@ void edit_refresh(void)
filestruct *foo;
int nlines;
/* Figure out what maxrows should really be */
compute_maxrows();
if (openfile->current->lineno < openfile->edittop->lineno ||
openfile->current->lineno >= openfile->edittop->lineno +
editwinrows)
maxrows) {
#ifdef DEBUG
fprintf(stderr, "edit_refresh(): line = %d, edittop %d + maxrows %d\n", openfile->current->lineno, openfile->edittop->lineno, maxrows);
#endif
/* Put the top line of the edit window in range of the current
* line. */
edit_update(
#ifndef NANO_TINY
ISSET(SMOOTH_SCROLL) ? NONE :
#endif
CENTER);
edit_update(CENTER);
}
foo = openfile->edittop;
@@ -3115,7 +3234,7 @@ void edit_refresh(void)
#endif
for (nlines = 0; nlines < editwinrows && foo != NULL; nlines++) {
update_line(foo, (foo == openfile->current) ?
nlines += update_line(foo, (foo == openfile->current) ?
openfile->current_x : 0);
foo = foo->next;
}
@@ -3154,10 +3273,17 @@ void edit_update(update_type location)
goal = editwinrows - 1;
}
for (; goal > 0 && foo->prev != NULL; goal--)
for (; goal > 0 && foo->prev != NULL; goal--) {
foo = foo->prev;
if (ISSET(SOFTWRAP) && foo)
goal -= strlenpt(foo->data) / COLS;
}
openfile->edittop = foo;
#ifdef DEBUG
fprintf(stderr, "edit_udpate(), setting edittop to lineno %d\n", openfile->edittop->lineno);
#endif
compute_maxrows();
edit_refresh_needed = TRUE;
}
/* Unconditionally redraw the entire screen. */