Compare commits
178 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b4e433687 | ||
|
|
22c83ec7af | ||
|
|
2072b74153 | ||
|
|
66e5972c52 | ||
|
|
a149549d07 | ||
|
|
67acf2c753 | ||
|
|
29479ca7f5 | ||
|
|
b7a2dfb2da | ||
|
|
f4e26d174e | ||
|
|
2e4228f78e | ||
|
|
a016f00f14 | ||
|
|
76d61ec167 | ||
|
|
2a76b434fc | ||
|
|
1642e6a368 | ||
|
|
3116d2f7de | ||
|
|
4cc2462ed4 | ||
|
|
170607b6c9 | ||
|
|
636e76af23 | ||
|
|
220247172a | ||
|
|
d70c7f3c14 | ||
|
|
21f73f902f | ||
|
|
bf88d27adc | ||
|
|
2ad1de0ba6 | ||
|
|
d84849ec12 | ||
|
|
8d7402f470 | ||
|
|
daeab0518d | ||
|
|
090e2cf726 | ||
|
|
7a707670d6 | ||
|
|
f9217437ad | ||
|
|
fda622c0cd | ||
|
|
bccf2fa1c9 | ||
|
|
34de1a6706 | ||
|
|
946b2f4ace | ||
|
|
3bd12e3714 | ||
|
|
3459e4f432 | ||
|
|
20d93295c1 | ||
|
|
154136a7cb | ||
|
|
392c23c9c5 | ||
|
|
8e2a930714 | ||
|
|
9bfda9196b | ||
|
|
b00d0b9c8c | ||
|
|
637daa85c5 | ||
|
|
3d411188f6 | ||
|
|
d5b1c7c5bf | ||
|
|
ab53864de7 | ||
|
|
8deebeb904 | ||
|
|
544c56c036 | ||
|
|
9b1c868326 | ||
|
|
14d7c5de2a | ||
|
|
7a1b1ff5be | ||
|
|
461519cce7 | ||
|
|
0acca27ac7 | ||
|
|
86be3af75f | ||
|
|
0dcfa1d7f7 | ||
|
|
a2c5172db3 | ||
|
|
29e2012267 | ||
|
|
c859049041 | ||
|
|
db9d983646 | ||
|
|
181c4a999b | ||
|
|
053fabd4e1 | ||
|
|
ad8476eb7d | ||
|
|
7f61a6cb79 | ||
|
|
dbbf9a052f | ||
|
|
83a0e9013e | ||
|
|
e68616b799 | ||
|
|
9e73aeb10f | ||
|
|
0d1381adf9 | ||
|
|
cdb5b16198 | ||
|
|
35b5976e69 | ||
|
|
fe2042da8a | ||
|
|
091d5f3b0a | ||
|
|
08273aa1b2 | ||
|
|
b5e7647028 | ||
|
|
42bd871af3 | ||
|
|
f81d6fe8d3 | ||
|
|
1456a10ace | ||
|
|
8ff7f33c52 | ||
|
|
3eacb857a1 | ||
|
|
2466d933c9 | ||
|
|
4e621b5f6b | ||
|
|
b916f5cd8b | ||
|
|
6cf05d487f | ||
|
|
1a7a91b779 | ||
|
|
df8c3debc8 | ||
|
|
374216fe22 | ||
|
|
fc6ef3e1e8 | ||
|
|
8d41fb8c3e | ||
|
|
3c7dda6e7e | ||
|
|
869aca4392 | ||
|
|
d9be86f45b | ||
|
|
9c0716a73a | ||
|
|
560a8cd0ec | ||
|
|
a8bc492b8a | ||
|
|
f387f33083 | ||
|
|
2c7b506fbc | ||
|
|
5b25e07744 | ||
|
|
b27b3a18a9 | ||
|
|
96466166f1 | ||
|
|
671b2d974c | ||
|
|
c9f0799791 | ||
|
|
42a390416e | ||
|
|
8a07a96eef | ||
|
|
a97cb819f2 | ||
|
|
cb9a5bed8e | ||
|
|
b43f6912f3 | ||
|
|
5a018f0d3a | ||
|
|
752830573a | ||
|
|
daaf468c93 | ||
|
|
dcf5cbbf6a | ||
|
|
3b830ee194 | ||
|
|
d753efdb55 | ||
|
|
c9199e9e9a | ||
|
|
e2df2c899d | ||
|
|
c82f038855 | ||
|
|
8b6f6fcc1b | ||
|
|
0bff84ef9c | ||
|
|
6277f59d24 | ||
|
|
6c3d886424 | ||
|
|
879dfbaf40 | ||
|
|
e9dee887a9 | ||
|
|
123110c5dc | ||
|
|
cbba77558e | ||
|
|
e350d7a52a | ||
|
|
16e07d5878 | ||
|
|
8c1edd17e3 | ||
|
|
fc48347fb8 | ||
|
|
2cd2d4b9ae | ||
|
|
533b9fa827 | ||
|
|
f9d4fd3755 | ||
|
|
f55ada727e | ||
|
|
99c8d40db1 | ||
|
|
6f08332741 | ||
|
|
a60910cc54 | ||
|
|
7be32046b0 | ||
|
|
795be590d5 | ||
|
|
3aad8ab9aa | ||
|
|
1d461475ce | ||
|
|
a535cecd77 | ||
|
|
d233e7e240 | ||
|
|
1f218fa859 | ||
|
|
91e05e64a0 | ||
|
|
35afab5eba | ||
|
|
bce7d404d9 | ||
|
|
f8f9027295 | ||
|
|
5687c3dfa6 | ||
|
|
139934a236 | ||
|
|
3de025f8f4 | ||
|
|
308a7b029d | ||
|
|
05417a2444 | ||
|
|
13dde2bda4 | ||
|
|
a48507d32a | ||
|
|
7f38820fba | ||
|
|
42726f74cc | ||
|
|
0a10e20eec | ||
|
|
ad37e67dd2 | ||
|
|
a4c2b99e40 | ||
|
|
8b9fb360c2 | ||
|
|
e061a0d604 | ||
|
|
b843a51b79 | ||
|
|
df543e78df | ||
|
|
12ba55732f | ||
|
|
55ca1028ac | ||
|
|
5a3464b57b | ||
|
|
fb6446d826 | ||
|
|
f86fa86089 | ||
|
|
5ba7a93b1a | ||
|
|
fbdc8b9b92 | ||
|
|
97ba02d4f1 | ||
|
|
86988b5026 | ||
|
|
b71cf301da | ||
|
|
9555e1d118 | ||
|
|
7aec392993 | ||
|
|
e027fc2edd | ||
|
|
8257bf145e | ||
|
|
a30eb78006 | ||
|
|
35686daf9d | ||
|
|
04fbfaae51 | ||
|
|
5b695cef46 |
2
BUGS
2
BUGS
@@ -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$
|
||||
|
||||
530
ChangeLog
530
ChangeLog
@@ -1,3 +1,533 @@
|
||||
2013-03-17 Chris Allegretta <chrisa@asty.org>
|
||||
* Revert r4547 as we should have a new release and the overlap code is not yet
|
||||
ready for public consumption.
|
||||
|
||||
2013-01-20 Chris Allegretta <chrisa@asty.org>
|
||||
* src/text.c (do_histify): Don't allow sigwinch to be received while justifying
|
||||
as that puts us into a wacky state. Fixess crash on justify by Joshua Rogers.
|
||||
* configure.ac: Added --with-wordbounds option to let cross compilers force
|
||||
whether their target system support GNU-style word boundaries or not.
|
||||
Originally reported by dave festing.
|
||||
* doc/man/nanorc.5: Fix typo in softwrap description, reported by
|
||||
cbart387@Savannah.
|
||||
|
||||
2013-01-19 Chris Allegretta <chrisa@asty.org>
|
||||
* configure.ac: Make ncurses checking to set $LIBS and check the ncursesw lib
|
||||
actually works before defaulting to it over ncurses! Shock!
|
||||
|
||||
2013-01-13 Chris Allegretta <chrisa@asty.org>
|
||||
* src/utils.c (parse_num): Initalize errno before calling strtol(). Fixes issue
|
||||
where trying to go to a line number too long will break legitimate goto-lines
|
||||
for the remainder of the editing session, reported by Joshua Rogers.
|
||||
|
||||
2013-01-09 Mike Frysinger <vapier@gentoo.org>
|
||||
* configure.ac: Check for ncursesw5-config and base $CPPFLAGS based on it.
|
||||
|
||||
2013-01-09 Fabian Groffen <grobian@Savannah>
|
||||
* configure.ac, src/nano.h: Make search for ncursesw more generalized.
|
||||
|
||||
2013-01-02 David Benjamin <davidben@Savannah>
|
||||
* src/search.c (parse_syntax): Fix blatantly and dangerously incorrect code for
|
||||
deleting old syntaxes.
|
||||
|
||||
2013-01-02 Mike Frysinger <vapier@gentoo.org>
|
||||
* src/files.c (cwd_tab_completion): Remove unnecessary variables
|
||||
* src/search.c (search_init): Fix gcc complaints on certain versions
|
||||
|
||||
2013-01-02 Eitan Adler <lists@eitanadler.com>
|
||||
* configure.ac: Remove unnecessary checks
|
||||
* src/nano.h, NEWS: Fix redundant wording
|
||||
|
||||
2012-12-31 Chris Allegretta <chrisa@asty.org>
|
||||
* src/*: Introduce (basic) vim-style file locks. Does not allow vim to recover
|
||||
our changes, and just lets a vim user know we're editing a file. Commands line "-G"
|
||||
or "--locking", nanorc option "locking". New functions
|
||||
src/files.c:do_lockfile(), write_lockfile(), and delete_lockfile().
|
||||
|
||||
2012-02-05 Chris Allegretta <chrisa@asty.org>
|
||||
* src/*: Fix overlapping strings highlighting each other. new variables in edit_draw
|
||||
(slmatcharray, pbegin, paintok), new logic (with repeated setting od values in the
|
||||
array but its BFI after all). FIXME: Need to create a new 'overlap'
|
||||
* src/*: Fix a silly issue with the argument to nregcomp, as it's confusing to the caller
|
||||
* src/nano.h: Change the color types to a compiler macro (COLORWIDTH), may not actually
|
||||
even be worth doing, but someday who knows how wide a color curses implementation might
|
||||
be, and maybe we'll even start checking for it in autoconf!
|
||||
|
||||
GNU nano 2.3.1 - 2011.05.10
|
||||
2011-05-10 Chris Allegretta <chrisa@asty.org>
|
||||
* text.c (do_enter): Only increment totsize by the auto-indented amount, size the previous line's size was
|
||||
already counted. Fixes bug reported by Robert Spanjaard.
|
||||
|
||||
2011-05-08 Chris Allegretta <chrisa@asty.org>
|
||||
* doc/syntax/Makefile.am: Finally get around to sorting the syntax file list
|
||||
|
||||
2011-05-08 Matthew Wild <mattj100@Savannah>
|
||||
* doc/syntax/spec.nanorc: New lua syntax highlighting config
|
||||
|
||||
2011-03-28 Asterios Dramis <asterios.dramis@gmail.com>
|
||||
* doc/syntax/spec.nanorc: New RPM spec file highlighting config
|
||||
|
||||
2011-03-12 Chris Allegretta <chrisa@asty.org>
|
||||
* po/*: Sync latest translation fixes, add an update_linguas.sh script. Rename
|
||||
existing update.pl to update_sources.pl to make it more specific.
|
||||
|
||||
2011-03-04 Chris Allegretta <chrisa@asty.org>
|
||||
* color.c (color_update): Add check for whether the file even exists
|
||||
before we try to run the magic check on it. Fixes error messages to stderr
|
||||
when reading in files that don't exist, reported by Mike Frysinger.
|
||||
|
||||
2011-03-03 Chris Allegretta <chrisa@asty.org>
|
||||
* color.c (color_update): Remove unneeded debugging message from
|
||||
libmagic commit. Fixed extra messages going to stderr reported by Mike Frysinger.
|
||||
|
||||
GNU nano 2.3.0 - 2011.02.26
|
||||
2011-02-26 Chris Allegretta <chrisa@asty.org>
|
||||
* Change RAW in function_type enum to RAWINPUT, to fix compilation on AIX,
|
||||
reported by Richard G Daniel <skunk@iskunk.org>.
|
||||
|
||||
2011-02-23 Chris Allegretta <chrisa@asty.org>
|
||||
* Fix some more severe warnings from 'g++ -pedantic', from patch originally
|
||||
by Eitan Adler <lists@eitanadler.com>
|
||||
|
||||
2011-02-23 Kamil Dudka <kdudka@redhat.com>
|
||||
* doc/man/nanorc.5: Fix small typo
|
||||
|
||||
2011-02-22 Chris Allegretta <chrisa@asty.org>
|
||||
* color.c (nfreeregex): Fix that we were trying to set the pointer passed by value
|
||||
to NULL. Fixes crashes on file save reported by Ken Tyler and Matthieu Lejeune.
|
||||
|
||||
2011-02-18 Chris Allegretta <chrisa@asty.org>
|
||||
* New saved cursor position history option. Command line option -P or --poslog, rc file
|
||||
entry "poslog". Search history changes to ~/.nano/search_history, cursor position log
|
||||
is ~/.nano/filepos_history. Added checks to move the legacy .nano_history file to the new
|
||||
location. Several new functions to files.c: load_poshistory(), save_poshistory(),
|
||||
check_poshistory(), update_poshistory(), and reworking of histfilename(). New FAQ entry
|
||||
4.15 discussing the change and offering an interoperability workaround.
|
||||
* files.c (load_history): Set last_search to the last search value we loaded from history,
|
||||
so do_research will succeed without needing to manually load the last seach in. Fixes
|
||||
bug reported by Matthieu Lejeune.
|
||||
|
||||
2011-02-12 Chris Allegretta <chrisa@asty.org>
|
||||
* Initial libmagic implementation, adapted from Eitan Adler <eitanadlerlist@gmail.com>.
|
||||
New nanorc entry "magic" to enable this functionality, nanorc file and man page updates.
|
||||
|
||||
2011-02-06 Chris Allegretta <chrisa@asty.org>
|
||||
* src/*: Retire iso_me_harder_funcmap based on suggestion by <bernd.spaeth@gmx.net>
|
||||
This does add 20KB to nano's executable size but it gets rid of a lot of indirection
|
||||
that makes people stomach turn. There are several new stub functions and need of more
|
||||
tidying as a result of this.
|
||||
* files.c (write_file): Fix problems with writing the backup file (albeit interactively)
|
||||
with new function prompt_failed_backupwrite(), allows more secure handling of problems
|
||||
with failing to write the backup file compared to 'allow_insecure_backup'.
|
||||
* winio.c (edit_redraw): Removed unused variable
|
||||
|
||||
2010-11-15 Chris Allegretta <chrisa@asty.org>
|
||||
* Add a section to the FAQ about using nanorc on Win32 systems.
|
||||
|
||||
2010-11-12 Chris Allegretta <chrisa@asty.org>
|
||||
* Add check for RESTRICTED mode back to speller, suspend and insert file
|
||||
routines, since adding key bindings broke the fact that they should be
|
||||
disabled in restricted mode. Fixes Savannah bug 31625 reported by
|
||||
Charlie Somerville.
|
||||
|
||||
GNU nano 2.2.5 - 2010.08.05
|
||||
2010-08-04 Lauri Kasanen <curaga@operamail.comcuraga@operamail.com>
|
||||
* doc/syntax/mgp.nanorc: New Magicpoint syntax highlighting definition
|
||||
|
||||
2010-08-04 Peter <exodus@savannah>
|
||||
* doc/syntax/tex.nanorc: No longer highlight escaped comments
|
||||
|
||||
2010-06-20 Chris Allegretta <chrisa@asty.org>
|
||||
* New rc file option allow_insecure_backup, allows the previous security
|
||||
fixes for backup files to be overridden if you're really positive
|
||||
you want to. Fixes Savannah bug 29732 by Brian Szymanski <skibrianski>.
|
||||
|
||||
2010-05-23 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (write_file): Don't even try to chown() the backup
|
||||
file unless we're root, since it's probably going to fail if
|
||||
we're editing a file we don't own. Fixes Savannah bug
|
||||
29514: [nano 2.2.2] backup should ignore chown errors.
|
||||
|
||||
GNU nano 2.2.4 - 2010.04.15
|
||||
2010-04-07 Chris Allegretta <chrisa@asty.org>
|
||||
* doc/man/nano.1,nanorc.5: Remove the backup file warnings now
|
||||
that a sufficient security fix exists for the backup file code.
|
||||
|
||||
2010-04-14 Chris Allegretta <chrisa@asty.org>
|
||||
* text.c (do_alt_speller): Skip invoking the alt speller if the file size
|
||||
is 0 bytes. Fixes Savannah bug 29393 reported by Mike Frysinger.
|
||||
* files.c (wirte_file): Don't set current_stat when tmp == TRUE, check
|
||||
whether current_stat is set when trying to use it, and don't do the
|
||||
modification check if the filename changed, since we have no way
|
||||
of knowing about it in that case. Fixes Savannah bug 29392, reported
|
||||
by Mike Frysinger. [CVE-2010-1160]
|
||||
|
||||
2010-04-13 Felipe Bugno <necron@bol.com.br>
|
||||
* doc/syntax/cmake.nanorc: Added cmake syntax highlighting file.
|
||||
|
||||
2010-04-09 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (do_writeout): Better security fixes for backup file writing,
|
||||
mangled from submission by Dan Rosenberg <dan.j.rosenberg at gmail>
|
||||
[CVE-2010-1161]
|
||||
|
||||
2010-04-08 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (do_writeout): Previous fixes should not cause a crash
|
||||
when saving a new file. Discovered by Mike Frysinger <vapier@gentoo.org>.
|
||||
|
||||
2010-04-07 Chris Allegretta <chrisa@asty.org>
|
||||
* doc/man/nano.1,nanorc.5: Add warnings about using backup
|
||||
mode as root due to the Dan Rosenberg security analysis.
|
||||
|
||||
2010-04-02 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (do_writeout): Expand modification check to include both the
|
||||
original file's device ID and inode number as reasons to warn the
|
||||
user that the file has been modified. Also abort on writing a backup
|
||||
file when its owner doesn't match the edited file. Based on security
|
||||
analysis on nano by Dan Rosenberg. [CVE-2010-1160]
|
||||
|
||||
|
||||
2010-03-21 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.c (page_stdin et al): Don't attempt to reset/reopen the terminal
|
||||
settings when reading stdin if it was aborted with SIGINT. May fix Savannah
|
||||
bug 29114 reported by Mike Frysinger.
|
||||
|
||||
2010-03-21 Mike Frysinger <vapier@gentoo.org>
|
||||
* doc/syntax/c.nanorc: Add additional support for #include_next and #pragma
|
||||
|
||||
2010-03-21 Chris Allegretta <chrisa@asty.org>
|
||||
* move.c (do_page_up, do_page_down()): Explicitly set current_y to 0 when paging
|
||||
up when not in smooth scroll mode, as previous fixes would otherwise cause
|
||||
the cursor to not really be moved to the stop of the screen.
|
||||
|
||||
2010-03-07 Chris Allegretta <chrisa@asty.org>
|
||||
* configure.ac, nano.c (handle_sigwinch): Create check for whether LINES and
|
||||
COLS can safely be redefined. Fixes compilation issues with cygwin, and likely
|
||||
with newer versions of ncurses, fixes Savannah bug 28984 repoted by Andy Koppe
|
||||
and Eric Oliver via mailing list.
|
||||
* winio.c (get_mouseinput) - fix stray semicolon in code, also reported in
|
||||
bug 28984.
|
||||
|
||||
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
|
||||
the text state. New utility function color.c:reset_multis_for_id().
|
||||
|
||||
2009-02-15 Chris Allegretta <chrisa@asty.org>
|
||||
* configure.ac, doc/man/Makefile.am - Add check for HTML output support in GNU
|
||||
groff. Fixes Savannah bug #24461: build traps on groff. Also, add installation
|
||||
of html-ized man pages to $datadir/nano/man-html, since we should probably
|
||||
install files we went to all the trouble of generating.
|
||||
|
||||
2009-02-14 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.c (precalc_multicolorinfo) - Add debugging so we have a better clue if further
|
||||
issues arise. Also start at the beginning of later lines when trying to match the
|
||||
end of a multi-line regex. Fixes more overly aggressive highlighting found by
|
||||
Mike Frysinger. Finally, advance to the match end for performance.
|
||||
|
||||
2009-02-11 Chris Allegretta <chrisa@asty.org>
|
||||
* nanorc.c (parse_include): Do call real_dir_from_tilde() on included
|
||||
files in .nanorc, but still avoiding bug #25297. Fixes ~ and ~user
|
||||
specifications for nanorc include files, as reported by Eitan Adler.
|
||||
|
||||
2009-02-09 Chris Allegretta <chrisa@asty.org>
|
||||
* New option -q, --quiet, rcfile option "quiet" implemented. Skips printing
|
||||
errors about the rcfile and asking user to press enter. Also, nano should
|
||||
now only ask for one enter press when there is an error when not using -q.
|
||||
Based on discussion between Eitan Adler and Mike Frysinger.
|
||||
* rcfile.c (parse_keybinding) - Significant cleanups and fixes for
|
||||
detecting and reporting errors in key bindings code.
|
||||
|
||||
2009-02-08 Chris Allegretta <chrisa@asty.org>
|
||||
* Make reset_multidata reset more lines, since contrary to previous problems the
|
||||
syntax highlting is now too *un*ambitious, causing display glitches when
|
||||
deleting a regex boundary.
|
||||
* Add more multidata initliazers for new buffers and 'magic lines'. Fixes segfaults
|
||||
with syntax highlighting in new buffers, initially reported by Mike Frysinger.
|
||||
|
||||
GNU nano 2.1.8 - 2009.02.07
|
||||
2009-02-06 Chris Allegretta <chrisa@asty.org>
|
||||
* rcfile.c (parse_include): Abort on being unable to open an included rcfile. Fixes
|
||||
|
||||
187
NEWS
187
NEWS
@@ -1,3 +1,184 @@
|
||||
2013.03.22 - GNU nano 2.3.2 "Annoy your coworkers for fun and profit" is
|
||||
released. This release introduces vim-style file locking
|
||||
(though not backup/restore), useful when using nano
|
||||
in a multi-editor environment. Feedback is welcome if
|
||||
you run into any issues with this new code. Other new
|
||||
features include additional support for word boundary
|
||||
checking when cross compiling, fixes for trying to go to
|
||||
an invalid line number, and the usual documentation
|
||||
tweaks.
|
||||
|
||||
2011.05.10 - GNU nano 2.3.1 "I'm in space" is released. This
|
||||
release includes some fixes for the new libmagic code, as
|
||||
well as a fix for improper character counts when using
|
||||
auto-indent. Also included are new syntax highlighting
|
||||
definitions for RPM spec and lua files. Thanks for
|
||||
using nano and keep circulating the tapes.
|
||||
|
||||
2011.02.26 - GNU nano 2.3.0 "Septic surprise" is released. This first
|
||||
release in the 2.3 unstable series bring several new
|
||||
features. First, libmagic support for syntax highlighting
|
||||
has been added on top of the existing file extension
|
||||
and header support already available. Secondly, cursor
|
||||
position can be saved between editing sessions with
|
||||
the -P or --poslog command line flags, or via "set poslog"
|
||||
in your .nanorc. Also included are some fixes for
|
||||
compilation with g++, and better handling of issues
|
||||
writing the backup file, which should reduce the need
|
||||
for the 'set allow_insecure_backup" nanorc option.
|
||||
Don't stop, get it get it, don't stop, get it get it.
|
||||
|
||||
2010.08.05 - GNU nano 2.2.5 "Inactivity timeout" is now available.
|
||||
This release includes slightly less restrictive checkng
|
||||
when writing files in strange environments (e.g.
|
||||
when being used out of crontab). For very strange situations
|
||||
(such as where you cannot change the permissions on the
|
||||
file you're writing, there is a new rc file option
|
||||
"allow_insecure_backup" to be even more permissive and
|
||||
allowing the write to proceed. Also included are
|
||||
some syntax highlighting updated, and that is about it.
|
||||
Keep fighting the good fight children.
|
||||
|
||||
2010.04.15 - GNU nano 2.2.4 is nobody's fool. First and foremost,
|
||||
this relase includes some security fixes due to
|
||||
an assessment of nano's vulnerability to symlink attacks
|
||||
on open files. The CVEs fixed with this release are
|
||||
CVE-2010-1160 and CVE-2010-1161. Also included are fixes
|
||||
for various crash modes when using the spell checker
|
||||
on new files in multibuffer mode (surely you've used
|
||||
that combination recently? No?) as well as a fixing
|
||||
the 'file was modified' message when saving to a
|
||||
new filename (since how would nano know?). And
|
||||
the list would not be complete without our
|
||||
third-times-the-charm fixes to page up/down due to
|
||||
the soft wrapping code. The lone new feature
|
||||
included is a new syntax higlighting definition for
|
||||
cmake-related files. Please do consider upgrading to
|
||||
this release if still using the 2.0 series since
|
||||
fixes for that version are still forthcoming.
|
||||
|
||||
|
||||
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
|
||||
sped-up syntax highlighting code. Other fixes include
|
||||
configure-time detection of groff HTML support before
|
||||
attempting to generate the HTML version of man pages,
|
||||
and using ~ or ~username syntax in .nanorc should now
|
||||
work again. Also, nano will now only ask for one
|
||||
acknowledgement of errors it encounters when parsing
|
||||
nanorc files, and a new flag -q (--quiet) will silence
|
||||
these messages altogether. Give it a go, and happy
|
||||
birthday lenny!
|
||||
|
||||
2009.02.07 - GNU nano 2.1.8 "unsafe at any speed" is released. This
|
||||
release include some long overdue performance
|
||||
improvements in syntax color highlighting, the ability
|
||||
@@ -574,10 +755,10 @@
|
||||
new option to ignore rc files (-I,--ignorercfiles),
|
||||
compatibility with -pedantic, handling null characters
|
||||
before EOF, a slightly sportier nanorc.sample and more.
|
||||
Fixes are included included for justification,
|
||||
Fixes are included for justification,
|
||||
the reading and writing file routines, resizing and fill
|
||||
length, millions of memory leaks, the usage screen was
|
||||
updated, and the the --quotestr and --regexp really work
|
||||
updated, and the --quotestr and --regexp really work
|
||||
now ;-) Enjoy :)
|
||||
|
||||
05/12/2002 - GNU nano 1.1.9 is released, happy Mother's Day! This
|
||||
@@ -902,7 +1083,7 @@
|
||||
|
||||
08/03/2000 - Nano 0.9.15 is the "I can't think of a release description"
|
||||
release. There are the usual gala of display bugfixes,
|
||||
a fix for the the nasty bug in -k mode that could create
|
||||
a fix for the nasty bug in -k mode that could create
|
||||
a loop in the file being edited, and some other code
|
||||
cleanup. Also, the -T option should now work regardless
|
||||
of the curses library used. Yay.
|
||||
|
||||
51
TODO
51
TODO
@@ -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,44 @@ 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:
|
||||
- New regression framework built on expect.
|
||||
- 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
16
UPGRADE
@@ -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
|
||||
|
||||
157
configure.ac
157
configure.ac
@@ -20,9 +20,9 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.1.8], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.3.2], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
@@ -49,8 +49,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 magic.h)
|
||||
|
||||
dnl Checks for options.
|
||||
|
||||
@@ -144,7 +143,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 +154,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 +167,7 @@ fi], [
|
||||
*** script with --disable-color.])
|
||||
fi
|
||||
fi
|
||||
])
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(multibuffer,
|
||||
[ --disable-multibuffer Disable multiple file buffers],
|
||||
@@ -191,37 +190,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,14 +435,23 @@ 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
|
||||
AC_CHECK_HEADERS(ncurses.h)
|
||||
|
||||
if test x$enable_utf8 != xno; then
|
||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CPPFLAGS="-I/usr/include/ncursesw $CPPFLAGS" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
OLDLIBS="$LIBS"
|
||||
AC_CHECK_TOOL(NCURSESW_CONFIG, ncursesw5-config, no)
|
||||
if test "x$NCURSESW_CONFIG" != xno; then
|
||||
CURSES_LIB=`$NCURSESW_CONFIG --libs`
|
||||
LIBS="$CURSES_LIB $LIBS"
|
||||
CPPFLAGS="`$NCURSESW_CONFIG --cflags` $CPPFLAGS"
|
||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
else
|
||||
AC_CHECK_LIB(ncursesw, get_wch, [CURSES_LIB="-lncursesw" CURSES_LIB_NAME=ncursesw CURSES_LIB_WIDE=yes])
|
||||
fi
|
||||
LIBS="$OLDLIBS"
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"; then
|
||||
@@ -545,6 +525,107 @@ 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_ARG_WITH(wordbounds,
|
||||
[ --with-wordbounds Use GNU-style word boundary delimiters],
|
||||
[ case "$with_wordbounds" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
# We explicitly don't check if the user forced the option, because
|
||||
# this is needed for cross compilers and we cant test the target
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
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
|
||||
|
||||
AC_MSG_CHECKING([whether LINES and COLS can be redefined])
|
||||
AC_TRY_RUN([
|
||||
#include <curses.h>
|
||||
int main(void)
|
||||
{
|
||||
LINES = 80;
|
||||
COLS = 25;
|
||||
return 0;
|
||||
}],
|
||||
AC_DEFINE(REDEFINIG_MACROS_OK, 1, [Define this if you know your curses library allows LINES and COLS to be redefined to deal with a resizing bug])
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
|
||||
|
||||
AC_CHECK_LIB(magic, magic_open)
|
||||
|
||||
# Check for groff html support
|
||||
AC_MSG_CHECKING([for HTML support in groff])
|
||||
groff -t -mandoc -Thtml </dev/null >/dev/null
|
||||
if test $? -ne 0 ; then
|
||||
echo "no"
|
||||
echo "*** Will not generate HTML version of man pages ***"
|
||||
echo "*** Consider installing a newer version of groff with HTML support ***"
|
||||
groff_html_support=no
|
||||
else
|
||||
echo "yes"
|
||||
groff_html_support=yes
|
||||
fi
|
||||
AM_CONDITIONAL(GROFF_HTML, test x$groff_html_support = xyes)
|
||||
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
doc/Makefile
|
||||
|
||||
33
doc/faq.html
33
doc/faq.html
@@ -29,7 +29,8 @@
|
||||
<a href="#3.6">3.6. How can I make the executable smaller? This is too bloated!</a><br>
|
||||
<a href="#3.7">3.7. Tell me more about this multibuffer stuff!</a><br>
|
||||
<a href="#3.8">3.8. Tell me more about this verbatim input stuff!</a><br>
|
||||
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a></p></blockquote>
|
||||
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a></br>
|
||||
<a href="#3.9.1">3.9.1. How about in Win32?</a></p></blockquote>
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
|
||||
@@ -45,7 +46,8 @@
|
||||
<a href="#4.11">4.11. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.12">4.12. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.13">4.13. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a><br>
|
||||
<a href="#4.14">4.14. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</a></p></blockquote>
|
||||
<a href="#4.14">4.14. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</a><br>
|
||||
<a href="#4.15">4.15. On startup I get a message that says "Detected a legacy nano history file". Now other nano versionc can't find my search history!</a></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a><br>
|
||||
@@ -83,9 +85,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 "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most 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 +101,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 +118,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>
|
||||
@@ -167,6 +169,10 @@
|
||||
<p>Alternatively, if you've enabled Unicode support (see section <a href="#5.3">5.3</a>), you can press <b>Meta-V</b> and then type a six-digit hexadecimal code from 000000 to 10FFFF (case-insensitive), and the character with the corresponding value will be inserted instead. The prompt will change to "Unicode Input" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9"></a>3.9. How do I make a .nanorc file that nano will read when I start it?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your version of nano must have been compiled with <b>--enable-nanorc</b>, and again must be version 1.1.12 or newer (use nano -V to check your version and compiled features). Then simply copy the <b>nanorc.sample</b> that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax is simple. Flags are turned on and off by using the word <b>set</b> and the getopt_long flag for the feature, for example "set nowrap" or "set suspend".</p></blockquote>
|
||||
<h2><a name="3.9.1"></a>3.9. How about in Win32?</h2>
|
||||
<blockquote><p>If you're using the official nano .zip file and have extracted all the files, you should take the file nano.rc and place it somewhere on your Win32 system (for example if you have write permission to do so, at the top of C:\). Then you must create an Environment variable called HOME which points to the directory where you put nano.rc. In Windows XP, you can get to Environment variables by right-clicking "My Computer" either on the desktop or in the Start Menu, and selecting Properties. This should bring up the System Properties panel. Then click the Advanced Tab, and there should be a button called Environment Variables. Click that to bring up the Environment Variables section. Now, under User Variables you should be able to click the New button, and make a new Variables Name called HOME, with the Variable Value of whatever path you copied nano.rc into (just the directory name; don't add nano.rc onto the end).</p>
|
||||
<p>We're still working on documentatino for enabling synax highlighting on Win32; please bear with us</p>
|
||||
<p>Note that the nano.rc file must remain Unix formated in order for nano to unerstand it. In other words, you should use probably only use nano to edit its config file. Other programs like Wordpad and Notepad will either convert the file to DOS format when saving, and the latter does not even properly read Unix-formatted files to begin with.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
<h2><a name="4.1"></a>4.1. How do I open a file with a name beginning with '+' from the command line?</h2>
|
||||
@@ -217,6 +223,11 @@
|
||||
<blockquote><p>Try holding down the Shift key and selecting or pasting the text as you normally would.</p></blockquote>
|
||||
<h2><a name="4.14"></a>4.14. When I paste text into a document, each line gets indented further than the last. Why does nano do this, and how can I avoid it?</h2>
|
||||
<blockquote><p>You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.</p></blockquote>
|
||||
<h2><a name="4.15"></a>4.15. On startup I get a message that says "Detected a legacy nano history file". Now other nano versionc can't find my search history!</h2>
|
||||
<blockquote><p>In nano 2.3.0, cursor position history was introduced, and both files now reside under a .nano directory in your home. Nano was trying to move this file into the new location so it could continue to use it. This means that if you try and use an earlier version of nano, it will be unable to see your previous search history. To fix this, run the following commands:<br>
|
||||
mv ~/.nano/search_history ~/.nano_history<br>
|
||||
ln -sf ~/.nano_history ~/.nano/search_history<br>
|
||||
</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
|
||||
@@ -246,7 +257,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 +267,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>
|
||||
|
||||
@@ -6,20 +6,30 @@ endif
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
.\"
|
||||
|
||||
@@ -62,7 +62,7 @@ line.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
filename suffixed with a ~.
|
||||
.TP
|
||||
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts unique backup files if file
|
||||
@@ -77,13 +77,16 @@ Convert typed tabs to spaces.
|
||||
.B \-F (\-\-multibuffer)
|
||||
Enable multiple file buffers, if available.
|
||||
.TP
|
||||
.B \-G (\-\-locking)
|
||||
Enable vim-style file locking when editing files.
|
||||
.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 +110,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
|
||||
@@ -172,11 +176,15 @@ chroot.
|
||||
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 \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.
|
||||
@@ -185,6 +193,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
|
||||
@@ -197,6 +209,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.
|
||||
|
||||
@@ -208,7 +227,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
|
||||
|
||||
@@ -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
|
||||
@@ -57,6 +57,11 @@ match \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP, and \fI}\fP.
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
.B set/unset allow_insecure_backup
|
||||
When backing up files, allow the backup to succeed even if its permissions
|
||||
can't be (re)set due to special OS considerations. You should
|
||||
NOT enable this option unless you are sure you need it.
|
||||
.TP
|
||||
.B set/unset autoindent
|
||||
Use auto-indentation.
|
||||
.TP
|
||||
@@ -91,12 +96,15 @@ 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
|
||||
strings.
|
||||
.TP
|
||||
.B set/unset locking
|
||||
Enable vim-style lock-files for when editing files.
|
||||
.TP
|
||||
.B set matchbrackets "\fIstring\fP"
|
||||
Set the opening and closing brackets that can be found by bracket
|
||||
searches. They cannot contain blank characters. The former set must
|
||||
@@ -133,7 +141,7 @@ Don't wrap text at all.
|
||||
.B set operatingdir "\fIdirectory\fP"
|
||||
\fBnano\fP will only read and write files inside \fIdirectory\fP and its
|
||||
subdirectories. Also, the current directory is changed to here, so
|
||||
files are inserted from this diractory. By default, the operating
|
||||
files are inserted from this directory. By default, the operating
|
||||
directory feature is turned off.
|
||||
.TP
|
||||
.B set/unset preserve
|
||||
@@ -145,6 +153,11 @@ paragraphs. They cannot contain blank characters. Only closing
|
||||
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 \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
|
||||
keystroke instead of 25.
|
||||
@@ -170,6 +183,9 @@ won't work properly with this option enabled.
|
||||
.B set/unset regexp
|
||||
Do extended regular expression searches by default.
|
||||
.TP
|
||||
.B set/unset poslog
|
||||
Save the cursor position of files between editing sessions.
|
||||
.TP
|
||||
.B set/unset smarthome
|
||||
Make the Home key smarter. When Home is pressed anywhere but at the
|
||||
very beginning of non-whitespace characters on a line, the cursor will
|
||||
@@ -180,6 +196,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 lines.
|
||||
.TP
|
||||
.B set speller "\fIspellprog\fP"
|
||||
Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
@@ -197,9 +216,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.
|
||||
@@ -210,7 +235,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.
|
||||
@@ -220,6 +245,13 @@ the same as not having a syntax at all. The \fIdefault\fP syntax is
|
||||
special: it takes no \fIfileregex\fP, and applies to files that don't
|
||||
match any other syntax's \fIfileregex\fP.
|
||||
.TP
|
||||
.B magic ["\fIregex\fP" ... ]
|
||||
For the currently defined syntax, add one or more regexes which
|
||||
will be compared against the \fBmagic\fP database when attempting
|
||||
to determine which highlighting rules to use for a given file. This
|
||||
functionality only works when \fBlibmagic\fP is installed on the
|
||||
system and will be silently ignored otherwise.
|
||||
.TP
|
||||
.B color \fIfgcolor\fP,\fIbgcolor\fP "\fIregex\fP" ...
|
||||
For the currently defined syntax, display all expressions matching
|
||||
the extended regular expression \fIregex\fP with foreground color
|
||||
@@ -262,7 +294,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
|
||||
@@ -400,7 +432,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
|
||||
@@ -437,7 +469,7 @@ When writing a file, append to the end instead of overwriting.
|
||||
When writing a file, 'prepend' (write at the beginning) instead of overwriting.
|
||||
.TP
|
||||
.B backup
|
||||
When writing a file, create a backup of the current file.
|
||||
When writing a file, create a backup of the current file.
|
||||
.TP
|
||||
.B firstfile
|
||||
Move to the first file when using the file browser (reading or writing files).
|
||||
@@ -520,6 +552,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
|
||||
|
||||
@@ -56,6 +56,11 @@
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
# set historylog
|
||||
|
||||
## Enable vim-style lock-files. This is just to let a vim user know you
|
||||
## are editing a file [s]he is trying to edit and vice versa. There are
|
||||
## no plans to implement vim-style undo state in these files
|
||||
# set locking
|
||||
|
||||
## The opening and closing brackets that can be found by bracket
|
||||
## searches. They cannot contain blank characters. The former set must
|
||||
## come before the latter set, and both must be in the same order.
|
||||
@@ -141,6 +146,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 +166,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 +244,9 @@
|
||||
## C/C++
|
||||
# include "@PKGDATADIR@/c.nanorc"
|
||||
|
||||
## Makefiles
|
||||
# include "@PKGDATADIR@/makefile.nanorc"
|
||||
|
||||
## Cascading Style Sheets
|
||||
# include "@PKGDATADIR@/css.nanorc"
|
||||
|
||||
@@ -277,6 +292,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"
|
||||
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
pkgdata_DATA = asm.nanorc \
|
||||
awk.nanorc \
|
||||
cmake.nanorc \
|
||||
c.nanorc \
|
||||
css.nanorc \
|
||||
debian.nanorc \
|
||||
fortran.nanorc \
|
||||
gentoo.nanorc \
|
||||
groff.nanorc \
|
||||
html.nanorc \
|
||||
java.nanorc \
|
||||
lua.nanorc \
|
||||
makefile.nanorc \
|
||||
man.nanorc \
|
||||
mgp.nanorc \
|
||||
mutt.nanorc \
|
||||
nanorc.nanorc \
|
||||
objc.nanorc \
|
||||
ocaml.nanorc \
|
||||
patch.nanorc \
|
||||
perl.nanorc \
|
||||
php.nanorc \
|
||||
pov.nanorc \
|
||||
python.nanorc \
|
||||
ruby.nanorc \
|
||||
sh.nanorc \
|
||||
tex.nanorc \
|
||||
spec.nanorc \
|
||||
tcl.nanorc \
|
||||
php.nanorc \
|
||||
gentoo.nanorc \
|
||||
debian.nanorc \
|
||||
awk.nanorc \
|
||||
css.nanorc \
|
||||
xml.nanorc \
|
||||
ocaml.nanorc \
|
||||
objc.nanorc \
|
||||
fortran.nanorc
|
||||
tex.nanorc \
|
||||
xml.nanorc
|
||||
|
||||
EXTRA_DIST = $(pkgdata_DATA)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for assembler.
|
||||
##
|
||||
syntax "asm" "\.(S|s|asm)$"
|
||||
magic "[Aa]ssembl(y|er)"
|
||||
color red "\<[A-Z_]{2,}\>"
|
||||
color brightgreen "\.(data|subsection|text)"
|
||||
color green "\.(align|file|globl|global|hidden|section|size|type|weak)"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for awk.
|
||||
##
|
||||
syntax "awk" "\.awk$"
|
||||
magic "awk.*script text"
|
||||
## records
|
||||
icolor brightred "\$[0-9A-Z_!@#$*?-]+"
|
||||
## awk-set variables
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for C/C++.
|
||||
##
|
||||
syntax "c" "\.(c(c|pp|xx)?|C)$" "\.(h(h|pp|xx)?|H)$" "\.ii?$"
|
||||
magic "ASCII C(\+\+)? program text"
|
||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
color green "\<(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline)\>"
|
||||
color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
|
||||
@@ -8,7 +9,7 @@ color green "\<(class|namespace|template|public|protected|private|typename|this|
|
||||
color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
|
||||
color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
color magenta "\<(goto|continue|break|return)\>"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
|
||||
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
||||
##
|
||||
## GCC builtins
|
||||
|
||||
19
doc/syntax/cmake.nanorc
Normal file
19
doc/syntax/cmake.nanorc
Normal file
@@ -0,0 +1,19 @@
|
||||
## CMake syntax highlighter for GNU Nano
|
||||
##
|
||||
syntax "cmake" "(CMakeLists\.txt|\.cmake)$"
|
||||
|
||||
icolor green "^[[:space:]]*[A-Z0-9_]+"
|
||||
icolor brightyellow "^[[:space:]]*(include|include_directories|include_external_msproject)\>"
|
||||
|
||||
icolor brightgreen "^[[:space:]]*\<((else|end)?if|else|(end)?while|(end)?foreach|break)\>"
|
||||
color brightgreen "\<(NOT|COMMAND|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\>[[:space:]]"
|
||||
color brightgreen "[[:space:]]\<(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\>[[:space:]]"
|
||||
|
||||
icolor brightred "^[[:space:]]*\<((end)?(function|macro)|return)"
|
||||
|
||||
icolor cyan start="\$(\{|ENV\{)" end="\}"
|
||||
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
|
||||
|
||||
icolor brightblue "^([[:space:]]*)?#.*"
|
||||
icolor brightblue "[[:space:]]#.*"
|
||||
color ,green "[[:space:]]+$"
|
||||
@@ -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!
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
## Here is a short example for HTML.
|
||||
##
|
||||
syntax "html" "\.html$"
|
||||
magic "HTML document text"
|
||||
color blue start="<" end=">"
|
||||
color red "&[^;[[:space:]]]*;"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for Java.
|
||||
##
|
||||
syntax "java" "\.java$"
|
||||
magic "Java "
|
||||
color green "\<(boolean|byte|char|double|float|int|long|new|short|this|transient|void)\>"
|
||||
color red "\<(break|case|catch|continue|default|do|else|finally|for|if|return|switch|throw|try|while)\>"
|
||||
color cyan "\<(abstract|class|extends|final|implements|import|instanceof|interface|native|package|private|protected|public|static|strictfp|super|synchronized|throws|volatile)\>"
|
||||
|
||||
76
doc/syntax/lua.nanorc
Normal file
76
doc/syntax/lua.nanorc
Normal file
@@ -0,0 +1,76 @@
|
||||
##############################################################################
|
||||
#
|
||||
# Lua syntax highlighting for Nano.
|
||||
#
|
||||
# Author: Matthew Wild <mwild1 (at) gmail.com>
|
||||
# License: GPL 3 or later
|
||||
#
|
||||
# Version: 2011-05-05
|
||||
#
|
||||
# Notes: Originally based on Ruby syntax rc by Josef 'Jupp' Schugt
|
||||
##############################################################################
|
||||
|
||||
|
||||
# Automatically use for '.lua' files
|
||||
syntax "lua" "\.lua$"
|
||||
|
||||
color brightwhite "\[\[.*\]\]"
|
||||
|
||||
# Operators
|
||||
color brightyellow ":|\*|/|%|\+|-|\^|>|>=|<|<=|~=|=|\.\.|\<(not|and|or)\>"
|
||||
|
||||
# Statements
|
||||
color brightblue "\<(do|end|while|repeat|until|if|elseif|then|else|for|in|function|local|return|break)\>"
|
||||
|
||||
# Keywords
|
||||
color brightyellow "\<(debug|string|math|table|io|coroutine|os)\>\."
|
||||
color brightyellow "\<(_G|_VERSION|assert|collectgarbage|dofile|error|getfenv|getmetatable|ipairs|load|loadfile|module|next|pairs|pcall|print|rawequal|rawget|rawset|require|select|setfenv|setmetatable|tonumber|tostring|type|unpack|xpcall)\s*\("
|
||||
|
||||
# Standard library
|
||||
color brightyellow "io\.\<(close|flush|input|lines|open|output|popen|read|tmpfile|type|write|stdin|stdout|stderr)\>"
|
||||
color brightyellow "math\.\<(abs|acos|asin|atan2|atan|ceil|cosh|cos|deg|exp|floor|fmod|frexp|huge|ldexp|log10|log|max|min|mod|modf|pi|pow|rad|random|randomseed|sinh|tan)\>"
|
||||
color brightyellow "os\.\<(clock|date|difftime|execute|exit|getenv|remove|rename|setlocale|time|tmpname)\>"
|
||||
color brightyellow "package\.\<(cpath|loaded|loadlib|path|preload|seeall)\>"
|
||||
color brightyellow "string\.\<(byte|char|dump|find|format|gmatch|gsub|len|lower|match|rep|reverse|sub|upper)\>"
|
||||
color brightyellow "table\.\<(concat|insert|maxn|remove|sort)\>"
|
||||
color brightyellow "coroutine\.\<(create|resume|running|status|wrap|yield)\>"
|
||||
color brightyellow "debug\.\<(debug|getfenv|gethook|getinfo|getlocal|getmetatable|getregistry|getupvalue|setfenv|sethook|setlocal|setmetatable|setupvalue|traceback)\>"
|
||||
|
||||
# File handle methods
|
||||
color brightyellow "\:\<(close|flush|lines|read|seek|setvbuf|write)\>"
|
||||
|
||||
# false, nil, true
|
||||
color brightmagenta "\<(false|nil|true)\>"
|
||||
|
||||
# External files
|
||||
color brightgreen "\<(dofile|require)\>"
|
||||
|
||||
# Numbers
|
||||
color red "\<([0-9]+)\>"
|
||||
|
||||
# Symbols
|
||||
color brightmagenta "(\(|\)|\[|\]|\{|\})"
|
||||
|
||||
|
||||
# Shebang
|
||||
color brightcyan "^#!.*"
|
||||
|
||||
# Simple comments
|
||||
color green "\-\-.*$"
|
||||
|
||||
# Multiline comments
|
||||
color green start="\-\-\[\[" end="\]\]"
|
||||
|
||||
# Strings
|
||||
#color green "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
|
||||
|
||||
# Strings
|
||||
color red "\"(\\.|[^\\\"])*\"|'(\\.|[^\\'])*'"
|
||||
|
||||
# color red start="\[\[" end="\]\]"
|
||||
|
||||
|
||||
# Hex literals
|
||||
color red "0x[0-9a-fA-F]*"
|
||||
|
||||
|
||||
8
doc/syntax/makefile.nanorc
Normal file
8
doc/syntax/makefile.nanorc
Normal 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 "#.*$"
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for manpages.
|
||||
##
|
||||
syntax "man" "\.[1-9]x?$"
|
||||
magic "troff or preprocessor input text"
|
||||
color green "\.(S|T)H.*$"
|
||||
color brightgreen "\.(S|T)H" "\.TP"
|
||||
color brightred "\.(BR?|I[PR]?).*$"
|
||||
|
||||
8
doc/syntax/mgp.nanorc
Normal file
8
doc/syntax/mgp.nanorc
Normal file
@@ -0,0 +1,8 @@
|
||||
## Here is an example for Magicpoint presentations
|
||||
##
|
||||
syntax "mgp" "\.mgp$"
|
||||
header "^%include.*"
|
||||
icolor green "^%[a-z].*$"
|
||||
color cyan "(^|[[:space:]])#.*$"
|
||||
color cyan "(^|[[:space:]])%%.*$"
|
||||
color ,green "[[:space:]]+$"
|
||||
@@ -4,8 +4,8 @@ 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 green "^[[:space:]]*(set|unset|include|syntax|header)\>"
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|poslog|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|speller|suspend|suspendenable|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds|locking)\>"
|
||||
icolor green "^[[:space:]]*(set|unset|include|syntax|header|magic)\>"
|
||||
## Colors
|
||||
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for patch files.
|
||||
##
|
||||
syntax "patch" "\.(patch|diff)$"
|
||||
magic "diff output text"
|
||||
color brightgreen "^\+.*"
|
||||
color green "^\+\+\+.*"
|
||||
color brightblue "^ .*"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for Perl.
|
||||
##
|
||||
syntax "perl" "\.p[lm]$"
|
||||
magic "perl.*script text"
|
||||
header "^#!.*/perl[-0-9._]*"
|
||||
color red "\<(accept|alarm|atan2|bin(d|mode)|c(aller|h(dir|mod|op|own|root)|lose(dir)?|onnect|os|rypt)|d(bm(close|open)|efined|elete|ie|o|ump)|e(ach|of|val|x(ec|ists|it|p))|f(cntl|ileno|lock|ork))\>" "\<(get(c|login|peername|pgrp|ppid|priority|pwnam|(host|net|proto|serv)byname|pwuid|grgid|(host|net)byaddr|protobynumber|servbyport)|([gs]et|end)(pw|gr|host|net|proto|serv)ent|getsock(name|opt)|gmtime|goto|grep|hex|index|int|ioctl|join)\>" "\<(keys|kill|last|length|link|listen|local(time)?|log|lstat|m|mkdir|msg(ctl|get|snd|rcv)|next|oct|open(dir)?|ord|pack|pipe|pop|printf?|push|q|qq|qx|rand|re(ad(dir|link)?|cv|do|name|quire|set|turn|verse|winddir)|rindex|rmdir|s|scalar|seek(dir)?)\>" "\<(se(lect|mctl|mget|mop|nd|tpgrp|tpriority|tsockopt)|shift|shm(ctl|get|read|write)|shutdown|sin|sleep|socket(pair)?|sort|spli(ce|t)|sprintf|sqrt|srand|stat|study|substr|symlink|sys(call|read|tem|write)|tell(dir)?|time|tr(y)?|truncate|umask)\>" "\<(un(def|link|pack|shift)|utime|values|vec|wait(pid)?|wantarray|warn|write)\>"
|
||||
color magenta "\<(continue|else|elsif|do|for|foreach|if|unless|until|while|eq|ne|lt|gt|le|ge|cmp|x|my|sub|use|package|can|isa)\>"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for PHP
|
||||
##
|
||||
syntax "php" "\.php[2345s~]?$"
|
||||
magic "PHP script text"
|
||||
|
||||
## php markings
|
||||
color brightgreen "(<\?(php)?|\?>)"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
## Here is an example for Bourne shell scripts.
|
||||
##
|
||||
syntax "sh" "\.sh$"
|
||||
header "^#!.*/(ba|k|pdk|)sh[-0-9_]*"
|
||||
magic "(POSIX|Bourne.*) shell script text"
|
||||
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 "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
|
||||
|
||||
38
doc/syntax/spec.nanorc
Normal file
38
doc/syntax/spec.nanorc
Normal file
@@ -0,0 +1,38 @@
|
||||
# RPM spec files syntax highlighting
|
||||
# Parts taken from kate (KDE) syntax highlighting
|
||||
# Asterios Dramis
|
||||
syntax "spec" "\.(spec$|spec\.*)"
|
||||
# Main tags
|
||||
color brightblue "((Icon|ExclusiveOs|ExcludeOs)[[:space:]]*:)"
|
||||
color brightblue "((BuildArch|BuildArchitectures|ExclusiveArch|ExcludeArch)[[:space:]]*:)"
|
||||
color brightblue "((Conflicts|Obsoletes|Provides|Requires|Requires\(.*\)|Enhances|Suggests|BuildConflicts|BuildRequires|Recommends|PreReq|Supplements)[[:space:]]*:)"
|
||||
color brightblue "((Epoch|Serial|Nosource|Nopatch)[[:space:]]*:)"
|
||||
color brightblue "((AutoReq|AutoProv|AutoReqProv)[[:space:]]*:)"
|
||||
color brightblue "((Copyright|License|Summary|Summary\(.*\)|Distribution|Vendor|Packager|Group|Source\d*|Patch\d*|BuildRoot|Prefix)[[:space:]]*:)"
|
||||
color brightblue "((Name|Version|Release|Url|URL)[[:space:]]*:)"
|
||||
color brightblue start="^Source" end=":" start="^Patch" end=":"
|
||||
# Architectures
|
||||
color brightred "(i386|i486|i586|i686|athlon|ia64|alpha|alphaev5|alphaev56|alphapca56|alphaev6|alphaev67|sparc|sparcv9|sparc64armv3l|armv4b|armv4lm|ips|mipsel|ppc|ppc|iseries|ppcpseries|ppc64|m68k|m68kmint|Sgi|rs6000|i370|s390x|s390|noarch)"
|
||||
# Architectures conditionals
|
||||
color brightred "(ifarch|ifnarch)"
|
||||
# OS conditionals
|
||||
color brightred "(ifos|ifnos)"
|
||||
# %* strings
|
||||
color green "%([A-Z_a-z_0-9_]*)"
|
||||
color magenta "%_([A-Z_a-z_0-9_]*)"
|
||||
color yellow start="%__" end="\ "
|
||||
color magenta start="%\{" end="\}"
|
||||
color yellow start="%\{__" end="\}"
|
||||
# Sections
|
||||
color red "^%(build$|changelog|check$|clean$|description|files|install$|package|pre|prep$|preun|post|postun)"
|
||||
color red "^%(trigger|triggerin|triggerpostun|triggerun|verifyscript)"
|
||||
# Conditionals and Defines
|
||||
color brightred "%(if|else|endif|define|global|undefine)"
|
||||
# Comments
|
||||
color cyan "#.*$"
|
||||
# "# norootforbuild" is handled as main tag
|
||||
color brightblue "^# norootforbuild"
|
||||
# %changelog date entries
|
||||
color brightyellow "^\* .*\)$"
|
||||
# Trailing whitespace
|
||||
color ,green "[[:space:]]+$"
|
||||
@@ -13,4 +13,4 @@ color green "(\(|\)|\;|`|\\|\$|<|>|!|=|&|\|)"
|
||||
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
||||
icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
|
||||
color ,green "[[:space:]]+$"
|
||||
color ,magenta "^([[:space:]]+|)#.*"
|
||||
color ,magenta "^[[:space:]]*#.*"
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
syntax "tex" "\.tex$"
|
||||
icolor green "\\.|\\[A-Z]*"
|
||||
color magenta "[{}]"
|
||||
color blue "%.*"
|
||||
color blue "(^|[^\])%.*"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for xml files.
|
||||
##
|
||||
syntax "xml" "\.([jrs]html?|sgml?|xml|xslt?)$"
|
||||
magic "XML.*document text"
|
||||
color green start="<" end=">"
|
||||
color cyan "<[^> ]+"
|
||||
color cyan ">"
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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,9 +16,11 @@ foreach my $name (@combos) {
|
||||
my @args = @$name;
|
||||
my $pct = $i / $#combos * 100;
|
||||
printf "Trying with options: @args, %d%% done...\n", $pct;
|
||||
if (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++;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
bg ca cs da de es eu fi fr ga gl hu id it ms nb nl nn pl pt_BR ro ru rw sr sv tr uk vi zh_CN zh_TW
|
||||
bg ca cs da de eo es eu fi fr ga gl hu id it ja ms nb nl nn pl pt_BR ro ru rw sl sr sv tr uk vi zh_CN zh_TW
|
||||
|
||||
944
po/nano.pot
944
po/nano.pot
File diff suppressed because it is too large
Load Diff
1812
po/pt_BR.po
1812
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
21
po/update_linguas.sh
Executable file
21
po/update_linguas.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
echo "Updating translations via TP" && \
|
||||
rsync -Lrtvz translationproject.org::tp/latest/nano/ .
|
||||
#
|
||||
NEWSTUFF=`svn status | grep "^\? .*.po$" | awk '{ print $NF }'`
|
||||
if [ "x$NEWSTUFF" != "x" ]; then
|
||||
echo "Adding new languaes to SVN"
|
||||
svn add $NEWSTUFF
|
||||
fi
|
||||
#
|
||||
echo "Updating LINGUAS for all translations"
|
||||
FILE=LINGUAS
|
||||
echo "# List of available languages." >$FILE
|
||||
/bin/ls *.po | tr '\n' ' ' | sed 's/\.po//g' >>$FILE
|
||||
echo >> $FILE
|
||||
#
|
||||
if [ "x$NEWSTUFF" != "x" ]; then
|
||||
echo -n "New langs found, re-running configure and make at top level (silently)..."
|
||||
(cd .. && ./configure && make) >/dev/null
|
||||
echo "done"
|
||||
fi
|
||||
1348
po/zh_CN.po
1348
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
985
po/zh_TW.po
985
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -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 *
|
||||
@@ -156,7 +156,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
* time, put back the Enter key so that it's
|
||||
* read in. */
|
||||
if (old_selected == selected)
|
||||
unget_kbinput(sc_seq_or(DO_ENTER, 0), FALSE, FALSE);
|
||||
unget_kbinput(sc_seq_or(do_enter_void, 0), FALSE, FALSE);
|
||||
}
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
@@ -169,9 +169,9 @@ char *do_browser(char *path, DIR *dir)
|
||||
if (!f)
|
||||
break;
|
||||
|
||||
if (f->scfunc == TOTAL_REFRESH) {
|
||||
if (f->scfunc == total_refresh) {
|
||||
total_redraw();
|
||||
} else if (f->scfunc == DO_HELP_VOID) {
|
||||
} else if (f->scfunc == do_help_void) {
|
||||
#ifndef DISABLE_HELP
|
||||
do_browser_help();
|
||||
curs_set(0);
|
||||
@@ -179,33 +179,33 @@ char *do_browser(char *path, DIR *dir)
|
||||
nano_disabled_msg();
|
||||
#endif
|
||||
/* Search for a filename. */
|
||||
} else if (f->scfunc == DO_SEARCH) {
|
||||
} else if (f->scfunc == do_search) {
|
||||
curs_set(1);
|
||||
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) {
|
||||
} else if (f->scfunc == do_page_up) {
|
||||
if (selected >= (editwinrows + fileline % editwinrows) *
|
||||
width)
|
||||
selected -= (editwinrows + fileline % editwinrows) *
|
||||
width;
|
||||
else
|
||||
selected = 0;
|
||||
} else if (f->scfunc == DO_PAGE_DOWN) {
|
||||
} else if (f->scfunc == do_page_down) {
|
||||
selected += (editwinrows - fileline % editwinrows) *
|
||||
width;
|
||||
if (selected > filelist_len - 1)
|
||||
selected = filelist_len - 1;
|
||||
} else if (f->scfunc == FIRST_FILE_MSG) {
|
||||
} else if (f->scfunc == do_first_file) {
|
||||
if (meta_key)
|
||||
selected = 0;
|
||||
} else if (f->scfunc == LAST_FILE_MSG) {
|
||||
} else if (f->scfunc == do_last_file) {
|
||||
if (meta_key)
|
||||
selected = filelist_len - 1;
|
||||
/* Go to a specific directory. */
|
||||
} else if (f->scfunc == GOTO_DIR_MSG) {
|
||||
} else if (f->scfunc == goto_dir_void) {
|
||||
curs_set(1);
|
||||
|
||||
i = do_prompt(TRUE,
|
||||
@@ -232,15 +232,15 @@ 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
|
||||
* again, the prompt is displayed again, and what we
|
||||
* typed before at the prompt is displayed again. */
|
||||
unget_kbinput(sc_seq_or(DO_GOTOLINECOLUMN_VOID, 0), FALSE, FALSE);
|
||||
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,31 +278,31 @@ char *do_browser(char *path, DIR *dir)
|
||||
strerror(errno));
|
||||
beep();
|
||||
free(new_path);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Start over again with the new path value. */
|
||||
free(path);
|
||||
path = new_path;
|
||||
goto change_browser_directory;
|
||||
} else if (f->scfunc == DO_UP_VOID) {
|
||||
} else if (f->scfunc == do_up_void) {
|
||||
if (selected >= width)
|
||||
selected -= width;
|
||||
} else if (f->scfunc == DO_LEFT) {
|
||||
} else if (f->scfunc == do_left) {
|
||||
if (selected > 0)
|
||||
selected--;
|
||||
} else if (f->scfunc == DO_DOWN_VOID) {
|
||||
} else if (f->scfunc == do_down_void) {
|
||||
if (selected + width <= filelist_len - 1)
|
||||
selected += width;
|
||||
} else if (f->scfunc == DO_RIGHT) {
|
||||
} else if (f->scfunc == do_right) {
|
||||
if (selected < filelist_len - 1)
|
||||
selected++;
|
||||
} else if (f->scfunc == DO_ENTER) {
|
||||
} else if (f->scfunc == do_enter_void) {
|
||||
/* We can't move up from "/". */
|
||||
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]);
|
||||
@@ -355,7 +355,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
/* Start over again with the new path value. */
|
||||
goto change_browser_directory;
|
||||
/* Abort the file browser. */
|
||||
} else if (f->scfunc == DO_EXIT) {
|
||||
} else if (f->scfunc == do_exit) {
|
||||
abort = TRUE;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
@@ -552,32 +552,32 @@ void parse_browser_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||
if (!*meta_key) {
|
||||
switch (*kbinput) {
|
||||
case ' ':
|
||||
*kbinput = sc_seq_or(DO_PAGE_DOWN, 0);
|
||||
*kbinput = sc_seq_or(do_page_down, 0);
|
||||
break;
|
||||
case '-':
|
||||
*kbinput = sc_seq_or(DO_PAGE_UP, 0);
|
||||
*kbinput = sc_seq_or(do_page_up, 0);
|
||||
break;
|
||||
case '?':
|
||||
#ifndef DISABLE_HELP
|
||||
*kbinput = sc_seq_or(DO_HELP_VOID, 0);
|
||||
*kbinput = sc_seq_or(do_help_void, 0);
|
||||
#endif
|
||||
break;
|
||||
/* Cancel equivalent to Exit here. */
|
||||
case 'E':
|
||||
case 'e':
|
||||
*kbinput = sc_seq_or(DO_EXIT, 0);
|
||||
*kbinput = sc_seq_or(do_exit, 0);
|
||||
break;
|
||||
case 'G':
|
||||
case 'g':
|
||||
*kbinput = sc_seq_or(GOTO_DIR_MSG, 0);
|
||||
*kbinput = sc_seq_or(goto_dir_void, 0);
|
||||
break;
|
||||
case 'S':
|
||||
case 's':
|
||||
*kbinput = sc_seq_or(DO_ENTER, 0);
|
||||
*kbinput = sc_seq_or(do_enter_void, 0);
|
||||
break;
|
||||
case 'W':
|
||||
case 'w':
|
||||
*kbinput = sc_seq_or(DO_SEARCH, 0);
|
||||
*kbinput = sc_seq_or(do_search, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -794,7 +794,7 @@ int filesearch_init(void)
|
||||
TRUE,
|
||||
#endif
|
||||
MWHEREISFILE, backupstring,
|
||||
&meta_key, &func_key,
|
||||
&meta_key, &func_key,
|
||||
#ifndef NANO_TINY
|
||||
&search_history,
|
||||
#endif
|
||||
@@ -841,18 +841,18 @@ int filesearch_init(void)
|
||||
#endif
|
||||
} else
|
||||
#ifndef NANO_TINY
|
||||
if (s && s->scfunc == CASE_SENS_MSG) {
|
||||
if (s && s->scfunc == case_sens_void) {
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (s && s->scfunc == BACKWARDS_MSG) {
|
||||
} else if (s && s->scfunc == backwards_void) {
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (s && s->scfunc == REGEXP_MSG) {
|
||||
if (s && s->scfunc == regexp_void) {
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
|
||||
48
src/chars.c
48
src/chars.c
@@ -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);
|
||||
}
|
||||
|
||||
void mbtowc_reset(void)
|
||||
{
|
||||
IGNORE_CALL_RESULT(mbtowc(NULL, NULL, 0));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -620,7 +630,7 @@ char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
return NULL;
|
||||
} else
|
||||
#endif
|
||||
return strcasestr(haystack, needle);
|
||||
return (char *) strcasestr(haystack, needle);
|
||||
}
|
||||
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
|
||||
@@ -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;
|
||||
}
|
||||
@@ -810,7 +820,7 @@ char *mbstrchr(const char *s, const char *c)
|
||||
return (char *)q;
|
||||
} else
|
||||
#endif
|
||||
return strchr(s, *c);
|
||||
return (char *) strchr(s, *c);
|
||||
}
|
||||
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
|
||||
|
||||
@@ -830,7 +840,7 @@ char *mbstrpbrk(const char *s, const char *accept)
|
||||
return NULL;
|
||||
} else
|
||||
#endif
|
||||
return strpbrk(s, accept);
|
||||
return (char *) strpbrk(s, accept);
|
||||
}
|
||||
|
||||
/* This function is equivalent to strpbrk(), except in that it scans the
|
||||
|
||||
153
src/color.c
153
src/color.c
@@ -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 *
|
||||
@@ -25,6 +25,11 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef HAVE_MAGIC_H
|
||||
#include <magic.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
@@ -102,12 +107,33 @@ void color_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Cleanup a regex we previously compiled */
|
||||
void nfreeregex(regex_t **r)
|
||||
{
|
||||
assert(r != NULL);
|
||||
|
||||
regfree(*r);
|
||||
free(*r);
|
||||
*r = NULL;
|
||||
}
|
||||
|
||||
/* Update the color information based on the current filename. */
|
||||
void color_update(void)
|
||||
{
|
||||
syntaxtype *tmpsyntax;
|
||||
syntaxtype *defsyntax = NULL;
|
||||
colortype *tmpcolor, *defcolor = NULL;
|
||||
exttype *e;
|
||||
|
||||
/* libmagic structures */
|
||||
/* magicstring will be NULL if we fail to get magic result */
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
const char *magicstring = NULL;
|
||||
const char *magicerr = NULL;
|
||||
magic_t m;
|
||||
struct stat fileinfo;
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
|
||||
|
||||
assert(openfile != NULL);
|
||||
|
||||
@@ -133,13 +159,35 @@ void color_update(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
|
||||
if (strcmp(openfile->filename,"") && stat(openfile->filename, &fileinfo) == 0) {
|
||||
m = magic_open(MAGIC_SYMLINK |
|
||||
#ifdef DEBUG
|
||||
MAGIC_DEBUG | MAGIC_CHECK |
|
||||
#endif /* DEBUG */
|
||||
MAGIC_ERROR);
|
||||
if (m == NULL || magic_load(m, NULL) < 0)
|
||||
fprintf(stderr, "something went wrong: %s [%s]\n", strerror(errno), openfile->filename);
|
||||
else {
|
||||
magicstring = magic_file(m,openfile->filename);
|
||||
if (magicstring == NULL) {
|
||||
magicerr = magic_error(m);
|
||||
fprintf(stderr, "something went wrong: %s [%s]\n", magicerr, openfile->filename);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "magic string returned: %s\n", magicstring);
|
||||
#endif /* DEBUG */
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
|
||||
/* If we didn't specify a syntax override string, or if we did and
|
||||
* there was no syntax by that name, get the syntax based on the
|
||||
* file extension, and then look in the header. */
|
||||
if (openfile->colorstrings == NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
exttype *e;
|
||||
|
||||
/* If this is the default syntax, it has no associated
|
||||
* extensions, which we've checked for elsewhere. Skip over
|
||||
@@ -163,24 +211,51 @@ void color_update(void)
|
||||
|
||||
/* Set colorstrings if we matched the extension
|
||||
* regex. */
|
||||
if (regexec(e->ext, openfile->filename, 0, NULL,
|
||||
0) == 0) {
|
||||
if (regexec(e->ext, openfile->filename, 0, NULL, 0) == 0) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
}
|
||||
|
||||
if (openfile->colorstrings != NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Decompile e->ext_regex's specified regex if we aren't
|
||||
* going to use it. */
|
||||
if (not_compiled) {
|
||||
regfree(e->ext);
|
||||
free(e->ext);
|
||||
e->ext = NULL;
|
||||
if (not_compiled)
|
||||
nfreeregex(&e->ext);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check magic if we don't yet have an answer */
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
if (openfile->colorstrings == NULL) {
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "No match using extension, trying libmagic...\n");
|
||||
#endif /* DEBUG */
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
for (e = tmpsyntax->magics; e != NULL; e = e->next) {
|
||||
bool not_compiled = (e->ext == NULL);
|
||||
if (not_compiled) {
|
||||
e->ext = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(e->ext, fixbounds(e->ext_regex), REG_EXTENDED);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"Matching regex \"%s\" against \"%s\"\n",e->ext_regex, magicstring);
|
||||
#endif /* DEBUG */
|
||||
|
||||
if (magicstring && regexec(e->ext, magicstring, 0, NULL, 0) == 0) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
break;
|
||||
}
|
||||
|
||||
if (not_compiled)
|
||||
nfreeregex(&e->ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
|
||||
/* If we haven't matched anything yet, try the headers */
|
||||
if (openfile->colorstrings == NULL) {
|
||||
@@ -189,7 +264,6 @@ void color_update(void)
|
||||
#endif
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
exttype *e;
|
||||
|
||||
for (e = tmpsyntax->headers; e != NULL; e = e->next) {
|
||||
bool not_compiled = (e->ext == NULL);
|
||||
@@ -217,11 +291,8 @@ void color_update(void)
|
||||
|
||||
/* Decompile e->ext_regex's specified regex if we aren't
|
||||
* going to use it. */
|
||||
if (not_compiled) {
|
||||
regfree(e->ext);
|
||||
free(e->ext);
|
||||
e->ext = NULL;
|
||||
}
|
||||
if (not_compiled)
|
||||
nfreeregex(&e->ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -268,6 +339,16 @@ void reset_multis_after(filestruct *fileptr, int mindex)
|
||||
else
|
||||
break;
|
||||
}
|
||||
for (; oof != NULL; oof = oof->next) {
|
||||
alloc_multidata_if_needed(oof);
|
||||
if (oof->multidata == NULL)
|
||||
continue;
|
||||
if (oof->multidata[mindex] == CNONE)
|
||||
oof->multidata[mindex] = -1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
edit_refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
void reset_multis_before(filestruct *fileptr, int mindex)
|
||||
@@ -282,11 +363,31 @@ void reset_multis_before(filestruct *fileptr, int mindex)
|
||||
else
|
||||
break;
|
||||
}
|
||||
for (; oof != NULL; oof = oof->prev) {
|
||||
alloc_multidata_if_needed(oof);
|
||||
if (oof->multidata == NULL)
|
||||
continue;
|
||||
if (oof->multidata[mindex] == CNONE)
|
||||
oof->multidata[mindex] = -1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
edit_refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
/* Reset one multiline regex info */
|
||||
void reset_multis_for_id(filestruct *fileptr, int num)
|
||||
{
|
||||
reset_multis_before(fileptr, num);
|
||||
reset_multis_after(fileptr, num);
|
||||
fileptr->multidata[num] = -1;
|
||||
}
|
||||
|
||||
/* Reset multi line strings around a filestruct ptr, trying to be smart about stopping */
|
||||
void reset_multis(filestruct *fileptr)
|
||||
/* Reset multi line strings around a filestruct ptr, trying to be smart about stopping
|
||||
force = reset everything regardless, useful when we don't know how much screen state
|
||||
has changed */
|
||||
void reset_multis(filestruct *fileptr, bool force)
|
||||
{
|
||||
int nobegin, noend;
|
||||
regmatch_t startmatch, endmatch;
|
||||
@@ -302,6 +403,11 @@ void reset_multis(filestruct *fileptr)
|
||||
continue;
|
||||
|
||||
alloc_multidata_if_needed(fileptr);
|
||||
if (force == TRUE) {
|
||||
reset_multis_for_id(fileptr, tmpcolor->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Figure out where the first begin and end are to determine if
|
||||
things changed drastically for the precalculated multi values */
|
||||
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
|
||||
@@ -309,16 +415,17 @@ void reset_multis(filestruct *fileptr)
|
||||
if (fileptr->multidata[tmpcolor->id] == CWHOLELINE) {
|
||||
if (nobegin && noend)
|
||||
continue;
|
||||
} else if (fileptr->multidata[tmpcolor->id] & CBEGINBEFORE && !noend
|
||||
} else if (fileptr->multidata[tmpcolor->id] == CNONE) {
|
||||
if (nobegin && noend)
|
||||
continue;
|
||||
} else if (fileptr->multidata[tmpcolor->id] & CBEGINBEFORE && !noend
|
||||
&& (nobegin || endmatch.rm_eo > startmatch.rm_eo)) {
|
||||
reset_multis_after(fileptr, tmpcolor->id);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we got here assume the worst */
|
||||
reset_multis_before(fileptr, tmpcolor->id);
|
||||
reset_multis_after(fileptr, tmpcolor->id);
|
||||
fileptr->multidata[tmpcolor->id] = -1;
|
||||
reset_multis_for_id(fileptr, tmpcolor->id);
|
||||
}
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
17
src/cut.c
17
src/cut.c
@@ -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) *
|
||||
@@ -211,9 +211,12 @@ void do_cut_text(
|
||||
* modified. */
|
||||
set_modified();
|
||||
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh();
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
reset_multis(openfile->current, FALSE);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(cutbuffer);
|
||||
@@ -276,7 +279,11 @@ void do_uncut_text(void)
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh();
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
reset_multis(openfile->current, FALSE);
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct_reverse();
|
||||
|
||||
742
src/files.c
742
src/files.c
File diff suppressed because it is too large
Load Diff
908
src/global.c
908
src/global.c
File diff suppressed because it is too large
Load Diff
32
src/help.c
32
src/help.c
@@ -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) *
|
||||
@@ -145,35 +145,35 @@ void do_help(void (*refresh_func)(void))
|
||||
if (!f)
|
||||
continue;
|
||||
|
||||
if (f->scfunc == TOTAL_REFRESH) {
|
||||
if (f->scfunc == total_refresh) {
|
||||
total_redraw();
|
||||
break;
|
||||
} else if (f->scfunc == DO_PAGE_UP) {
|
||||
} else if (f->scfunc == do_page_up) {
|
||||
if (line > editwinrows - 2)
|
||||
line -= editwinrows - 2;
|
||||
else
|
||||
line = 0;
|
||||
} else if (f->scfunc == DO_PAGE_DOWN) {
|
||||
} else if (f->scfunc == do_page_down) {
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line += editwinrows - 2;
|
||||
} else if (f->scfunc == DO_UP_VOID) {
|
||||
} else if (f->scfunc == do_up_void) {
|
||||
if (line > 0)
|
||||
line--;
|
||||
} else if (f->scfunc == DO_DOWN_VOID) {
|
||||
} else if (f->scfunc == do_down_void) {
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line++;
|
||||
} else if (f->scfunc == DO_FIRST_LINE) {
|
||||
} else if (f->scfunc == do_first_line) {
|
||||
if (meta_key)
|
||||
line = 0;
|
||||
break;
|
||||
} else if (f->scfunc == DO_LAST_LINE) {
|
||||
} else if (f->scfunc == do_last_line) {
|
||||
if (meta_key) {
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line = last_line - (editwinrows - 1);
|
||||
}
|
||||
break;
|
||||
/* Abort the help browser. */
|
||||
} else if (f->scfunc == DO_EXIT) {
|
||||
} else if (f->scfunc == do_exit) {
|
||||
abort = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -407,7 +407,7 @@ void help_init(void)
|
||||
size_t endis_len = strlen(_("enable/disable"));
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == DO_TOGGLE)
|
||||
if (s->scfunc == do_toggle_void)
|
||||
allocsize += strlen(_(flagtostr(s->toggle))) + endis_len + 9;
|
||||
|
||||
}
|
||||
@@ -446,7 +446,7 @@ void help_init(void)
|
||||
if (scsfound == 3)
|
||||
continue;
|
||||
|
||||
if (s->type == RAW)
|
||||
if (s->type == RAWINPUT)
|
||||
continue;
|
||||
|
||||
if ((s->menu & currmenu) == 0)
|
||||
@@ -478,7 +478,7 @@ void help_init(void)
|
||||
/* And the toggles... */
|
||||
if (currmenu == MMAIN)
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if (s->scfunc == DO_TOGGLE)
|
||||
if (s->scfunc == do_toggle_void)
|
||||
ptr += sprintf(ptr, "(%s)\t\t\t%s %s\n",
|
||||
s->keystr, _(flagtostr(s->toggle)), _("enable/disable"));
|
||||
|
||||
@@ -507,15 +507,15 @@ void parse_help_input(int *kbinput, bool *meta_key, bool *func_key)
|
||||
switch (*kbinput) {
|
||||
/* For consistency with the file browser. */
|
||||
case ' ':
|
||||
*kbinput = sc_seq_or(DO_PAGE_UP, 0);
|
||||
*kbinput = sc_seq_or(do_page_up, 0);
|
||||
break;
|
||||
case '-':
|
||||
*kbinput = sc_seq_or(DO_PAGE_DOWN, 0);;
|
||||
*kbinput = sc_seq_or(do_page_down, 0);;
|
||||
break;
|
||||
/* Cancel is equivalent to Exit here. */
|
||||
case 'E':
|
||||
case 'e':
|
||||
*kbinput = sc_seq_or(DO_EXIT, 0);;
|
||||
*kbinput = sc_seq_or(do_exit, 0);;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
83
src/move.c
83
src/move.c
@@ -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,63 +29,71 @@
|
||||
/* 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
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
openfile->placewewant = openfile->current_y = 0;
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#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;
|
||||
@@ -108,20 +116,25 @@ void do_page_down(void)
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
openfile->placewewant = openfile->current_y = 0;
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#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);
|
||||
|
||||
386
src/nano.c
386
src/nano.c
@@ -1,9 +1,9 @@
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* 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,7 +518,9 @@ openfilestruct *make_new_opennode(void)
|
||||
newnode->edittop = NULL;
|
||||
newnode->current = NULL;
|
||||
#ifndef NANO_TINY
|
||||
newnode->current_stat = NULL;
|
||||
newnode->last_action = OTHER;
|
||||
newnode->lock_filename = NULL;
|
||||
#endif
|
||||
|
||||
return newnode;
|
||||
@@ -608,6 +606,10 @@ void finish(void)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
if (!no_rcfiles && ISSET(HISTORYLOG))
|
||||
save_history();
|
||||
if (!no_rcfiles && ISSET(POS_HISTORY)) {
|
||||
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs()+1);
|
||||
save_poshistory();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -638,7 +640,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 +657,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 +672,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 +705,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);
|
||||
}
|
||||
|
||||
@@ -821,6 +846,8 @@ void usage(void)
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-G", "--locking",
|
||||
N_("Use (vim-style) lock files"));
|
||||
print_opt("-H", "--historylog",
|
||||
N_("Log & read search/replace string history"));
|
||||
#endif
|
||||
@@ -836,6 +863,10 @@ void usage(void)
|
||||
N_("Don't convert files from DOS/Mac format"));
|
||||
#endif
|
||||
print_opt("-O", "--morespace", N_("Use one more line for editing"));
|
||||
#ifndef NANO_TINY
|
||||
print_opt("-P", "--poslog",
|
||||
N_("Log & read location of cursor position"));
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
print_opt(_("-Q <str>"), _("--quotestr=<str>"),
|
||||
N_("Quoting string"));
|
||||
@@ -879,6 +910,8 @@ void usage(void)
|
||||
#endif
|
||||
print_opt("-p", "--preserve",
|
||||
N_("Preserve XON (^Q) and XOFF (^S) keys"));
|
||||
print_opt("-q", "--quiet",
|
||||
N_("Silently ignore startup issues like rc file errors"));
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
print_opt(_("-r <#cols>"), _("--fill=<#cols>"),
|
||||
N_("Set wrapping point at column #cols"));
|
||||
@@ -889,12 +922,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);
|
||||
@@ -910,8 +948,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:"));
|
||||
@@ -1023,6 +1061,12 @@ void do_exit(void)
|
||||
/* If the user chose not to save, or if the user chose to save and
|
||||
* the save succeeded, we're ready to exit. */
|
||||
if (i == 0 || (i == 1 && do_writeout(TRUE))) {
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && openfile->lock_filename)
|
||||
delete_lockfile(openfile->lock_filename);
|
||||
#endif /* NANO_TINY */
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Exit only if there are no more open file buffers. */
|
||||
if (!close_buffer())
|
||||
@@ -1036,10 +1080,16 @@ void do_exit(void)
|
||||
display_main_list();
|
||||
}
|
||||
|
||||
|
||||
/* Another placeholder for function mapping */
|
||||
void do_cancel(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
static struct sigaction pager_oldaction, pager_newaction; /* Original and temporary handlers for SIGINT. */
|
||||
static bool pager_sig_failed = FALSE; /* Did sigaction() fail without changing the signal handlers? */
|
||||
static bool pager_input_aborted = FALSE; /* Did someone invoke the pager and abort it via ^C? */
|
||||
|
||||
|
||||
/* Things which need to be run regardless of whether
|
||||
we finished the stdin pipe correctly or not */
|
||||
@@ -1053,14 +1103,15 @@ 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"));
|
||||
|
||||
dup2(ttystdin,0);
|
||||
close(ttystdin);
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_input_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_sig_failed && sigaction(SIGINT, &pager_oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
terminal_init();
|
||||
@@ -1072,13 +1123,15 @@ void finish_stdin_pager(void)
|
||||
RETSIGTYPE cancel_stdin_pager(int signal)
|
||||
{
|
||||
/* Currently do nothing, just handle the intr silently */
|
||||
pager_input_aborted = TRUE;
|
||||
}
|
||||
|
||||
/* Let nano read stdin for the first file at least */
|
||||
void stdin_pager(void)
|
||||
{
|
||||
endwin();
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
if (!pager_input_aborted)
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
|
||||
|
||||
/* Set things up so that Ctrl-C will cancel the new process. */
|
||||
@@ -1098,7 +1151,7 @@ void stdin_pager(void)
|
||||
nperror("sigaction");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open_buffer("", FALSE);
|
||||
finish_stdin_pager();
|
||||
}
|
||||
@@ -1153,16 +1206,20 @@ RETSIGTYPE handle_hupterm(int signal)
|
||||
/* Handler for SIGTSTP (suspend). */
|
||||
RETSIGTYPE do_suspend(int signal)
|
||||
{
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
nano_disabled_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
/* Turn mouse support off. */
|
||||
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"));
|
||||
@@ -1182,7 +1239,7 @@ RETSIGTYPE do_suspend(int signal)
|
||||
}
|
||||
|
||||
/* the subnfunc version */
|
||||
void do_suspend_void(void)
|
||||
void do_suspend_void(void)
|
||||
{
|
||||
if (ISSET(SUSPEND))
|
||||
do_suspend(0);
|
||||
@@ -1238,8 +1295,10 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||
* otherwise. However, COLS and LINES are curses global variables,
|
||||
* and in some cases curses has already updated them. But not in
|
||||
* all cases. Argh. */
|
||||
#ifdef REDEFINIG_MACROS_OK
|
||||
COLS = win.ws_col;
|
||||
LINES = win.ws_row;
|
||||
#endif
|
||||
|
||||
/* If we've partitioned the filestruct, unpartition it now. */
|
||||
if (filepart != NULL)
|
||||
@@ -1327,6 +1386,9 @@ void do_toggle(int flag)
|
||||
edit_refresh();
|
||||
break;
|
||||
#endif
|
||||
case SOFTWRAP:
|
||||
total_refresh();
|
||||
break;
|
||||
}
|
||||
|
||||
enabled = ISSET(flag);
|
||||
@@ -1345,6 +1407,12 @@ void do_toggle(int flag)
|
||||
statusbar("%s %s", desc, enabled ? _("enabled") :
|
||||
_("disabled"));
|
||||
}
|
||||
|
||||
/* Bleh */
|
||||
void do_toggle_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Disable extended input and output processing in our terminal
|
||||
@@ -1540,7 +1608,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
* for verbatim input, turn off prepending of wrapped
|
||||
* text. */
|
||||
if (have_shortcut && (!have_shortcut || s == NULL || s->scfunc !=
|
||||
DO_VERBATIM_INPUT))
|
||||
do_verbatim_input))
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
@@ -1575,10 +1643,10 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
default:
|
||||
/* If the function associated with this shortcut is
|
||||
* cutting or copying text, indicate this. */
|
||||
if (s->scfunc == DO_CUT_TEXT_VOID
|
||||
if (s->scfunc == do_cut_text_void
|
||||
#ifndef NANO_TINY
|
||||
|| s->scfunc == DO_COPY_TEXT || s->scfunc ==
|
||||
DO_CUT_TILL_END
|
||||
|| s->scfunc == do_copy_text || s->scfunc ==
|
||||
do_cut_till_end
|
||||
#endif
|
||||
)
|
||||
cut_copy = TRUE;
|
||||
@@ -1588,27 +1656,32 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
*ran_func = TRUE;
|
||||
if (ISSET(VIEW_MODE) && f && !f->viewok)
|
||||
print_view_warning();
|
||||
else
|
||||
else {
|
||||
#ifndef NANO_TINY
|
||||
if (s->scfunc == DO_TOGGLE)
|
||||
if (s->scfunc == do_toggle_void)
|
||||
do_toggle(s->toggle);
|
||||
else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
iso_me_harder_funcmap(s->scfunc);
|
||||
s->scfunc();
|
||||
#ifdef ENABLE_COLOR
|
||||
if (!f->viewok && openfile->syntax != NULL
|
||||
&& openfile->current->multidata && openfile->syntax->nmultis > 0) {
|
||||
reset_multis(openfile->current);
|
||||
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");
|
||||
#endif
|
||||
edit_refresh();
|
||||
edit_refresh_needed = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*finished = TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -1652,17 +1725,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
|
||||
@@ -1683,13 +1792,16 @@ 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
|
||||
rendering (with any hope at all...) */
|
||||
void precalc_multicolorinfo(void)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "entering precalc_multicolorinfo()\n");
|
||||
#endif
|
||||
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) {
|
||||
const colortype *tmpcolor = openfile->colorstrings;
|
||||
regmatch_t startmatch, endmatch;
|
||||
@@ -1708,9 +1820,19 @@ void precalc_multicolorinfo(void)
|
||||
/* If it's not a multi-line regex, amscray */
|
||||
if (tmpcolor->end == NULL)
|
||||
continue;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "working on color id %d\n", tmpcolor->id);
|
||||
#endif
|
||||
|
||||
|
||||
for (fileptr = openfile->fileage; fileptr != NULL; fileptr = fileptr->next) {
|
||||
int startx = 0;
|
||||
int nostart = 0;
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "working on lineno %lu\n", (unsigned long) fileptr->lineno);
|
||||
#endif
|
||||
|
||||
alloc_multidata_if_needed(fileptr);
|
||||
|
||||
@@ -1720,44 +1842,84 @@ void precalc_multicolorinfo(void)
|
||||
goto precalc_cleanup;
|
||||
}
|
||||
|
||||
fileptr->multidata[tmpcolor->id] = CNONE;
|
||||
while (regexec(tmpcolor->start, &fileptr->data[startx], 1, &startmatch, 0) == 0) {
|
||||
while ((nostart = regexec(tmpcolor->start, &fileptr->data[startx], 1, &startmatch, 0)) == 0) {
|
||||
/* Look for end and start marking how many lines are encompassed
|
||||
whcih should speed up rendering later */
|
||||
startx += startmatch.rm_eo;
|
||||
startx += startmatch.rm_eo;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "match found at pos %d...", startx);
|
||||
#endif
|
||||
|
||||
/* Look on this line first for end */
|
||||
if (regexec(tmpcolor->end, &fileptr->data[startx], 1, &endmatch, 0) == 0) {
|
||||
startx += endmatch.rm_eo;
|
||||
fileptr->multidata[tmpcolor->id] |= CSTARTENDHERE;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "end found on this line\n");
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Nice, we didn't find the end regex on this line. Let's start looking for it */
|
||||
for (endptr = fileptr->next; endptr != NULL; endptr = endptr->next) {
|
||||
|
||||
#ifdef DEBUG
|
||||
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) {
|
||||
last_check = cur_check;
|
||||
if (wgetch(edit) != ERR)
|
||||
goto precalc_cleanup;
|
||||
}
|
||||
if (regexec(tmpcolor->end, &endptr->data[startx], 1, &endmatch, 0) == 0)
|
||||
if (regexec(tmpcolor->end, endptr->data, 1, &endmatch, 0) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (endptr == NULL)
|
||||
if (endptr == NULL) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "no end found, breaking out\n");
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "end found\n");
|
||||
#endif
|
||||
|
||||
/* We found it, we found it, la la la la la. Mark all the
|
||||
lines in between and the ends properly */
|
||||
fileptr->multidata[tmpcolor->id] |= CENDAFTER;
|
||||
#ifdef DEBUG
|
||||
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 %lu as CWHOLELINE\n", (unsigned long) fileptr->lineno);
|
||||
#endif
|
||||
}
|
||||
alloc_multidata_if_needed(endptr);
|
||||
#ifdef DEBUG
|
||||
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.
|
||||
This may introduce more bugs but it's the Right Thing to do */
|
||||
fileptr = endptr;
|
||||
startx = endmatch.rm_eo;
|
||||
#ifdef DEBUG
|
||||
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 %lu, continuing\n", (unsigned long) fileptr->lineno);
|
||||
#endif
|
||||
fileptr->multidata[tmpcolor->id] = CNONE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1772,17 +1934,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
|
||||
@@ -1793,7 +1953,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;
|
||||
}
|
||||
@@ -1835,7 +1995,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
#ifndef NANO_TINY
|
||||
update_undo(ADD);
|
||||
|
||||
|
||||
/* Note that current_x has not yet been incremented. */
|
||||
if (openfile->mark_set && openfile->current ==
|
||||
openfile->mark_begin && openfile->current_x <
|
||||
@@ -1847,35 +2006,34 @@ 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();
|
||||
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
reset_multis(openfile->current);
|
||||
reset_multis(openfile->current, FALSE);
|
||||
#endif
|
||||
if (do_refresh) {
|
||||
if (edit_refresh_needed == TRUE) {
|
||||
edit_refresh();
|
||||
edit_refresh_needed = FALSE;
|
||||
} else
|
||||
@@ -1930,6 +2088,7 @@ int main(int argc, char **argv)
|
||||
{"operatingdir", 1, NULL, 'o'},
|
||||
#endif
|
||||
{"preserve", 0, NULL, 'p'},
|
||||
{"quiet", 0, NULL, 'q'},
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 1, NULL, 'r'},
|
||||
#endif
|
||||
@@ -1948,13 +2107,17 @@ int main(int argc, char **argv)
|
||||
{"backup", 0, NULL, 'B'},
|
||||
{"backupdir", 1, NULL, 'C'},
|
||||
{"tabstospaces", 0, NULL, 'E'},
|
||||
{"locking", 0, NULL, 'G'},
|
||||
{"historylog", 0, NULL, 'H'},
|
||||
{"noconvert", 0, NULL, 'N'},
|
||||
{"poslog", 0, NULL, 'P'},
|
||||
{"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}
|
||||
};
|
||||
@@ -1993,11 +2156,11 @@ int main(int argc, char **argv)
|
||||
while ((optchr =
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
getopt_long(argc, argv,
|
||||
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz",
|
||||
"h?ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz$",
|
||||
long_options, NULL)
|
||||
#else
|
||||
getopt(argc, argv,
|
||||
"h?ABC:DEFHIKLNOQ:RST:UVWY:abcdefgijklmo:pr:s:tvwxz")
|
||||
"h?ABC:DEFGHIKLNOPQ:RST:UVWY:abcdefgijklmo:pqr:s:tuvwxz$")
|
||||
#endif
|
||||
) != -1) {
|
||||
switch (optchr) {
|
||||
@@ -2035,6 +2198,9 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_TINY
|
||||
case 'G':
|
||||
SET(LOCKING);
|
||||
break;
|
||||
case 'H':
|
||||
SET(HISTORYLOG);
|
||||
break;
|
||||
@@ -2057,6 +2223,11 @@ int main(int argc, char **argv)
|
||||
case 'O':
|
||||
SET(MORE_SPACE);
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case 'P':
|
||||
SET(POS_HISTORY);
|
||||
break;
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
case 'Q':
|
||||
quotestr = mallocstrcpy(quotestr, optarg);
|
||||
@@ -2125,6 +2296,9 @@ int main(int argc, char **argv)
|
||||
case 'p':
|
||||
SET(PRESERVE);
|
||||
break;
|
||||
case 'q':
|
||||
SET(QUIET);
|
||||
break;
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
case 'r':
|
||||
if (!parse_num(optarg, &wrap_at)) {
|
||||
@@ -2143,12 +2317,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':
|
||||
@@ -2157,6 +2341,11 @@ int main(int argc, char **argv)
|
||||
case 'z':
|
||||
SET(SUSPEND);
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
case '$':
|
||||
SET(SOFTWRAP);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
@@ -2204,7 +2393,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;
|
||||
@@ -2256,7 +2448,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,
|
||||
@@ -2266,6 +2460,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))
|
||||
@@ -2275,10 +2476,20 @@ int main(int argc, char **argv)
|
||||
/* Set up the search/replace history. */
|
||||
history_init();
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!no_rcfiles && ISSET(HISTORYLOG))
|
||||
load_history();
|
||||
#endif
|
||||
#endif
|
||||
if (!no_rcfiles) {
|
||||
if (ISSET(HISTORYLOG) || ISSET(POS_HISTORY)) {
|
||||
if (check_dotnano() == 0) {
|
||||
UNSET(HISTORYLOG);
|
||||
UNSET(POS_HISTORY);
|
||||
}
|
||||
}
|
||||
if (ISSET(HISTORYLOG))
|
||||
load_history();
|
||||
if (ISSET(POS_HISTORY))
|
||||
load_poshistory();
|
||||
}
|
||||
#endif /* ENABLE_NANORC */
|
||||
#endif /* NANO_TINY */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Set up the backup directory (unless we're using restricted mode,
|
||||
@@ -2437,6 +2648,15 @@ int main(int argc, char **argv)
|
||||
iline = 1;
|
||||
icol = 1;
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
else {
|
||||
/* See if we have a POS history to use if we haven't overridden it */
|
||||
ssize_t savedposline, savedposcol;
|
||||
if (check_poshistory(argv[i], &savedposline, &savedposcol))
|
||||
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE,
|
||||
FALSE);
|
||||
}
|
||||
#endif /* NANO_TINY */
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2474,6 +2694,14 @@ int main(int argc, char **argv)
|
||||
if (startline > 1 || startcol > 1)
|
||||
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE,
|
||||
FALSE);
|
||||
# ifndef NANO_TINY
|
||||
else {
|
||||
/* See if we have a POS history to use if we haven't overridden it */
|
||||
ssize_t savedposline, savedposcol;
|
||||
if (check_poshistory(argv[optind], &savedposline, &savedposcol))
|
||||
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE, FALSE);
|
||||
}
|
||||
#endif /* NANO_TINY */
|
||||
|
||||
display_main_list();
|
||||
|
||||
|
||||
290
src/nano.h
290
src/nano.h
@@ -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))
|
||||
@@ -69,6 +85,8 @@
|
||||
#define KEY_DC SL_KEY_DELETE
|
||||
#define KEY_IC SL_KEY_IC
|
||||
/* Ncurses support. */
|
||||
#elif defined(HAVE_NCURSESW_NCURSES_H)
|
||||
#include <ncursesw/ncurses.h>
|
||||
#elif defined(HAVE_NCURSES_H)
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
@@ -166,11 +184,11 @@ typedef enum {
|
||||
} update_type;
|
||||
|
||||
typedef enum {
|
||||
CONTROL, META, FKEY, RAW
|
||||
CONTROL, META, FKEY, RAWINPUT
|
||||
} 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
|
||||
@@ -216,6 +234,8 @@ typedef struct syntaxtype {
|
||||
/* The list of extensions that this syntax applies to. */
|
||||
exttype *headers;
|
||||
/* Regexes to match on the 'header' (1st line) of the file */
|
||||
exttype *magics;
|
||||
/* Regexes to match libmagic results */
|
||||
colortype *color;
|
||||
/* The colors used in this syntax. */
|
||||
int nmultis;
|
||||
@@ -282,6 +302,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 */
|
||||
|
||||
@@ -302,6 +324,15 @@ typedef struct undo {
|
||||
} undo;
|
||||
|
||||
|
||||
typedef struct poshiststruct {
|
||||
char *filename;
|
||||
/* The file. */
|
||||
ssize_t lineno;
|
||||
/* Line number we left off on */
|
||||
ssize_t xno;
|
||||
/* x position in the file we left off on */
|
||||
struct poshiststruct *next;
|
||||
} poshiststruct;
|
||||
#endif /* NANO_TINY */
|
||||
|
||||
|
||||
@@ -343,6 +374,8 @@ typedef struct openfilestruct {
|
||||
undo *current_undo;
|
||||
/* The current (i.e. n ext) level of undo */
|
||||
undo_type last_action;
|
||||
const char *lock_filename;
|
||||
/* The path of the lockfile, if we created one */
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
syntaxtype *syntax;
|
||||
@@ -401,10 +434,10 @@ typedef struct sc {
|
||||
function_type type;
|
||||
/* What kind of function key is it for convenience later */
|
||||
int seq;
|
||||
/* The actual sequence to check on the the type is determined */
|
||||
/* The actual sequence to check on the type is determined */
|
||||
int menu;
|
||||
/* What list does this apply to */
|
||||
short scfunc;
|
||||
void (*scfunc)(void);
|
||||
/* The function we're going to run */
|
||||
int toggle;
|
||||
/* If a toggle, what we're toggling */
|
||||
@@ -416,7 +449,7 @@ typedef struct sc {
|
||||
} sc;
|
||||
|
||||
typedef struct subnfunc {
|
||||
short scfunc;
|
||||
void (*scfunc)(void);
|
||||
/* What function is this */
|
||||
int menus;
|
||||
/* In what menus does this function applu */
|
||||
@@ -438,39 +471,49 @@ 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)
|
||||
/* 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,
|
||||
INSECURE_BACKUP,
|
||||
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,
|
||||
POS_HISTORY,
|
||||
LOCKING
|
||||
};
|
||||
|
||||
/* Flags for which menus in which a given function should be present */
|
||||
#define MMAIN (1<<0)
|
||||
@@ -717,8 +760,9 @@ typedef struct subnfunc {
|
||||
#define TOGGLE_MAC_KEY NANO_META_M
|
||||
|
||||
/* Extra bits for the undo function */
|
||||
#define UNDO_DEL_DEL (1<<0)
|
||||
#define UNDO_DEL_BACKSPACE (1<<1)
|
||||
#define UNdel_del (1<<0)
|
||||
#define UNdel_backspace (1<<1)
|
||||
#define UNsplit_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
|
||||
@@ -727,160 +771,6 @@ typedef struct subnfunc {
|
||||
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#define CASE_SENS_MSG 1
|
||||
#define BACKWARDS_MSG 2
|
||||
#define REGEXP_MSG 3
|
||||
#define WHEREIS_NEXT_MSG 4
|
||||
#define FIRST_FILE_MSG 5
|
||||
#define LAST_FILE_MSG 6
|
||||
#define GOTO_DIR_MSG 7
|
||||
#define TOTAL_REFRESH 8
|
||||
#define DO_HELP_VOID 9
|
||||
#define DO_SEARCH 10
|
||||
#define DO_PAGE_UP 11
|
||||
#define DO_PAGE_DOWN 12
|
||||
#define DO_UP_VOID 13
|
||||
#define DO_LEFT 14
|
||||
#define DO_DOWN_VOID 15
|
||||
#define DO_RIGHT 16
|
||||
#define DO_ENTER 17
|
||||
#define DO_EXIT 18
|
||||
#define NEW_BUFFER_MSG 19
|
||||
#define EXT_CMD_MSG 20
|
||||
#define TO_FILES_MSG 21
|
||||
#define DOS_FORMAT_MSG 23
|
||||
#define MAC_FORMAT_MSG 24
|
||||
#define BACKUP_FILE_MSG 25
|
||||
#define PREPEND_MSG 26
|
||||
#define APPEND_MSG 27
|
||||
#define DO_FIRST_LINE 28
|
||||
#define DO_LAST_LINE 29
|
||||
#define DO_TOGGLE 30
|
||||
#define GOTOTEXT_MSG 31
|
||||
#define NO_REPLACE_MSG 32
|
||||
#define DO_BACKSPACE 33
|
||||
#define DO_DELETE 34
|
||||
#define DO_TAB 35
|
||||
#define DO_VERBATIM_INPUT 36
|
||||
#define SWITCH_TO_NEXT_BUFFER_VOID 37
|
||||
#define SWITCH_TO_PREV_BUFFER_VOID 38
|
||||
#define DO_END 39
|
||||
#define DO_HOME 40
|
||||
#define NEXT_HISTORY_MSG 41
|
||||
#define PREV_HISTORY_MSG 42
|
||||
#define DO_REDO 43
|
||||
#define DO_UNDO 44
|
||||
#define DO_WORDLINECHAR_COUNT 45
|
||||
#define DO_FIND_BRACKET 46
|
||||
#define DO_PREV_WORD_VOID 47
|
||||
#define DO_SUSPEND_VOID 48
|
||||
#define CANCEL_MSG 49
|
||||
#define DO_WRITEOUT_VOID 50
|
||||
#define DO_INSERTFILE_VOID 51
|
||||
#define DO_CUT_TEXT_VOID 52
|
||||
#define DO_UNCUT_TEXT 53
|
||||
#define DO_CURSORPOS_VOID 54
|
||||
#define DO_GOTOLINECOLUMN_VOID 55
|
||||
#define DO_REPLACE 56
|
||||
#define DO_JUSTIFY_VOID 57
|
||||
#define DO_PARA_BEGIN_VOID 58
|
||||
#define DO_PARA_END_VOID 59
|
||||
#define DO_FULL_JUSTIFY 60
|
||||
#define DO_MARK 61
|
||||
#define DO_RESEARCH 62
|
||||
#define DO_COPY_TEXT 63
|
||||
#define DO_INDENT_VOID 64
|
||||
#define DO_UNINDENT 65
|
||||
#define DO_SCROLL_UP 66
|
||||
#define DO_SCROLL_DOWN 67
|
||||
#define DO_NEXT_WORD_VOID 68
|
||||
#define DO_CUT_TILL_END 69
|
||||
#define NANO_GOTODIR_MSG 70
|
||||
#define NANO_LASTFILE_MSG 71
|
||||
#define NANO_FIRSTFILE_MSG 72
|
||||
#define INSERT_FILE_MSG 73
|
||||
#define NANO_MULTIBUFFER_MSG 74
|
||||
#define NANO_EXECUTE_MSG 75
|
||||
#define NANO_BACKUP_MSG 76
|
||||
#define NANO_PREPEND_MSG 77
|
||||
#define NANO_APPEND_MSG 78
|
||||
#define NANO_MAC_MSG 79
|
||||
#define NANO_DOS_MSG 80
|
||||
#define NANO_TOFILES_MSG 81
|
||||
#define NANO_NEXT_HISTORY_MSG 82
|
||||
#define NANO_PREV_HISTORY_MSG 83
|
||||
#define NANO_REGEXP_MSG 84
|
||||
#define NANO_REVERSE_MSG 85
|
||||
#define NANO_CASE_MSG 86
|
||||
#define NANO_SUSPEND_MSG 87
|
||||
#define SUSPEND_MSG 88
|
||||
#define NANO_REFRESH_MSG 89
|
||||
#define REFRESH_MSG 90
|
||||
#define NANO_WORDCOUNT_MSG 91
|
||||
#define NANO_FULLJUSTIFY_MSG 92
|
||||
#define FULLJSTIFY_MSG 93
|
||||
#define XOFF_COMPLAINT 94
|
||||
#define XON_COMPLAINT 95
|
||||
#define NANO_CUT_TILL_END_MSG 96
|
||||
#define NANO_BACKSPACE_MSG 97
|
||||
#define NANO_DELETE_MSG 98
|
||||
#define NANO_ENTER_MSG 99
|
||||
#define NANO_TAB_MSG 100
|
||||
#define NANO_VERBATIM_MSG 101
|
||||
#define NANO_NEXTFILE_MSG 102
|
||||
#define NANO_PREVFILE_MSG 103
|
||||
#define NANO_SCROLLDOWN_MSG 104
|
||||
#define NANO_SCROLLUP_MSG 105
|
||||
#define NANO_BRACKET_MSG 106
|
||||
#define NANO_PARAEND_MSG 107
|
||||
#define END_OF_PAR_MSG 108
|
||||
#define NANO_PARABEGIN_MSG 109
|
||||
#define BEG_OF_PAR_MSG 110
|
||||
#define NANO_END_MSG 111
|
||||
#define NANO_HOME_MSG 112
|
||||
#define NANO_NEXTLINE_MSG 113
|
||||
#define NANO_PREVLINE_MSG 114
|
||||
#define NANO_PREVWORD_MSG 115
|
||||
#define NANO_NEXTWORD_MSG 116
|
||||
#define NANO_BACK_MSG 117
|
||||
#define NANO_FORWARD_MSG 118
|
||||
#define NANO_REDO_MSG 119
|
||||
#define NANO_UNDO_MSG 120
|
||||
#define NANO_UNINDENT_MSG 121
|
||||
#define NANO_INDENT_MSG 122
|
||||
#define NANO_COPY_MSG 123
|
||||
#define NANO_WHEREIS_NEXT_MSG 124
|
||||
#define NANO_MARK_MSG 125
|
||||
#define NANO_REPLACE_MSG 126
|
||||
#define REPLACE_MSG 127
|
||||
#define NANO_GOTOLINE_MSG 128
|
||||
#define NANO_LASTLINE_MSG 129
|
||||
#define NANO_FIRSTLINE_MSG 130
|
||||
#define NANO_SPELL_MSG 131
|
||||
#define DO_SPELL 132
|
||||
#define NANO_CURSORPOS_MSG 133
|
||||
#define NANO_UNCUT_MSG 134
|
||||
#define GET_HELP_MSG 135
|
||||
#define NANO_HELP_MSG 136
|
||||
#define NANO_CANCEL_MSG 137
|
||||
#define NANO_EXIT_MSG 138
|
||||
#define EXIT_MSG 139
|
||||
#define NANO_EXITBROWSER_MSG 140
|
||||
#define NANO_WRITEOUT_MSG 141
|
||||
#define NANO_DISABLED_MSG 142
|
||||
#define NANO_INSERT_MSG 143
|
||||
#define WHEREIS_MSG 144
|
||||
#define NANO_WHEREIS_MSG 145
|
||||
#define NANO_PREVPAGE_MSG 146
|
||||
#define NANO_NEXTPAGE_MSG 147
|
||||
#define NANO_CUT_MSG 148
|
||||
#define DO_CUT_TEXT 149
|
||||
#define DO_NEXT_WORD 150
|
||||
#define DO_PREV_WORD 151
|
||||
|
||||
|
||||
|
||||
|
||||
#define VIEW TRUE
|
||||
#define NOVIEW FALSE
|
||||
|
||||
|
||||
68
src/prompt.c
68
src/prompt.c
@@ -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) *
|
||||
@@ -152,38 +152,38 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
|
||||
}
|
||||
|
||||
if (*have_shortcut) {
|
||||
if (s->scfunc == DO_TAB || s->scfunc == DO_ENTER)
|
||||
if (s->scfunc == do_tab || s->scfunc == do_enter_void)
|
||||
;
|
||||
else if (s->scfunc == TOTAL_REFRESH)
|
||||
else if (s->scfunc == total_refresh)
|
||||
total_statusbar_refresh(refresh_func);
|
||||
else if (s->scfunc == DO_CUT_TEXT) {
|
||||
else if (s->scfunc == do_cut_text_void) {
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Cut. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currmenu != MWRITEFILE)
|
||||
do_statusbar_cut_text();
|
||||
} else if (s->scfunc == DO_RIGHT)
|
||||
} else if (s->scfunc == do_right)
|
||||
do_statusbar_right();
|
||||
else if (s->scfunc == DO_LEFT)
|
||||
else if (s->scfunc == do_left)
|
||||
do_statusbar_left();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
else if (s->scfunc == DO_NEXT_WORD)
|
||||
else if (s->scfunc == do_next_word_void)
|
||||
do_statusbar_next_word(FALSE);
|
||||
else if (s->scfunc == DO_PREV_WORD)
|
||||
else if (s->scfunc == do_prev_word_void)
|
||||
do_statusbar_prev_word(FALSE);
|
||||
#endif
|
||||
else if (s->scfunc == DO_HOME)
|
||||
else if (s->scfunc == do_home)
|
||||
do_statusbar_home();
|
||||
else if (s->scfunc == DO_END)
|
||||
else if (s->scfunc == do_end)
|
||||
do_statusbar_end();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
else if (s->scfunc == DO_FIND_BRACKET)
|
||||
else if (s->scfunc == do_find_bracket)
|
||||
do_statusbar_find_bracket();
|
||||
#endif
|
||||
else if (s->scfunc == DO_VERBATIM_INPUT) {
|
||||
else if (s->scfunc == do_verbatim_input) {
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable verbatim input. */
|
||||
@@ -201,18 +201,18 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
|
||||
* to indicate that we're done. */
|
||||
if (got_enter) {
|
||||
get_input(NULL, 1);
|
||||
input = sc_seq_or(DO_ENTER, 0);
|
||||
input = sc_seq_or(do_enter_void, 0);
|
||||
*finished = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (s->scfunc == DO_DELETE) {
|
||||
} else if (s->scfunc == do_delete) {
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Delete. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currmenu != MWRITEFILE)
|
||||
do_statusbar_delete();
|
||||
} else if (s->scfunc == DO_BACKSPACE) {
|
||||
} else if (s->scfunc == do_backspace) {
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Backspace. */
|
||||
@@ -229,8 +229,8 @@ 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)
|
||||
iso_me_harder_funcmap(f->scfunc);
|
||||
if (f && (!ISSET(VIEW_MODE) || (f->viewok)))
|
||||
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);
|
||||
@@ -979,19 +979,19 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||
s = get_shortcut(currmenu, &kbinput, meta_key, func_key);
|
||||
|
||||
if (s)
|
||||
if (s->scfunc == CANCEL_MSG || s->scfunc == DO_ENTER)
|
||||
if (s->scfunc == do_cancel || s->scfunc == do_enter_void)
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
if (s && s->scfunc != DO_TAB)
|
||||
if (s && s->scfunc != do_tab)
|
||||
tabbed = FALSE;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifndef NANO_TINY
|
||||
if (s && s->scfunc == DO_TAB) {
|
||||
if (s && s->scfunc == do_tab) {
|
||||
if (history_list != NULL) {
|
||||
if (last_kbinput != sc_seq_or(DO_TAB, NANO_CONTROL_I))
|
||||
if (last_kbinput != sc_seq_or(do_tab, NANO_CONTROL_I))
|
||||
complete_len = strlen(answer);
|
||||
|
||||
if (complete_len > 0) {
|
||||
@@ -1007,10 +1007,10 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||
&statusbar_x, &tabbed, refresh_func, list);
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
} else
|
||||
} else
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#ifndef NANO_TINY
|
||||
if (s && s->scfunc == PREV_HISTORY_MSG) {
|
||||
if (s && s->scfunc == get_history_older_void) {
|
||||
if (history_list != NULL) {
|
||||
/* If we're scrolling up at the bottom of the
|
||||
* history list and answer isn't blank, save answer
|
||||
@@ -1038,7 +1038,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||
* statusbar prompt. */
|
||||
finished = FALSE;
|
||||
}
|
||||
} else if (s && s->scfunc == NEXT_HISTORY_MSG) {
|
||||
} else if (s && s->scfunc == get_history_newer_void) {
|
||||
if (history_list != NULL) {
|
||||
/* Get the newer search from the history list and
|
||||
* save it in answer. If there is no newer search,
|
||||
@@ -1070,8 +1070,7 @@ 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) {
|
||||
if (s && s->scfunc == do_help_void) {
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* This key has a shortcut list entry when it's used to
|
||||
@@ -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
|
||||
@@ -1116,7 +1114,7 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %d\n", answer
|
||||
* we've finished putting in an answer, reset the statusbar cursor
|
||||
* position too. */
|
||||
if (s) {
|
||||
if (s->scfunc == CANCEL_MSG || s->scfunc == DO_ENTER ||
|
||||
if (s->scfunc == do_cancel || s->scfunc == do_enter_void ||
|
||||
ran_func) {
|
||||
statusbar_x = old_statusbar_x;
|
||||
statusbar_pww = old_pww;
|
||||
@@ -1203,9 +1201,9 @@ int do_prompt(bool allow_tabs,
|
||||
|
||||
/* If we left the prompt via Cancel or Enter, set the return value
|
||||
* properly. */
|
||||
if (s && s->scfunc == CANCEL_MSG)
|
||||
if (s && s->scfunc == do_cancel)
|
||||
retval = -1;
|
||||
else if (s && s->scfunc == DO_ENTER)
|
||||
else if (s && s->scfunc == do_enter_void)
|
||||
retval = (*answer == '\0') ? -2 : 0;
|
||||
|
||||
blank_statusbar();
|
||||
@@ -1313,7 +1311,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
kbinput = get_kbinput(bottomwin, &meta_key, &func_key);
|
||||
s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key);
|
||||
|
||||
if (s && s->scfunc == CANCEL_MSG)
|
||||
if (s && s->scfunc == do_cancel)
|
||||
ok = -1;
|
||||
#ifndef DISABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
@@ -1345,7 +1343,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
}
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
else if (s && s->scfunc == TOTAL_REFRESH) {
|
||||
else if (s && s->scfunc == total_refresh) {
|
||||
total_redraw();
|
||||
continue;
|
||||
} else {
|
||||
|
||||
119
src/proto.h
119
src/proto.h
@@ -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,13 +78,15 @@ extern char *quoteerr;
|
||||
extern size_t quotelen;
|
||||
#endif
|
||||
#endif
|
||||
bool nodelay_mode;
|
||||
extern bool nodelay_mode;
|
||||
extern char *answer;
|
||||
|
||||
extern ssize_t tabsize;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern char *backup_dir;
|
||||
extern const char *locking_prefix;
|
||||
extern const char *locking_suffix;
|
||||
#endif
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
extern char *operating_dir;
|
||||
@@ -111,6 +115,8 @@ extern filestruct *searchbot;
|
||||
extern filestruct *replace_history;
|
||||
extern filestruct *replaceage;
|
||||
extern filestruct *replacebot;
|
||||
extern poshiststruct *poshistory;
|
||||
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -249,6 +255,7 @@ void do_cut_text_void(void);
|
||||
#ifndef NANO_TINY
|
||||
void do_copy_text(void);
|
||||
void do_cut_till_end(void);
|
||||
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
@@ -269,7 +276,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(
|
||||
@@ -289,6 +296,8 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void init_backup_dir(void);
|
||||
int delete_lockfile(const char *lockfilename);
|
||||
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
@@ -319,6 +328,10 @@ char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, filestruct *histhead);
|
||||
void save_history(void);
|
||||
int check_dotnano(void);
|
||||
void load_poshistory(void);
|
||||
void save_poshistory(void);
|
||||
int check_poshistory(const char *file, ssize_t *line, ssize_t *column);
|
||||
#endif
|
||||
|
||||
/* All functions in global.c. */
|
||||
@@ -426,7 +439,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);
|
||||
@@ -454,6 +471,7 @@ void allow_pending_sigwinch(bool allow);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void do_toggle(int flag);
|
||||
void do_toggle_void(void);
|
||||
#endif
|
||||
void disable_extended_io(void);
|
||||
#ifdef USE_SLANG
|
||||
@@ -540,10 +558,11 @@ char *parse_argument(char *ptr);
|
||||
char *parse_next_regex(char *ptr);
|
||||
bool nregcomp(const char *regex, int eflags);
|
||||
void parse_syntax(char *ptr);
|
||||
void parse_magic_syntax(char *ptr);
|
||||
void parse_include(char *ptr);
|
||||
short color_to_short(const char *colorname, bool *bright);
|
||||
void parse_colors(char *ptr, bool icase);
|
||||
void reset_multis(filestruct *fileptr);
|
||||
void reset_multis(filestruct *fileptr, bool force);
|
||||
void alloc_multidata_if_needed(filestruct *fileptr);
|
||||
#endif
|
||||
void parse_rcfile(FILE *rcstream
|
||||
@@ -605,6 +624,8 @@ filestruct *find_history(const filestruct *h_start, const filestruct
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
void get_history_older_void(void);
|
||||
void get_history_newer_void(void);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, const char *s, size_t len);
|
||||
#endif
|
||||
@@ -624,14 +645,15 @@ void do_unindent(void);
|
||||
void do_undo(void);
|
||||
void do_redo(void);
|
||||
#endif
|
||||
void do_enter(void);
|
||||
void do_enter(bool undoing);
|
||||
void do_enter_void(void);
|
||||
#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
|
||||
@@ -746,7 +768,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
#endif
|
||||
const sc *get_shortcut(int menu, int *kbinput, bool
|
||||
*meta_key, bool *func_key);
|
||||
const sc *first_sc_for(int menu, short func);
|
||||
const sc *first_sc_for(int menu, void (*func)(void));
|
||||
void blank_line(WINDOW *win, int y, int x, int n);
|
||||
void blank_titlebar(void);
|
||||
void blank_topbar(void);
|
||||
@@ -764,7 +786,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,57 +799,70 @@ 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);
|
||||
void xoff_complaint(void);
|
||||
int sc_seq_or (short func, int defaultval);
|
||||
int sc_seq_or (void (*func)(void), 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;
|
||||
void iso_me_harder_funcmap(short func);
|
||||
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 enable_nodelay(void);
|
||||
void disable_nodelay(void);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *regexp_msg;
|
||||
extern const char *regexp_msg;
|
||||
#endif
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
/* May as just throw these here since they are just placeholders */
|
||||
void do_cancel(void);
|
||||
void case_sens_void(void);
|
||||
void regexp_void(void);
|
||||
void gototext_void(void);
|
||||
void to_files_void(void);
|
||||
void dos_format_void(void);
|
||||
void mac_format_void(void);
|
||||
void append_void(void);
|
||||
void prepend_void(void);
|
||||
void backup_file_void(void);
|
||||
void new_buffer_void(void);
|
||||
void backwards_void(void);
|
||||
void goto_dir_void(void);
|
||||
void no_replace_void(void);
|
||||
void ext_cmd_void(void);
|
||||
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
233
src/rcfile.c
233
src/rcfile.c
@@ -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 *
|
||||
@@ -41,6 +41,9 @@ static const rcoption rcopts[] = {
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
{"locking", LOCKING},
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", USE_MOUSE},
|
||||
#endif
|
||||
@@ -77,6 +80,7 @@ static const rcoption rcopts[] = {
|
||||
#ifndef NANO_TINY
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"allow_insecure_backup", INSECURE_BACKUP},
|
||||
{"backupdir", 0},
|
||||
{"backwards", BACKWARDS_SEARCH},
|
||||
{"casesensitive", CASE_SENSITIVE},
|
||||
@@ -84,12 +88,16 @@ static const rcoption rcopts[] = {
|
||||
{"historylog", HISTORYLOG},
|
||||
{"matchbrackets", 0},
|
||||
{"noconvert", NO_CONVERT},
|
||||
{"poslog", POS_HISTORY},
|
||||
{"quiet", QUIET},
|
||||
{"quickblank", QUICK_BLANK},
|
||||
{"smarthome", SMART_HOME},
|
||||
{"smooth", SMOOTH_SCROLL},
|
||||
{"tabstospaces", TABS_TO_SPACES},
|
||||
{"undo", UNDOABLE},
|
||||
{"whitespace", 0},
|
||||
{"wordbounds", WORD_BOUNDS},
|
||||
{"softwrap", SOFTWRAP},
|
||||
#endif
|
||||
{NULL, 0}
|
||||
};
|
||||
@@ -117,6 +125,9 @@ void rcfile_error(const char *msg, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
if (ISSET(QUIET))
|
||||
return;
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
if (lineno > 0) {
|
||||
errors = TRUE;
|
||||
@@ -241,7 +252,7 @@ bool nregcomp(const char *regex, int eflags)
|
||||
void parse_syntax(char *ptr)
|
||||
{
|
||||
const char *fileregptr = NULL, *nameptr = NULL;
|
||||
syntaxtype *tmpsyntax;
|
||||
syntaxtype *tmpsyntax, *prev_syntax;
|
||||
exttype *endext = NULL;
|
||||
/* The end of the extensions list for this syntax. */
|
||||
|
||||
@@ -268,15 +279,26 @@ void parse_syntax(char *ptr)
|
||||
|
||||
/* Search for a duplicate syntax name. If we find one, free it, so
|
||||
* that we always use the last syntax with a given name. */
|
||||
prev_syntax = NULL;
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(nameptr, tmpsyntax->desc) == 0) {
|
||||
syntaxtype *prev_syntax = tmpsyntax;
|
||||
syntaxtype *old_syntax = tmpsyntax;
|
||||
|
||||
if (endsyntax == tmpsyntax)
|
||||
endsyntax = prev_syntax;
|
||||
|
||||
tmpsyntax = tmpsyntax->next;
|
||||
free(prev_syntax);
|
||||
if (prev_syntax != NULL)
|
||||
prev_syntax->next = tmpsyntax;
|
||||
else
|
||||
syntaxes = tmpsyntax;
|
||||
|
||||
free(old_syntax->desc);
|
||||
free(old_syntax);
|
||||
break;
|
||||
}
|
||||
prev_syntax = tmpsyntax;
|
||||
}
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
@@ -296,6 +318,7 @@ void parse_syntax(char *ptr)
|
||||
endheader = NULL;
|
||||
endsyntax->extensions = NULL;
|
||||
endsyntax->headers = NULL;
|
||||
endsyntax->magics = NULL;
|
||||
endsyntax->next = NULL;
|
||||
endsyntax->nmultis = 0;
|
||||
|
||||
@@ -351,6 +374,76 @@ void parse_syntax(char *ptr)
|
||||
} else
|
||||
free(newext);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* Parse the next syntax string from the line at ptr, and add it to the
|
||||
* global list of color syntaxes. */
|
||||
void parse_magictype(char *ptr)
|
||||
{
|
||||
#ifdef HAVE_LIBMAGIC
|
||||
const char *fileregptr = NULL;
|
||||
exttype *endext = NULL;
|
||||
|
||||
assert(ptr != NULL);
|
||||
|
||||
if (syntaxes == NULL) {
|
||||
rcfile_error(
|
||||
N_("Cannot add a magic string regex without a syntax command"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ptr == '\0') {
|
||||
rcfile_error(N_("Missing magic string name"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (*ptr != '"') {
|
||||
rcfile_error(
|
||||
N_("Regex strings must begin and end with a \" character"));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Starting a magic type: \"%s\"\n", ptr);
|
||||
#endif
|
||||
|
||||
/* Now load the extensions into their part of the struct. */
|
||||
while (*ptr != '\0') {
|
||||
exttype *newext;
|
||||
/* The new extension structure. */
|
||||
|
||||
while (*ptr != '"' && *ptr != '\0')
|
||||
ptr++;
|
||||
|
||||
if (*ptr == '\0')
|
||||
return;
|
||||
|
||||
ptr++;
|
||||
|
||||
fileregptr = ptr;
|
||||
ptr = parse_next_regex(ptr);
|
||||
if (ptr == NULL)
|
||||
break;
|
||||
|
||||
newext = (exttype *)nmalloc(sizeof(exttype));
|
||||
|
||||
/* Save the regex if it's valid. */
|
||||
if (nregcomp(fileregptr, REG_NOSUB)) {
|
||||
newext->ext_regex = mallocstrcpy(NULL, fileregptr);
|
||||
newext->ext = NULL;
|
||||
|
||||
if (endext == NULL)
|
||||
endsyntax->magics = newext;
|
||||
else
|
||||
endext->next = newext;
|
||||
endext = newext;
|
||||
endext->next = NULL;
|
||||
} else
|
||||
free(newext);
|
||||
}
|
||||
#endif /* HAVE_LIBMAGIC */
|
||||
}
|
||||
|
||||
int check_bad_binding(sc *s)
|
||||
@@ -388,41 +481,41 @@ void parse_keybinding(char *ptr)
|
||||
|
||||
if (keycopy[0] != 'M' && keycopy[0] != '^' && keycopy[0] != 'F' && keycopy[0] != 'K') {
|
||||
rcfile_error(
|
||||
N_("keybindings must begin with \"^\", \"M\", or \"F\"\n"));
|
||||
N_("keybindings must begin with \"^\", \"M\", or \"F\""));
|
||||
return;
|
||||
}
|
||||
|
||||
funcptr = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
|
||||
if (funcptr == NULL) {
|
||||
if (!strcmp(funcptr, "")) {
|
||||
rcfile_error(
|
||||
N_("Must specify function to bind key to\n"));
|
||||
N_("Must specify function to bind key to"));
|
||||
return;
|
||||
}
|
||||
|
||||
menuptr = ptr;
|
||||
ptr = parse_next_word(ptr);
|
||||
|
||||
if (menuptr == NULL) {
|
||||
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 bind key to (or \"all\")\n"));
|
||||
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\n"), menuptr);
|
||||
return;
|
||||
}
|
||||
|
||||
newsc = strtosc(menu, funcptr);
|
||||
if (newsc == NULL) {
|
||||
rcfile_error(
|
||||
N_("Could not map name \"%s\" to a function\n"), funcptr);
|
||||
N_("Could not map name \"%s\" to a function"), funcptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (menu < 1) {
|
||||
rcfile_error(
|
||||
N_("Could not map name \"%s\" to a menu"), menuptr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -444,11 +537,10 @@ void parse_keybinding(char *ptr)
|
||||
|
||||
if (check_bad_binding(newsc)) {
|
||||
rcfile_error(
|
||||
N_("Sorry, keystr \"%s\" is an illegal binding\n"), newsc->keystr);
|
||||
N_("Sorry, keystr \"%s\" is an illegal binding"), newsc->keystr);
|
||||
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 */
|
||||
@@ -464,13 +556,77 @@ 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)
|
||||
{
|
||||
struct stat rcinfo;
|
||||
FILE *rcstream;
|
||||
char *option, *nanorc_save = nanorc;
|
||||
char *option, *nanorc_save = nanorc, *expanded;
|
||||
size_t lineno_save = lineno;
|
||||
|
||||
option = ptr;
|
||||
@@ -491,20 +647,22 @@ void parse_include(char *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
expanded = real_dir_from_tilde(option);
|
||||
|
||||
/* Open the new syntax file. */
|
||||
if ((rcstream = fopen(option, "rb")) == NULL) {
|
||||
rcfile_error(_("Error reading %s: %s"), option,
|
||||
if ((rcstream = fopen(expanded, "rb")) == NULL) {
|
||||
rcfile_error(_("Error reading %s: %s"), expanded,
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Use the name and line number position of the new syntax file
|
||||
* while parsing it, so we can know where any errors in it are. */
|
||||
nanorc = option;
|
||||
nanorc = expanded;
|
||||
lineno = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Parsing file \"%s\"\n", option);
|
||||
fprintf(stderr, "Parsing file \"%s\" (expanded from \"%s\")\n", expanded, option);
|
||||
#endif
|
||||
|
||||
parse_rcfile(rcstream
|
||||
@@ -791,7 +949,7 @@ static void check_vitals_mapped(void)
|
||||
subnfunc *f;
|
||||
int v;
|
||||
#define VITALS 5
|
||||
short vitals[VITALS] = { DO_EXIT, DO_EXIT, CANCEL_MSG, CANCEL_MSG, CANCEL_MSG };
|
||||
void (*vitals[VITALS])(void) = { do_exit, do_exit, do_cancel, do_cancel, do_cancel };
|
||||
int inmenus[VITALS] = { MMAIN, MHELP, MWHEREIS, MREPLACE, MGOTOLINE };
|
||||
|
||||
for (v = 0; v < VITALS; v++) {
|
||||
@@ -821,7 +979,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;
|
||||
@@ -879,6 +1037,9 @@ void parse_rcfile(FILE *rcstream
|
||||
rcfile_error(N_("Syntax \"%s\" has no color commands"),
|
||||
endsyntax->desc);
|
||||
parse_syntax(ptr);
|
||||
}
|
||||
else if (strcasecmp(keyword, "magic") == 0) {
|
||||
parse_magictype(ptr);
|
||||
} else if (strcasecmp(keyword, "header") == 0)
|
||||
parse_headers(ptr);
|
||||
else if (strcasecmp(keyword, "color") == 0)
|
||||
@@ -887,6 +1048,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);
|
||||
@@ -1039,6 +1202,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;
|
||||
}
|
||||
}
|
||||
@@ -1057,15 +1223,6 @@ void parse_rcfile(FILE *rcstream
|
||||
lineno = 0;
|
||||
|
||||
check_vitals_mapped();
|
||||
|
||||
if (errors) {
|
||||
errors = FALSE;
|
||||
fprintf(stderr,
|
||||
_("\nPress Enter to continue starting nano.\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1146,6 +1303,14 @@ void do_rcfile(void)
|
||||
free(nanorc);
|
||||
nanorc = NULL;
|
||||
|
||||
if (errors && !ISSET(QUIET)) {
|
||||
errors = FALSE;
|
||||
fprintf(stderr,
|
||||
_("\nPress Enter to continue starting nano.\n"));
|
||||
while (getchar() != '\n')
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
set_colorpairs();
|
||||
#endif
|
||||
|
||||
41
src/search.c
41
src/search.c
@@ -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) *
|
||||
@@ -138,7 +138,6 @@ int search_init(bool replacing, bool use_answer)
|
||||
int i = 0;
|
||||
char *buf;
|
||||
sc *s;
|
||||
char func = 0;
|
||||
bool meta_key = FALSE, func_key = FALSE;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
@@ -220,6 +219,8 @@ int search_init(bool replacing, bool use_answer)
|
||||
statusbar(_("Cancelled"));
|
||||
return -1;
|
||||
} else {
|
||||
void (*func)(void);
|
||||
|
||||
for (s = sclist; s != NULL; s = s->next)
|
||||
if ((s->menu & currmenu) && i == s->seq) {
|
||||
func = s->scfunc;
|
||||
@@ -236,26 +237,25 @@ int search_init(bool replacing, bool use_answer)
|
||||
#endif
|
||||
;
|
||||
#ifndef NANO_TINY
|
||||
} else if (func == CASE_SENS_MSG) {
|
||||
} else if (func == case_sens_void) {
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (func == BACKWARDS_MSG) {
|
||||
} else if (func == backwards_void) {
|
||||
TOGGLE(BACKWARDS_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
} else if (func == REGEXP_MSG) {
|
||||
} else if (func == regexp_void) {
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
} else if (func == DO_REPLACE ||
|
||||
func == NO_REPLACE_MSG) {
|
||||
} else if (func == do_replace || func == no_replace_void) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
} else if (func == DO_GOTOLINECOLUMN_VOID) {
|
||||
} else if (func == do_gotolinecolumn_void) {
|
||||
do_gotolinecolumn(openfile->current->lineno,
|
||||
openfile->placewewant + 1, TRUE, TRUE, FALSE,
|
||||
TRUE);
|
||||
@@ -310,7 +310,7 @@ bool findnextstr(
|
||||
if (time(NULL) - lastkbcheck > 1) {
|
||||
lastkbcheck = time(NULL);
|
||||
f = getfuncfromkey(edit);
|
||||
if (f && f->scfunc == CANCEL_MSG) {
|
||||
if (f && f->scfunc == do_cancel) {
|
||||
statusbar(_("Cancelled"));
|
||||
return FALSE;
|
||||
}
|
||||
@@ -719,6 +719,9 @@ ssize_t do_replace_loop(
|
||||
filepart = partition_filestruct(top, top_x, bot, bot_x);
|
||||
openfile->edittop = openfile->fileage;
|
||||
openfile->mark_set = FALSE;
|
||||
#ifdef ENABLE_COLOR
|
||||
reset_multis(openfile->current, TRUE);
|
||||
#endif
|
||||
edit_refresh();
|
||||
}
|
||||
#endif
|
||||
@@ -863,6 +866,10 @@ ssize_t do_replace_loop(
|
||||
free(openfile->current->data);
|
||||
openfile->current->data = copy;
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
reset_multis(openfile->current, TRUE);
|
||||
#endif
|
||||
edit_refresh();
|
||||
if (!replaceall) {
|
||||
#ifdef ENABLE_COLOR
|
||||
/* If color syntaxes are available and turned on, we
|
||||
@@ -1037,7 +1044,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
|
||||
|
||||
s = get_shortcut(currmenu, &i, &meta_key, &func_key);
|
||||
if (s && s->scfunc == GOTOTEXT_MSG) {
|
||||
if (s && s->scfunc == gototext_void) {
|
||||
/* Keep answer up on the statusbar. */
|
||||
search_init(TRUE, TRUE);
|
||||
|
||||
@@ -1350,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;
|
||||
@@ -1424,6 +1431,16 @@ char *get_history_newer(filestruct **h)
|
||||
return (*h)->data;
|
||||
}
|
||||
|
||||
/* More placeholders */
|
||||
void get_history_newer_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
void get_history_older_void(void)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
/* Move h to the next string that's a tab completion of the string s,
|
||||
* looking at only the first len characters of s, and return that
|
||||
|
||||
281
src/text.c
281
src/text.c
@@ -1,9 +1,9 @@
|
||||
/* $Id$ */
|
||||
/* $Id$ */
|
||||
/**************************************************************************
|
||||
* 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,18 +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();
|
||||
|
||||
#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;
|
||||
#endif
|
||||
|
||||
if (do_refresh)
|
||||
edit_refresh_needed = TRUE;
|
||||
else
|
||||
if (edit_refresh_needed == FALSE)
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
@@ -188,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
|
||||
@@ -367,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;
|
||||
|
||||
}
|
||||
|
||||
@@ -390,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 */
|
||||
@@ -477,20 +481,24 @@ void do_undo(void)
|
||||
strcpy(&data[u->begin + strlen(u->strdata)], &f->data[u->begin]);
|
||||
free(f->data);
|
||||
f->data = data;
|
||||
if (u->xflags == UNDO_DEL_BACKSPACE)
|
||||
if (u->xflags == UNdel_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);
|
||||
@@ -510,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;
|
||||
@@ -534,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;
|
||||
@@ -548,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;
|
||||
|
||||
@@ -598,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 & UNsplit_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);
|
||||
@@ -659,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;
|
||||
@@ -667,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. */
|
||||
@@ -687,7 +711,7 @@ void do_enter(void)
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
strncpy(newnode->data, openfile->current->data, extra);
|
||||
openfile->totsize += mbstrlen(newnode->data);
|
||||
openfile->totsize += extra;
|
||||
}
|
||||
#endif
|
||||
null_at(&openfile->current->data, openfile->current_x);
|
||||
@@ -717,6 +741,11 @@ void do_enter(void)
|
||||
edit_refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
/* Need this again... */
|
||||
void do_enter_void(void) {
|
||||
do_enter(FALSE);
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Send a SIGKILL (unconditional kill) to the forked process in
|
||||
* execute_command(). */
|
||||
@@ -748,7 +777,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) {
|
||||
@@ -795,7 +824,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");
|
||||
@@ -818,11 +847,15 @@ 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 */
|
||||
u = fs->current_undo;
|
||||
if (current_action == CUT && u && u->type == CUT
|
||||
if (current_action == CUT && u && u->type == CUT
|
||||
&& !u->mark_set && u->lineno == fs->current->lineno)
|
||||
return;
|
||||
|
||||
@@ -838,7 +871,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;
|
||||
@@ -846,6 +879,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;
|
||||
@@ -878,8 +912,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;
|
||||
@@ -901,15 +949,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;
|
||||
}
|
||||
@@ -926,11 +976,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
|
||||
@@ -938,7 +991,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;
|
||||
@@ -950,11 +1003,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;
|
||||
@@ -968,8 +1021,8 @@ void update_undo(undo_type action)
|
||||
if (fs->current_x == u->begin) {
|
||||
/* They're deleting */
|
||||
if (!u->xflags)
|
||||
u->xflags = UNDO_DEL_DEL;
|
||||
else if (u->xflags != UNDO_DEL_DEL) {
|
||||
u->xflags = UNdel_del;
|
||||
else if (u->xflags != UNdel_del) {
|
||||
add_undo(action);
|
||||
return;
|
||||
}
|
||||
@@ -982,8 +1035,8 @@ void update_undo(undo_type action)
|
||||
} else if (fs->current_x == u->begin - 1) {
|
||||
/* They're backspacing */
|
||||
if (!u->xflags)
|
||||
u->xflags = UNDO_DEL_BACKSPACE;
|
||||
else if (u->xflags != UNDO_DEL_BACKSPACE) {
|
||||
u->xflags = UNdel_backspace;
|
||||
else if (u->xflags != UNdel_backspace) {
|
||||
add_undo(action);
|
||||
return;
|
||||
}
|
||||
@@ -1018,9 +1071,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 = UNsplit_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;
|
||||
}
|
||||
@@ -1050,7 +1111,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. */
|
||||
@@ -1115,6 +1176,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)) {
|
||||
@@ -1209,6 +1273,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);
|
||||
@@ -1913,6 +1979,8 @@ void do_justify(bool full_justify)
|
||||
if (full_justify)
|
||||
openfile->current = openfile->fileage;
|
||||
|
||||
allow_pending_sigwinch(FALSE);
|
||||
|
||||
while (TRUE) {
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
@@ -2220,7 +2288,7 @@ void do_justify(bool full_justify)
|
||||
&finished, FALSE);
|
||||
s = get_shortcut(currmenu, &kbinput, &meta_key, &func_key);
|
||||
|
||||
if (s && s->scfunc == DO_UNCUT_TEXT) {
|
||||
if (s && s->scfunc == do_uncut_text) {
|
||||
/* Splice the justify buffer back into the file, but only if we
|
||||
* actually justified something. */
|
||||
if (first_par_line != NULL) {
|
||||
@@ -2283,6 +2351,9 @@ void do_justify(bool full_justify)
|
||||
/* Display the shortcut list with UnCut. */
|
||||
shortcut_init(FALSE);
|
||||
display_main_list();
|
||||
|
||||
allow_pending_sigwinch(TRUE);
|
||||
|
||||
}
|
||||
|
||||
/* Justify the current paragraph. */
|
||||
@@ -2691,6 +2762,11 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (openfile->totsize == 0) {
|
||||
statusbar(_("Finished checking spelling"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
endwin();
|
||||
|
||||
/* Set up an argument list to pass execvp(). */
|
||||
@@ -2854,6 +2930,11 @@ void do_spell(void)
|
||||
char *temp = safe_tempfile(&temp_file);
|
||||
const char *spell_msg;
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
nano_disabled_msg();
|
||||
return;
|
||||
}
|
||||
|
||||
if (temp == NULL) {
|
||||
statusbar(_("Error writing temp file: %s"), strerror(errno));
|
||||
return;
|
||||
|
||||
11
src/utils.c
11
src/utils.c
@@ -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) *
|
||||
@@ -72,6 +72,10 @@ bool parse_num(const char *str, ssize_t *val)
|
||||
|
||||
assert(str != NULL);
|
||||
|
||||
/* Man page for strtol() says this is required, and
|
||||
it looks like it is! */
|
||||
errno = 0;
|
||||
|
||||
j = (ssize_t)strtol(str, &first_error, 10);
|
||||
|
||||
if (errno == ERANGE || *str == '\0' || *first_error != '\0')
|
||||
@@ -542,6 +546,9 @@ void new_magicline(void)
|
||||
openfile->filebot->next->prev = openfile->filebot;
|
||||
openfile->filebot->next->next = NULL;
|
||||
openfile->filebot->next->lineno = openfile->filebot->lineno + 1;
|
||||
#ifdef ENABLE_COLOR
|
||||
openfile->filebot->next->multidata = NULL;
|
||||
#endif
|
||||
openfile->filebot = openfile->filebot->next;
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
354
src/winio.c
354
src/winio.c
@@ -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) *
|
||||
@@ -497,36 +497,36 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||
if (retval != ERR) {
|
||||
switch (retval) {
|
||||
case NANO_CONTROL_8:
|
||||
retval = ISSET(REBIND_DELETE) ? sc_seq_or(DO_DELETE, 0) :
|
||||
sc_seq_or(DO_BACKSPACE, 0);
|
||||
retval = ISSET(REBIND_DELETE) ? sc_seq_or(do_delete, 0) :
|
||||
sc_seq_or(do_backspace, 0);
|
||||
break;
|
||||
case KEY_DOWN:
|
||||
#ifdef KEY_SDOWN
|
||||
/* ncurses and Slang don't support KEY_SDOWN. */
|
||||
case KEY_SDOWN:
|
||||
#endif
|
||||
retval = sc_seq_or(DO_DOWN_VOID, *kbinput);
|
||||
retval = sc_seq_or(do_down_void, *kbinput);
|
||||
break;
|
||||
case KEY_UP:
|
||||
#ifdef KEY_SUP
|
||||
/* ncurses and Slang don't support KEY_SUP. */
|
||||
case KEY_SUP:
|
||||
#endif
|
||||
retval = sc_seq_or(DO_UP_VOID, *kbinput);
|
||||
retval = sc_seq_or(do_up_void, *kbinput);
|
||||
break;
|
||||
case KEY_LEFT:
|
||||
#ifdef KEY_SLEFT
|
||||
/* Slang doesn't support KEY_SLEFT. */
|
||||
case KEY_SLEFT:
|
||||
#endif
|
||||
retval = sc_seq_or(DO_LEFT, *kbinput);
|
||||
retval = sc_seq_or(do_left, *kbinput);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
#ifdef KEY_SRIGHT
|
||||
/* Slang doesn't support KEY_SRIGHT. */
|
||||
case KEY_SRIGHT:
|
||||
#endif
|
||||
retval = sc_seq_or(DO_RIGHT, *kbinput);
|
||||
retval = sc_seq_or(do_right, *kbinput);
|
||||
break;
|
||||
#ifdef KEY_SHOME
|
||||
/* HP-UX 10-11 and Slang don't support KEY_SHOME. */
|
||||
@@ -534,36 +534,36 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||
#endif
|
||||
case KEY_A1: /* Home (7) on numeric keypad with
|
||||
* NumLock off. */
|
||||
retval = sc_seq_or(DO_HOME, *kbinput);
|
||||
retval = sc_seq_or(do_home, *kbinput);
|
||||
break;
|
||||
case KEY_BACKSPACE:
|
||||
retval = sc_seq_or(DO_BACKSPACE, *kbinput);
|
||||
retval = sc_seq_or(do_backspace, *kbinput);
|
||||
break;
|
||||
#ifdef KEY_SDC
|
||||
/* Slang doesn't support KEY_SDC. */
|
||||
case KEY_SDC:
|
||||
if (ISSET(REBIND_DELETE))
|
||||
retval = sc_seq_or(DO_DELETE, *kbinput);
|
||||
retval = sc_seq_or(do_delete, *kbinput);
|
||||
else
|
||||
retval = sc_seq_or(DO_BACKSPACE, *kbinput);
|
||||
retval = sc_seq_or(do_backspace, *kbinput);
|
||||
break;
|
||||
#endif
|
||||
#ifdef KEY_SIC
|
||||
/* Slang doesn't support KEY_SIC. */
|
||||
case KEY_SIC:
|
||||
retval = sc_seq_or(DO_INSERTFILE_VOID, *kbinput);
|
||||
retval = sc_seq_or(do_insertfile_void, *kbinput);
|
||||
break;
|
||||
#endif
|
||||
case KEY_C3: /* PageDown (4) on numeric keypad with
|
||||
* NumLock off. */
|
||||
retval = sc_seq_or(DO_PAGE_DOWN, *kbinput);
|
||||
retval = sc_seq_or(do_page_down, *kbinput);
|
||||
break;
|
||||
case KEY_A3: /* PageUp (9) on numeric keypad with
|
||||
* NumLock off. */
|
||||
retval = sc_seq_or(DO_PAGE_UP, *kbinput);
|
||||
retval = sc_seq_or(do_page_up, *kbinput);
|
||||
break;
|
||||
case KEY_ENTER:
|
||||
retval = sc_seq_or(DO_ENTER, *kbinput);
|
||||
retval = sc_seq_or(do_enter_void, *kbinput);
|
||||
break;
|
||||
case KEY_B2: /* Center (5) on numeric keypad with
|
||||
* NumLock off. */
|
||||
@@ -575,7 +575,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||
/* HP-UX 10-11 and Slang don't support KEY_SEND. */
|
||||
case KEY_SEND:
|
||||
#endif
|
||||
retval = sc_seq_or(DO_END, *kbinput);
|
||||
retval = sc_seq_or(do_end, *kbinput);
|
||||
break;
|
||||
#ifdef KEY_BEG
|
||||
/* Slang doesn't support KEY_BEG. */
|
||||
@@ -591,7 +591,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||
/* Slang doesn't support KEY_SCANCEL. */
|
||||
case KEY_SCANCEL:
|
||||
#endif
|
||||
retval = first_sc_for(currmenu, CANCEL_MSG)->seq;
|
||||
retval = first_sc_for(currmenu, do_cancel)->seq;
|
||||
break;
|
||||
#endif
|
||||
#ifdef KEY_SBEG
|
||||
@@ -604,13 +604,13 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
||||
#ifdef KEY_SSUSPEND
|
||||
/* Slang doesn't support KEY_SSUSPEND. */
|
||||
case KEY_SSUSPEND:
|
||||
retval = sc_seq_or(DO_SUSPEND_VOID, 0);
|
||||
retval = sc_seq_or(do_suspend_void, 0);
|
||||
break;
|
||||
#endif
|
||||
#ifdef KEY_SUSPEND
|
||||
/* Slang doesn't support KEY_SUSPEND. */
|
||||
case KEY_SUSPEND:
|
||||
retval = sc_seq_or(DO_SUSPEND_VOID, 0);
|
||||
retval = sc_seq_or(do_suspend_void, 0);
|
||||
break;
|
||||
#endif
|
||||
#ifdef PDCURSES
|
||||
@@ -758,15 +758,15 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
retval = KEY_B2;
|
||||
break;
|
||||
case 'F': /* Esc O F == End on xterm/Terminal. */
|
||||
retval = sc_seq_or(DO_END, 0);
|
||||
retval = sc_seq_or(do_end, 0);
|
||||
break;
|
||||
case 'H': /* Esc O H == Home on xterm/Terminal. */
|
||||
retval = sc_seq_or(DO_HOME, 0);;
|
||||
retval = sc_seq_or(do_home, 0);;
|
||||
break;
|
||||
case 'M': /* Esc O M == Enter on numeric keypad with
|
||||
* NumLock off on VT100/VT220/VT320/xterm/
|
||||
* rxvt/Eterm. */
|
||||
retval = sc_seq_or(DO_HOME, 0);;
|
||||
retval = sc_seq_or(do_home, 0);;
|
||||
break;
|
||||
case 'P': /* Esc O P == F1 on VT100/VT220/VT320/Mach
|
||||
* console. */
|
||||
@@ -831,7 +831,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case 'n': /* Esc O n == Delete (.) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* xterm/rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_DELETE, 0);;
|
||||
retval = sc_seq_or(do_delete, 0);;
|
||||
break;
|
||||
case 'o': /* Esc O o == '/' on numeric keypad with
|
||||
* NumLock off on VT100/VT220/VT320/xterm/
|
||||
@@ -841,27 +841,27 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case 'p': /* Esc O p == Insert (0) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_INSERTFILE_VOID, 0);;
|
||||
retval = sc_seq_or(do_insertfile_void, 0);;
|
||||
break;
|
||||
case 'q': /* Esc O q == End (1) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_END, 0);;
|
||||
retval = sc_seq_or(do_end, 0);;
|
||||
break;
|
||||
case 'r': /* Esc O r == Down (2) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_DOWN_VOID, 0);;
|
||||
retval = sc_seq_or(do_down_void, 0);;
|
||||
break;
|
||||
case 's': /* Esc O s == PageDown (3) on numeric
|
||||
* keypad with NumLock off on VT100/VT220/
|
||||
* VT320/rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_PAGE_DOWN, 0);;
|
||||
retval = sc_seq_or(do_page_down, 0);;
|
||||
break;
|
||||
case 't': /* Esc O t == Left (4) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_LEFT, 0);;
|
||||
retval = sc_seq_or(do_left, 0);;
|
||||
break;
|
||||
case 'u': /* Esc O u == Center (5) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
@@ -871,22 +871,22 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
case 'v': /* Esc O v == Right (6) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_RIGHT, 0);
|
||||
retval = sc_seq_or(do_right, 0);
|
||||
break;
|
||||
case 'w': /* Esc O w == Home (7) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_HOME, 0);
|
||||
retval = sc_seq_or(do_home, 0);
|
||||
break;
|
||||
case 'x': /* Esc O x == Up (8) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_UP_VOID, 0);
|
||||
retval = sc_seq_or(do_up_void, 0);
|
||||
break;
|
||||
case 'y': /* Esc O y == PageUp (9) on numeric keypad
|
||||
* with NumLock off on VT100/VT220/VT320/
|
||||
* rxvt/Eterm/Terminal. */
|
||||
retval = sc_seq_or(DO_PAGE_UP, 0);
|
||||
retval = sc_seq_or(do_page_up, 0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -980,7 +980,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
break;
|
||||
default: /* Esc [ 1 ~ == Home on
|
||||
* VT320/Linux console. */
|
||||
retval = sc_seq_or(DO_HOME, 0);;
|
||||
retval = sc_seq_or(do_home, 0);;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1031,40 +1031,40 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
default: /* Esc [ 2 ~ == Insert on
|
||||
* VT220/VT320/Linux console/
|
||||
* xterm/Terminal. */
|
||||
retval = sc_seq_or(DO_INSERTFILE_VOID, 0);;
|
||||
retval = sc_seq_or(do_insertfile_void, 0);;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '3': /* Esc [ 3 ~ == Delete on VT220/VT320/
|
||||
* Linux console/xterm/Terminal. */
|
||||
retval = sc_seq_or(DO_DELETE, 0);;
|
||||
retval = sc_seq_or(do_delete, 0);;
|
||||
break;
|
||||
case '4': /* Esc [ 4 ~ == End on VT220/VT320/Linux
|
||||
* console/xterm. */
|
||||
retval = sc_seq_or(DO_END, 0);;
|
||||
retval = sc_seq_or(do_end, 0);;
|
||||
break;
|
||||
case '5': /* Esc [ 5 ~ == PageUp on VT220/VT320/
|
||||
* Linux console/xterm/Terminal;
|
||||
* Esc [ 5 ^ == PageUp on Eterm. */
|
||||
retval = sc_seq_or(DO_PAGE_UP, 0);;
|
||||
retval = sc_seq_or(do_page_up, 0);;
|
||||
break;
|
||||
case '6': /* Esc [ 6 ~ == PageDown on VT220/VT320/
|
||||
* Linux console/xterm/Terminal;
|
||||
* Esc [ 6 ^ == PageDown on Eterm. */
|
||||
retval = sc_seq_or(DO_PAGE_DOWN, 0);;
|
||||
retval = sc_seq_or(do_page_down, 0);;
|
||||
break;
|
||||
case '7': /* Esc [ 7 ~ == Home on rxvt. */
|
||||
retval = sc_seq_or(DO_HOME, 0);
|
||||
retval = sc_seq_or(do_home, 0);
|
||||
break;
|
||||
case '8': /* Esc [ 8 ~ == End on rxvt. */
|
||||
retval = sc_seq_or(DO_END, 0);
|
||||
retval = sc_seq_or(do_end, 0);
|
||||
break;
|
||||
case '9': /* Esc [ 9 == Delete on Mach console. */
|
||||
retval = sc_seq_or(DO_DELETE, 0);;
|
||||
retval = sc_seq_or(do_delete, 0);;
|
||||
break;
|
||||
case '@': /* Esc [ @ == Insert on Mach console. */
|
||||
retval = sc_seq_or(DO_INSERTFILE_VOID, 0);;
|
||||
retval = sc_seq_or(do_insertfile_void, 0);;
|
||||
break;
|
||||
case 'A': /* Esc [ A == Up on ANSI/VT220/Linux
|
||||
* console/FreeBSD console/Mach console/
|
||||
@@ -1087,23 +1087,23 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
break;
|
||||
case 'F': /* Esc [ F == End on FreeBSD
|
||||
* console/Eterm. */
|
||||
retval = sc_seq_or(DO_END, 0);
|
||||
retval = sc_seq_or(do_end, 0);
|
||||
break;
|
||||
case 'G': /* Esc [ G == PageDown on FreeBSD
|
||||
* console. */
|
||||
retval = sc_seq_or(DO_PAGE_DOWN, 0);
|
||||
retval = sc_seq_or(do_page_down, 0);
|
||||
break;
|
||||
case 'H': /* Esc [ H == Home on ANSI/VT220/FreeBSD
|
||||
* console/Mach console/Eterm. */
|
||||
retval = sc_seq_or(DO_HOME, 0);
|
||||
retval = sc_seq_or(do_home, 0);
|
||||
break;
|
||||
case 'I': /* Esc [ I == PageUp on FreeBSD
|
||||
* console. */
|
||||
retval = sc_seq_or(DO_PAGE_UP, 0);
|
||||
retval = sc_seq_or(do_page_up, 0);
|
||||
break;
|
||||
case 'L': /* Esc [ L == Insert on ANSI/FreeBSD
|
||||
* console. */
|
||||
retval = sc_seq_or(DO_INSERTFILE_VOID, 0);
|
||||
retval = sc_seq_or(do_insertfile_void, 0);
|
||||
break;
|
||||
case 'M': /* Esc [ M == F1 on FreeBSD console. */
|
||||
retval = KEY_F(1);
|
||||
@@ -1151,10 +1151,10 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
retval = KEY_F(8);
|
||||
break;
|
||||
case 'U': /* Esc [ U == PageDown on Mach console. */
|
||||
retval = sc_seq_or(DO_PAGE_DOWN, 0);
|
||||
retval = sc_seq_or(do_page_down, 0);
|
||||
break;
|
||||
case 'V': /* Esc [ V == PageUp on Mach console. */
|
||||
retval = sc_seq_or(DO_PAGE_UP, 0);
|
||||
retval = sc_seq_or(do_page_up, 0);
|
||||
break;
|
||||
case 'W': /* Esc [ W == F11 on FreeBSD console. */
|
||||
retval = KEY_F(11);
|
||||
@@ -1163,7 +1163,7 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len)
|
||||
retval = KEY_F(12);
|
||||
break;
|
||||
case 'Y': /* Esc [ Y == End on Mach console. */
|
||||
retval = sc_seq_or(DO_END, 0);
|
||||
retval = sc_seq_or(do_end, 0);
|
||||
break;
|
||||
case 'Z': /* Esc [ Z == F14 on FreeBSD console. */
|
||||
retval = KEY_F(14);
|
||||
@@ -1220,13 +1220,13 @@ int get_escape_seq_abcd(int kbinput)
|
||||
{
|
||||
switch (tolower(kbinput)) {
|
||||
case 'a':
|
||||
return sc_seq_or(DO_UP_VOID, 0);;
|
||||
return sc_seq_or(do_up_void, 0);;
|
||||
case 'b':
|
||||
return sc_seq_or(DO_DOWN_VOID, 0);;
|
||||
return sc_seq_or(do_down_void, 0);;
|
||||
case 'c':
|
||||
return sc_seq_or(DO_RIGHT, 0);;
|
||||
return sc_seq_or(do_right, 0);;
|
||||
case 'd':
|
||||
return sc_seq_or(DO_LEFT, 0);;
|
||||
return sc_seq_or(do_left, 0);;
|
||||
default:
|
||||
return ERR;
|
||||
}
|
||||
@@ -1746,7 +1746,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||
* wheel is equivalent to moving down three lines. */
|
||||
for (i = 0; i < 3; i++)
|
||||
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ?
|
||||
sc_seq_or(do_up_void, 0) : sc_seq_or(DO_DOWN_VOID, 0);, FALSE,
|
||||
sc_seq_or(up_void, 0) : sc_seq_or(DO_DOWN_VOID, 0), FALSE,
|
||||
FALSE);
|
||||
|
||||
return 1;
|
||||
@@ -1800,7 +1800,7 @@ const sc *get_shortcut(int menu, int *kbinput, bool
|
||||
|
||||
|
||||
/* Try to get a function back from a window. Just a wrapper so
|
||||
functions to need to create function_key meta_key blah blah
|
||||
functions to need to create function_key meta_key blah blah
|
||||
mmenu - what menu name to look through for valid funcs */
|
||||
const subnfunc *getfuncfromkey(WINDOW *win)
|
||||
{
|
||||
@@ -2258,6 +2258,17 @@ void set_modified(void)
|
||||
if (!openfile->modified) {
|
||||
openfile->modified = TRUE;
|
||||
titlebar(NULL);
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING)) {
|
||||
if (openfile->lock_filename == NULL) {
|
||||
/* Translators: Try to keep this at most 80 characters. */
|
||||
statusbar(_("Warning: Modifying a file which is not locked, check directory permission?"));
|
||||
} else {
|
||||
write_lockfile(openfile->lock_filename,
|
||||
get_full_path(openfile->filename), TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2426,6 +2437,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 +2445,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 +2506,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 +2837,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 +2945,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 +2981,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 +3038,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 +3053,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,11 +3127,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) {
|
||||
filestruct *old_edittop = openfile->edittop;
|
||||
ssize_t nlines;
|
||||
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
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark is on, update all the lines between old_current
|
||||
@@ -3004,11 +3142,12 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
* whether we've scrolled up or down) of the edit window. */
|
||||
if (openfile->mark_set) {
|
||||
ssize_t old_lineno;
|
||||
filestruct *old_edittop = openfile->edittop;
|
||||
|
||||
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 +3166,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 +3221,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 +3244,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 +3283,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. */
|
||||
|
||||
Reference in New Issue
Block a user