Compare commits
195 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd8ce7af8e | ||
|
|
c5a0c9b6b2 | ||
|
|
6520aa0079 | ||
|
|
3d8b9895b8 | ||
|
|
9026e04c73 | ||
|
|
92befae93d | ||
|
|
dbbc14e0ac | ||
|
|
8b80ec3e1a | ||
|
|
a71a2f9a0c | ||
|
|
56ce5f2ba8 | ||
|
|
5ebdd3fe6e | ||
|
|
426e6d37c5 | ||
|
|
4dd9aadf8a | ||
|
|
5ecd81bd19 | ||
|
|
b4a955512e | ||
|
|
33c7a4ca95 | ||
|
|
40d34862fd | ||
|
|
bee670424e | ||
|
|
8dffb00fd9 | ||
|
|
403e87c0a0 | ||
|
|
942bb39547 | ||
|
|
52b7a41ea4 | ||
|
|
6807e06a74 | ||
|
|
84cd0abd6f | ||
|
|
6a70d2b6e2 | ||
|
|
16482f99b8 | ||
|
|
621eb904b3 | ||
|
|
84ff9ebb91 | ||
|
|
a2038a9b2b | ||
|
|
a969adf804 | ||
|
|
59b0f81bfa | ||
|
|
6ad3d3d6c0 | ||
|
|
ca70885564 | ||
|
|
cfa20c3f42 | ||
|
|
4781d4d351 | ||
|
|
ef1a3b08ae | ||
|
|
4063fce6a0 | ||
|
|
3db2beefd3 | ||
|
|
5907f8801b | ||
|
|
c68398f18f | ||
|
|
d653aeab93 | ||
|
|
491e02f532 | ||
|
|
f1a47a2aae | ||
|
|
7b23878b42 | ||
|
|
5cdadc3eb1 | ||
|
|
8f89e23adb | ||
|
|
8302ff700b | ||
|
|
a32d21c759 | ||
|
|
f8214440c2 | ||
|
|
c1b08302df | ||
|
|
afd8a4e804 | ||
|
|
88b740179a | ||
|
|
9ce41543ed | ||
|
|
e4775c2060 | ||
|
|
cd7c3483b4 | ||
|
|
8075e454a9 | ||
|
|
93b1c1bea6 | ||
|
|
aa14526cb3 | ||
|
|
d29d49aece | ||
|
|
e8f90789e9 | ||
|
|
c830b8f51c | ||
|
|
28beb3f9c5 | ||
|
|
08fd5b349b | ||
|
|
6971db773b | ||
|
|
c620fc6aa9 | ||
|
|
7e09f2c64a | ||
|
|
968c07fc81 | ||
|
|
858e75e4cf | ||
|
|
a05180ed2d | ||
|
|
00533854c0 | ||
|
|
dc3610fc8e | ||
|
|
a33a4f00e5 | ||
|
|
509b091c47 | ||
|
|
9ea5eef200 | ||
|
|
e701bb01aa | ||
|
|
a3102cd4cf | ||
|
|
da67883508 | ||
|
|
03c3e2b7c0 | ||
|
|
4953dcec20 | ||
|
|
f5155786e1 | ||
|
|
a9abc3d95f | ||
|
|
09cabcad5d | ||
|
|
f162a6a2ab | ||
|
|
5a3de7f117 | ||
|
|
7b5cc1dcda | ||
|
|
2b38547875 | ||
|
|
492166a3f7 | ||
|
|
e1e15fd0f4 | ||
|
|
9c2bc68847 | ||
|
|
3d1ef8e07f | ||
|
|
5033cfd81a | ||
|
|
9c3a149b14 | ||
|
|
a9c4682c25 | ||
|
|
6566177743 | ||
|
|
443e1484e5 | ||
|
|
ac9550d4c2 | ||
|
|
1423e57199 | ||
|
|
c095ece497 | ||
|
|
9366131c51 | ||
|
|
009cd30695 | ||
|
|
c42d6d378a | ||
|
|
1a79b3d514 | ||
|
|
7d3d3dec9a | ||
|
|
6240805c41 | ||
|
|
17cf7d1c62 | ||
|
|
3275c4e514 | ||
|
|
395c8e9e25 | ||
|
|
a8a60b29e6 | ||
|
|
c1ebfa04ae | ||
|
|
6967fae35d | ||
|
|
a37435141a | ||
|
|
329021e24a | ||
|
|
b06407fbd7 | ||
|
|
8edaa38a1e | ||
|
|
1f55c8819b | ||
|
|
03ecbf3d55 | ||
|
|
81aebeb2a9 | ||
|
|
7b442ea4cb | ||
|
|
a846a2c19f | ||
|
|
a832fffb1f | ||
|
|
99fa20645c | ||
|
|
26fe2118c4 | ||
|
|
46430999d5 | ||
|
|
9cff7a1689 | ||
|
|
ae15fc9bb2 | ||
|
|
b3b3dd5792 | ||
|
|
7e1648fdb0 | ||
|
|
e05dfda2be | ||
|
|
fe012dad91 | ||
|
|
3787494c15 | ||
|
|
8de4b7aaeb | ||
|
|
9de0f158e2 | ||
|
|
3d62d32cbe | ||
|
|
f9fea02fc5 | ||
|
|
90bd25c1bb | ||
|
|
ca6d7b6a46 | ||
|
|
d6313c2f8c | ||
|
|
861d81edba | ||
|
|
ac1444578c | ||
|
|
9a4c384afa | ||
|
|
040bd93cc4 | ||
|
|
e935fd4f88 | ||
|
|
a43eee6aec | ||
|
|
1fbe7596f8 | ||
|
|
3c875f9b59 | ||
|
|
700c5c9399 | ||
|
|
74f128859b | ||
|
|
953fbf8efe | ||
|
|
3dc6ccbe86 | ||
|
|
b98545f455 | ||
|
|
5a741a0205 | ||
|
|
6723ac6fcc | ||
|
|
bbc718633e | ||
|
|
b7166d5c06 | ||
|
|
1e8f6fd7a9 | ||
|
|
0b93fff802 | ||
|
|
1c74517629 | ||
|
|
9f696ef9af | ||
|
|
5aa12a2b3d | ||
|
|
2439e1e451 | ||
|
|
dab70d06ed | ||
|
|
8993c36366 | ||
|
|
5c51d4ea46 | ||
|
|
02376103eb | ||
|
|
999d99c6e4 | ||
|
|
6e73805a0d | ||
|
|
754c62c5cc | ||
|
|
9f2c80db24 | ||
|
|
4c987bc3e0 | ||
|
|
e75c933cb0 | ||
|
|
28767d8fec | ||
|
|
bf00e3f606 | ||
|
|
23ae7bfbbf | ||
|
|
cb0806b2a0 | ||
|
|
005ee8eda6 | ||
|
|
f3e2ad945d | ||
|
|
6ec65d5500 | ||
|
|
de0adb8e3e | ||
|
|
cc91ee603c | ||
|
|
c84324bc7a | ||
|
|
8fc72eb32b | ||
|
|
6b5aff4878 | ||
|
|
fb534bada6 | ||
|
|
b5bc1b5094 | ||
|
|
aedc3ddd49 | ||
|
|
754aa8ba79 | ||
|
|
53cea142e0 | ||
|
|
7e18100197 | ||
|
|
0abf225129 | ||
|
|
70bcf752dc | ||
|
|
8f2b5bbf3d | ||
|
|
f9a8d6ff4e | ||
|
|
c3830517cc | ||
|
|
6d70ab11d6 | ||
|
|
5f359179b2 |
10
AUTHORS
10
AUTHORS
@@ -8,8 +8,8 @@ Chris Allegretta <chrisa@asty.org>
|
||||
David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* Former stable series maintainer. Multiple buffer support,
|
||||
operating dir (-o) option, bug fixes for display routines,
|
||||
wrapping code, spelling fixes, const mode, parts of the
|
||||
UTF-8 support, and various other fixes.
|
||||
wrapping code, spelling fixes, constantshow mode, parts of
|
||||
UTF-8 support, softwrap overhaul, and various other fixes.
|
||||
|
||||
Jordi Mallach <jordi@gnu.org>
|
||||
* Debian package maintainer, fellow bug squasher.
|
||||
@@ -39,7 +39,8 @@ Mike Frysinger <vapier@gentoo.org>
|
||||
* Gentoo package maintainer. Whitespace display mode,
|
||||
--enable-utf8/--disable-utf8 configure options for ncurses,
|
||||
many new color regexes and improvements to existing color
|
||||
regexes in syntax/*.nanorc, and miscellaneous bug fixes.
|
||||
regexes in syntax/*.nanorc, the move from svn to git, the
|
||||
conversion to gnulib, and miscellaneous bug fixes.
|
||||
|
||||
Mark Majeres <mark@engine12.com>
|
||||
* A functional undo/redo system, and coloring nano's interface.
|
||||
@@ -56,6 +57,9 @@ Faissal Bensefia <faissaloo@gmail.com>
|
||||
Sumedh Pendurkar <sumedh.pendurkar@gmail.com>
|
||||
* The word-completion feature.
|
||||
|
||||
Rishabh Dave <rishabhddave@gmail.com>
|
||||
* Searchable help.
|
||||
|
||||
Benno Schulenberg <bensberg@justemail.net>
|
||||
* An array of small bug fixes, the cut-word and block-jump
|
||||
routines, text selection by holding Shift, and some extra
|
||||
|
||||
231
ChangeLog
231
ChangeLog
@@ -1,3 +1,234 @@
|
||||
Changes between v2.8.4 and v2.8.5:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (35):
|
||||
bindings: in the tiny version exclude word jumping from the prompts
|
||||
bump version numbers and add a news item for the 2.8.5 release
|
||||
display: don't let a SIGCONT write anything to the screen
|
||||
display: don't show the cursor while we are busy calculating its position
|
||||
display: redraw title bar and edit window only when needed
|
||||
display: show the cursor position also when searching took a while
|
||||
docs: avoid a double "see" for cross references in the HTML manual
|
||||
docs: spell "title bar" and "status bar" correctly
|
||||
gnulib: update to its current state
|
||||
input: give an appropriate message when there are too many errors
|
||||
startup: allow negative line and column numbers on the command line
|
||||
startup: allow positioning the cursor also when reading standard input
|
||||
startup: always open with the file that was mentioned first
|
||||
startup: don't crash when opening standard input would fail
|
||||
startup: don't mark the buffer as modified when in view mode
|
||||
startup: don't mark the buffer as modified when nothing was read
|
||||
startup: don't try placing the cursor when reading standard input failed
|
||||
startup: don't use position history when reading from standard input
|
||||
suspension: fake a SIGWINCH when coming back out of the background
|
||||
suspension: remove a duplicate setting of the HUP and TERM handler
|
||||
syntax: default: allow leading whitespace before a hash comment
|
||||
tweaks: adjust indentation after preceding changes
|
||||
tweaks: avoid compiler warning about implicit type
|
||||
tweaks: be consistent in the spelling of title bar and status bar
|
||||
tweaks: don't bother calculating the position when we won't show it
|
||||
tweaks: elide a function that should not be a separate one
|
||||
tweaks: elide a variable
|
||||
tweaks: frob a few comments, and elide and #ifndef
|
||||
tweaks: reduce the scope of three variables, and rename them besides
|
||||
tweaks: reduce the scope of two variables, and rename them too
|
||||
tweaks: rename a function and a variable, to better match what they do
|
||||
tweaks: rename a variable, and frob a couple of comments
|
||||
tweaks: rename two functions and a variable, and invert its logic
|
||||
tweaks: reshuffle some stuff, to put related things closer together
|
||||
tweaks: unglobalize the nodelay_mode variable
|
||||
|
||||
|
||||
Changes between v2.8.3 and v2.8.4:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (11):
|
||||
build: correct the inverted logic for the nanorc man page
|
||||
bump version numbers and add a news item for the 2.8.4 release
|
||||
gnulib: update to its current state
|
||||
syntax: default: color also hash comments and email addresses
|
||||
syntax: php: color "static" again as "function", like it used to be
|
||||
tweaks: adjust the indentation after the preceding change
|
||||
tweaks: avoid an unused-variable warning when using --disable-comment
|
||||
tweaks: do actual screen refreshes in a single call, when possible
|
||||
tweaks: remove the no-op x$disable tests
|
||||
tweaks: reorder three items in the Info document
|
||||
tweaks: reshuffle a few things to reduce duplication
|
||||
|
||||
|
||||
Changes between v2.8.2 and v2.8.3:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (34):
|
||||
bindings: allow toggling a new buffer when multiple buffers are enabled
|
||||
build: don't use a dummy dependency, as it breaks non-GNU makes
|
||||
build: for Solaris, tell the linker where to find clock_gettime()
|
||||
build: use backticks to avoid a warning during autoreconf
|
||||
build: use the "force" mechanism to always run the revision rule
|
||||
bump version numbers and add a news item for the 2.8.3 release
|
||||
chars: optimize moving a character left in the non-UTF-8 case
|
||||
chars: probe for a valid UTF-8 starter byte, instead of overstepping
|
||||
chars: valid UTF-8 codes are at most 4 bytes long, so look only that far
|
||||
display: keep the cursor put, also when toggling nohelp or morespace
|
||||
files: don't ask "save anyway" when user orders to discard the buffer
|
||||
history: don't save the cursor position for temporary help files
|
||||
moving: limit the target column when it is beyond the last chunk
|
||||
replacing: don't let placewewant influence the placement of the cursor
|
||||
startup: don't call delwin() with NULL, to avoid crashing on Solaris
|
||||
syntax: makefile: color comments only at start of line or after whitespace
|
||||
syntax: nanohelp: color also ^6 as a shortcut keystroke
|
||||
syntax: php: color also variable names, and color more reserved words
|
||||
syntax: php: recognize also the .phtml and .php7 extensions
|
||||
syntax: xml: recognize an XML file also by its first line
|
||||
tweaks: add another warning for an impossible condition
|
||||
tweaks: adjust whitespace and comments after the preceding change
|
||||
tweaks: avoid an empty function call in tiny version with line numbers
|
||||
tweaks: exclude from the tiny version five error-betraying messages
|
||||
tweaks: exclude from the tiny version two messages that will never occur
|
||||
tweaks: fix compilation with --enable-tiny ...-help and ...-multibuffer
|
||||
tweaks: remove an old fault-catching message
|
||||
tweaks: remove five dummy function definitions from the tiny version
|
||||
tweaks: rename three empty functions, and reshuffle some others
|
||||
tweaks: rewrap a couple of old items in NEWS, and fix an article
|
||||
tweaks: swap a comparison, to be clearer
|
||||
tweaks: transform the token DISABLE_BROWSER to ENABLE_BROWSER
|
||||
tweaks: transform the token DISABLE_NANORC to ENABLE_NANORC
|
||||
tweaks: transform the token DISABLE_TABCOMP to ENABLE_TABCOMP
|
||||
|
||||
David Lawrence Ramsey (2):
|
||||
display: ensure smooth scrolling when the edit window is resized
|
||||
tweaks: fix several whitespace irregularities
|
||||
|
||||
|
||||
Changes between v2.8.1 and v2.8.2:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (64):
|
||||
bindings: allow using <Backspace> to scroll back up in the help viewer
|
||||
bindings: allow using '/' to start a search in the help viewer
|
||||
bindings: show Home and End in browser help text, instead of M-| and M-?
|
||||
browser: make ^End work properly by fixing a paste error
|
||||
build: make --enable-help properly depend on --enable-multibuffer
|
||||
bump version numbers and add a news item for the 2.8.2 release
|
||||
display: initialize the colors only when starting to draw the content
|
||||
display: push the titlebar to the screen as soon as it has been drawn
|
||||
docs: add an item to the FAQ, about pasting from Windows to a remote nano
|
||||
docs: harmonize the nanorc man page and Info document a bit
|
||||
docs: in the FAQ, extend the answer to the pasting problem
|
||||
docs: reword the main paragraph of the man page
|
||||
docs: update the list of who authored what
|
||||
gnulib: update to its current state in git
|
||||
help: after a search, show the cursor only when something was found
|
||||
help: allocate enough space for the descriptions, so we don't crash
|
||||
help: don't crash when nano was started with --noread
|
||||
help: don't cycle forward in the buffers when exiting from help
|
||||
help: keep the same position also after M-\ or M-/ has been used
|
||||
help: keep the text at the same position when the screen is resized
|
||||
help: remove the final blank line, so <End> does the same as all <Down>
|
||||
help: set tabsize to the default width while showing a help text
|
||||
help: suppress nano's name and number to make it clearer this is help
|
||||
help: use a dedicated syntax to color shortcuts in a help text
|
||||
help: when searching, do it forward, without case, and without regexes
|
||||
input: avoid crashing when resizing the window during verbatim input
|
||||
options: allow -U (--quickblank) to be used in the tiny version
|
||||
scrolling: don't bother to limit the number of lines to step back
|
||||
startup: warn about a strange character size only in the UTF-8 case
|
||||
syntax: nanohelp: change the hue of the keystrokes to match sample.nanorc
|
||||
tweaks: add a warning for a condition that should never occur
|
||||
tweaks: add three warnings for conditions that should never occur
|
||||
tweaks: avoid an unused-variable warning
|
||||
tweaks: be more precise about what --disable-extra does
|
||||
tweaks: check for an empty needle in a central place
|
||||
tweaks: complete the exclusion of backups and such from the tiny version
|
||||
tweaks: condense two bits of code, and drop two asserts
|
||||
tweaks: distinguish (in the comments) between buffers and linestructs
|
||||
tweaks: drop a bunch of asserts
|
||||
tweaks: elide a function that is used just once
|
||||
tweaks: fix compilation with --enable-tiny --enable-color --enable-speller
|
||||
tweaks: fix two typos
|
||||
tweaks: remove a superfluous check
|
||||
tweaks: remove a superfluous strlen() call from the reverse searches
|
||||
tweaks: remove some superfluous placements of the cursor
|
||||
tweaks: remove two superfluous calls of wnoutrefresh()
|
||||
tweaks: rename a constant, to match the corresponding option
|
||||
tweaks: rename a function, to be more accurate
|
||||
tweaks: rename a function, to better suit what it does
|
||||
tweaks: rename another function, to better describe what it does
|
||||
tweaks: rename a parameter, to be more imperative
|
||||
tweaks: rename a variable, use a faster comparison, and reshuffle a bit
|
||||
tweaks: rename one variable again
|
||||
tweaks: rename some more of these 'rev_start' variables
|
||||
tweaks: rename three variables, elide another, and reshuffle some stuff
|
||||
tweaks: rename two variables, because this 'rev_start' is irksome
|
||||
tweaks: reshuffle a couple of lines to avoid a duplicate call
|
||||
tweaks: reshuffle help-text initialization, to elide a save-and-restore
|
||||
tweaks: reshuffle some more stuff, and rename two more variables
|
||||
tweaks: swap the names of two variables, to make more sense
|
||||
tweaks: transform the token DISABLE_MOUSE to ENABLE_MOUSE
|
||||
tweaks: transform the token DISABLE_MULTIBUFFER to ENABLE_MULTIBUFFER
|
||||
tweaks: use the logic from revstrstr() also in mbrevstrcasestr()
|
||||
tweaks: use the logic from revstrstr() also in revstrcasestr()
|
||||
|
||||
David Lawrence Ramsey (1):
|
||||
docs: mention that also numbercolor overrides boldtext
|
||||
|
||||
Rishabh Dave (1):
|
||||
new feature: add a search facility to the help viewer
|
||||
|
||||
|
||||
Changes between v2.8.0 and v2.8.1:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (33):
|
||||
bindings: make ^Home and ^End go to top and tail of buffer
|
||||
bindings: make ^Up/^Down go to first/last row in the file browser
|
||||
bindings: use arrows instead of words to designate the cursor keys
|
||||
bump version numbers and add a news item for the 2.8.1 release
|
||||
copyright: update the year in --version, and use the standard hyphen
|
||||
copyright: update the years, use ranges, and explain this usage
|
||||
display: check the correct character for being double-width
|
||||
display: with softwrap, show the cursor where the eye expects it
|
||||
docs: correct an answer to a question in the FAQ
|
||||
docs: mention another difference with Pico in the Info document
|
||||
docs: remove the self-referencing stuff and the changelog from the FAQ
|
||||
docs: trim the TODO file a bit, and put the more important items first
|
||||
editing: avoid creating blank lines when using autoindent
|
||||
files: check also for write errors when prepending, not just read errors
|
||||
gnulib: update to current state
|
||||
linting: treat a tab as one "column", not eight
|
||||
linting: when no is said to a file, remove all corresponding entries
|
||||
moving: when determining where we are on the screen, use placewewant
|
||||
tweaks: adjust a couple of comments
|
||||
tweaks: again use memory on the stack instead of malloc() and free()
|
||||
tweaks: close the backup file also when we skip making a backup
|
||||
tweaks: delete a function that hasn't been used since 2005
|
||||
tweaks: delete unnecessary function prototypes
|
||||
tweaks: elide a variable and a pair of braces
|
||||
tweaks: fix some inconsistencies in an old Changelog
|
||||
tweaks: fix two typos in the NEWS file
|
||||
tweaks: group ^D and ^H together in the help lines
|
||||
tweaks: keep the help text aligned, also with the narrow arrows
|
||||
tweaks: put M-A before ^6, to look better above M-6 in the help lines
|
||||
tweaks: put unshifted shortcuts ^6 and M-6 first, instead of ^^ and M-^
|
||||
tweaks: reduce the number of additions that actual_x() performs
|
||||
tweaks: replace a function call or a macro with a hard number
|
||||
tweaks: use memory on the stack instead of calling malloc() and free()
|
||||
|
||||
David Lawrence Ramsey (5):
|
||||
bindings: use arrows instead of words for search history too
|
||||
display: show '<' and '>' placeholders for characters that get split
|
||||
input: support escape sequences for ^Home and ^End
|
||||
scrolling: properly compensate for the onscreen chunks
|
||||
tweaks: avoid a compilation warning
|
||||
|
||||
Kamil Dudka (1):
|
||||
backup: prevent a symlink attack by operating on the file descriptor
|
||||
|
||||
Mike Frysinger (2):
|
||||
configure: fix up word boundary regex logic now that we have gnulib
|
||||
configure: ignore the REG_ENHANCED test when we use gnulib
|
||||
|
||||
|
||||
Changes between v2.7.5 and v2.8.0:
|
||||
----------------------------------
|
||||
|
||||
|
||||
@@ -5975,7 +5975,7 @@ GNU nano 1.1.8 - 2002.03.30
|
||||
do_insertfile()
|
||||
- Handle cancel from ExtCmd properly. (David Benbennick)
|
||||
read_file()
|
||||
- Abort if we read a file of 0 lines (num_lines == 0), fixes BUG #70.
|
||||
- Abort if we read a file of 0 lines (num_lines == 0). Fixes bug #70.
|
||||
- Reverse tests to stop segfault on editing a new file of 0 lines.
|
||||
(David Benbennick)
|
||||
- Change input var to one char instead of array. (David Benbennick)
|
||||
@@ -6108,8 +6108,8 @@ GNU nano 1.1.7 - 2002.03.05
|
||||
- Added Noconvert option to man page. (DLR)
|
||||
- nano.c:
|
||||
justify_format(), do_justify()
|
||||
- Various fixes for starting blank spaces, spaces after
|
||||
punctuation, & segfault with quoting strings. (David Benbennick)
|
||||
- Various fixes for starting blank spaces, spaces after
|
||||
punctuation, & segfault with quoting strings. (David Benbennick)
|
||||
do_justify()
|
||||
- Don't continue to justify string if it's indented more
|
||||
(quoting wise) than the beginning of the justification.
|
||||
@@ -6139,8 +6139,8 @@ GNU nano 1.1.7 - 2002.03.05
|
||||
- NANO_SMALL test was backwards. (Ken Tyler)
|
||||
- winio.c:
|
||||
strlenpt()
|
||||
- Changed main function to strnlenpt() for new justify changes,
|
||||
original function now just a stub.
|
||||
- Changed main function to strnlenpt() for new justify changes,
|
||||
original function now just a stub.
|
||||
- nanorc.sample
|
||||
- Mention unset in the sample nanorc.
|
||||
- po/ca.po, po/es.po:
|
||||
@@ -6208,7 +6208,7 @@ nano-1.1.6 - 2002.01.25
|
||||
- Temporarily unset REVERSE_SEARCH if it's set. (Rocco Corsi)
|
||||
do_suspend()
|
||||
- Call tcsetattr() to restore the old terminal settings, so
|
||||
tcsh can use ^C after suspend for example (fixes BUG #68).
|
||||
tcsh can use ^C after suspend for example. Fixes bug #68.
|
||||
do_wrap()
|
||||
- Move "right" increment to part where new line is created,
|
||||
should change (fix?) some wrapping problems with autoindent.
|
||||
@@ -6368,10 +6368,10 @@ nano-1.1.4 - 2001.12.11
|
||||
- nano.c:
|
||||
main()
|
||||
- Add Esc-[-[IGL] keys for FreeBSD Console (PgUp,PgDn,Insert).
|
||||
- Added better Hurd support for function keys (Alt-V,U,9,@,F).
|
||||
- Added better Hurd support for function keys (Alt-V,U,9,@,F).
|
||||
signal_init()
|
||||
- do SIG_IGN for the SIGTSTP sigaction regardless of whether
|
||||
we have _POSIX_VDISABLE or not (more Hurd fixes)
|
||||
- do SIG_IGN for the SIGTSTP sigaction regardless of whether
|
||||
we have _POSIX_VDISABLE or not (more Hurd fixes)
|
||||
help_init()
|
||||
- Typo fixes and additions to the new help texts.
|
||||
do_curpos()
|
||||
@@ -6487,10 +6487,10 @@ nano-1.1.2 - 2001.10.03
|
||||
- Take control-space out of -tiny build, unneeded.
|
||||
- cut.c:
|
||||
cut_marked_segment()
|
||||
- Add magic line when cutting a selection including filebot
|
||||
(discovered by DLR, fixed by DLR & Chris, fixes BUG #66).
|
||||
- Add magic line when cutting a selection including filebot.
|
||||
Fixes bug #66. (discovered by DLR, fixed by DLR & Chris)
|
||||
do_cut_text()
|
||||
- Don't recenter the line when cutting one line (DLR) (Bug #65).
|
||||
- Don't recenter the line when cutting one line. Fixes bug #65. (DLR)
|
||||
- faq.html:
|
||||
- Notes about the Free Translation Project.
|
||||
- Debian additions.
|
||||
@@ -6681,14 +6681,14 @@ nano-1.1.0 - 2001.07.15
|
||||
add_to_cutbuffer()
|
||||
- Remove useless statements. (Rocco)
|
||||
cut_marked_segment()
|
||||
- Add bizarre copy of bot node, else *BSD goes ballistic (fixes
|
||||
BUG #60).
|
||||
- Add bizarre copy of bot node, else *BSD goes ballistic. Fixes
|
||||
bug #60.
|
||||
- Added 'destructive' argument. Allows the selected text to be
|
||||
added to the cutbuffer without changing the contents of the
|
||||
file. This allows writing selection to separate files.
|
||||
do_cut_text()
|
||||
- If the line is empty when using -k and wasn't already added,
|
||||
create a dummy line and add it to the cutbuffer (fixes bug #61)
|
||||
create a dummy line and add it to the cutbuffer. Fixes bug #61.
|
||||
- Reset marked_cut if we blow away the cutbuffer.
|
||||
- Moved the case of current == mark_beginbuf into cut_marked
|
||||
segment, so do_writeout could call it when writing selection to
|
||||
@@ -6719,7 +6719,7 @@ nano-1.1.0 - 2001.07.15
|
||||
- move.c:
|
||||
page_up()
|
||||
- Rewritten with a loop to make screen updates work when
|
||||
mark is set (fixes bug #59).
|
||||
mark is set. Fixes bug #59.
|
||||
do_home(), do_end()
|
||||
- Don't keep cutbuffer.
|
||||
- nano.1:
|
||||
@@ -6756,7 +6756,7 @@ nano-1.1.0 - 2001.07.15
|
||||
- Optimizations, remove "$" goes-to-last-line, less messages. (Rocco)
|
||||
do_replace()
|
||||
- If we manage to make it in somehow with VIEW_MODE on, abort
|
||||
nicely (fixes BUG #59).
|
||||
nicely. Fixes bug #59.
|
||||
- utils.c
|
||||
strcasestr()
|
||||
- Replaced by mutt's mutt_stristr function, because the thought
|
||||
@@ -6844,13 +6844,13 @@ nano-1.0.0 - 2001.03.22
|
||||
- move.c:
|
||||
page_down()
|
||||
- Check for totlines < editwinrows in check for superfluous
|
||||
edit update (fixed BUG #57).
|
||||
edit update. Fixes bug #57.
|
||||
- search.c:
|
||||
print_replaced()
|
||||
- s/occurence/occurrence typos. (Jordi)
|
||||
search_init()
|
||||
- If using Pico mode and regex and same answer is entered, use
|
||||
last_search string instead of answer (fixes BUG #56).
|
||||
last_search string instead of answer. Fixes bug #56.
|
||||
- nano.texi:
|
||||
- Meta-Z correction and grammar in --enable-tiny desc. (Neil Parks)
|
||||
|
||||
@@ -6868,7 +6868,7 @@ nano-0.9.99pre3 - 2001.02.19
|
||||
- ALL_LINGUAS: added hu and ca.
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- marked text cut fixes (Rocco) (Fixes bug #54).
|
||||
- Marked text cut fixes. Fixes bug #54. (Rocco)
|
||||
- nano.c:
|
||||
do_delete()
|
||||
- Added check for current->next == fileptr, as we have a magic
|
||||
@@ -7016,7 +7016,7 @@ General -
|
||||
for now.
|
||||
- Moved keypad() calls for PDCurses from main() to window_init()
|
||||
so the keypad continues to work after a Meta-X, for example.
|
||||
Fixed bug #51.
|
||||
Fixes bug #51.
|
||||
- faq.html:
|
||||
- Fix typos and small mistakes. (Jordi)
|
||||
- files.c:
|
||||
@@ -7038,7 +7038,7 @@ General -
|
||||
- move.c:
|
||||
page_down()
|
||||
- Don't do an edit_update when there is only one page of text
|
||||
(fileage == edittop && filebot == editbot). Fixes Bug #50.
|
||||
(fileage == edittop && filebot == editbot). Fixes bug #50.
|
||||
- nano.c:
|
||||
main()
|
||||
- Reorder the getopt options to be more or less alphabetical
|
||||
@@ -7080,7 +7080,7 @@ General
|
||||
uncutting marked text at filebot. (Ryan Krebs)
|
||||
- files.c:
|
||||
read_file()
|
||||
- If we encounter an error and insert is not set, run new_file().
|
||||
- If we encounter an error and insert is not set, run new_file()
|
||||
(bug discovered by Ben Roberts).
|
||||
write_file()
|
||||
- Change open call flags, basically copy joe's way of doing it so
|
||||
@@ -7097,8 +7097,8 @@ General
|
||||
modify_control_key. Removed #ifdef _POSIX_VDISABLE check
|
||||
around Control-S,Q,Z handlers because we need it now for
|
||||
the Alt-Alt-x code.
|
||||
- Added --view option to getopt_long() call. Bug discovered
|
||||
by Rocco Corsi.
|
||||
- Added --view option to getopt_long() call (bug discovered by
|
||||
Rocco Corsi).
|
||||
help_init()
|
||||
- Fix off by one error that was making ^G help in normal mode and
|
||||
^_ in Pico mode not be displayed in the help (bug discovered by
|
||||
@@ -7292,7 +7292,7 @@ nano 0.9.20 - 2000.11.18
|
||||
- nano.c:
|
||||
keypad_on()
|
||||
- New function, toggles turning the keypad on and off in edit and
|
||||
bottomwin(). Added call to this in finish(), fixes bug #45.
|
||||
bottomwin(). Added call to this in finish(). Fixes bug #45.
|
||||
- search.c
|
||||
findnextstr()
|
||||
- New arg for begin_x variable, basically a rewrite that
|
||||
@@ -7359,7 +7359,7 @@ nano 0.9.18 - 2000.09.18
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- Don't immediately abort if we're on filebot and the marker is
|
||||
set (fixes bug #42).
|
||||
set. Fixes bug #42.
|
||||
- files.c:
|
||||
open_file()
|
||||
- Fix for bug #44. (Rocco Corsi)
|
||||
@@ -7372,9 +7372,9 @@ nano 0.9.18 - 2000.09.18
|
||||
available, allows nano to work with cygwin.
|
||||
- Added gettext calls to enable/disable strings. (Jordi)
|
||||
- Revamped a great deal of the F-key and keypad key handling,
|
||||
because we not longer use keypad() (see below).
|
||||
because we no longer use keypad() (see below).
|
||||
- Removed keypad() call because nano was not working with the
|
||||
keypad in many terms, which is very bad.
|
||||
keypad on many terminals, which is very bad.
|
||||
- Made insert key call do_insertfile().
|
||||
do_toggle()
|
||||
- Rewrote function to allow NOHELP toggle to work on systems
|
||||
@@ -7450,7 +7450,7 @@ nano-0.9.17 - 2000.09.04
|
||||
findnextstr():
|
||||
- Added reset for placewewant. (Ben Roberts)
|
||||
- Fixed check for string that only occurs on the same line failing
|
||||
(discovered by Ken Tyler).
|
||||
(bug discovered by Ken Tyler).
|
||||
|
||||
nano-0.9.16 - 2000.08.09
|
||||
- cut.c:
|
||||
@@ -7481,7 +7481,7 @@ nano-0.9.15 - 2000.08.03
|
||||
with --with-slang or --without-slang
|
||||
- nano.c:
|
||||
splice_node()
|
||||
- New function, abstracts linking in nodes. Fixes bug #36.
|
||||
- New function, abstracts linking in nodes. Fixes bug #36.
|
||||
null_at()
|
||||
- New function, nulls a string at a given index and realigns it.
|
||||
delete_buffer()
|
||||
@@ -7555,7 +7555,7 @@ nano-0.9.13 - 2000.07.23
|
||||
- More intelligent emergency-save filename selection. (Rob)
|
||||
do_spell():
|
||||
- Changed exit semantics a bit so that aspell wouldn't get
|
||||
all screwy (bug discovered by Joshua Jensen.
|
||||
all screwy (bug discovered by Joshua Jensen).
|
||||
- files.c:
|
||||
read_file():
|
||||
- Added init of buf variable, hopefully this will stop the
|
||||
@@ -7606,8 +7606,8 @@ nano-0.9.12 - 2000.07.07
|
||||
- Magic Line code in read_file (Rob)
|
||||
- nano.c:
|
||||
- Removed dual alt_speller variables, oops! (Rocco Corsi)
|
||||
- Removed unnecessary do_oldspell function. (Rocco Corsi). Added
|
||||
SMALL_NANO #ifdef around actual spell function.
|
||||
- Removed unnecessary do_oldspell function. (Rocco Corsi)
|
||||
- Added SMALL_NANO #ifdef around actual spell function.
|
||||
- Moved page_up() to move.c where is belongs.
|
||||
- Corrected FIXME in do_enter with explanation. (Rob)
|
||||
- Fixed FIXME in do_justify, resulted in creation of
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
Improvements in GNU nano
|
||||
========================
|
||||
|
||||
Since 2.8.0:
|
||||
- The ^G help texts have become searchable (with ^W and M-W).
|
||||
- Ctrl+Home and Ctrl+End jump to start and end of file.
|
||||
- In softwrap mode the cursor now moves per visual row instead of per
|
||||
logical line, and the screen will scroll per row.
|
||||
|
||||
Since 2.7.0:
|
||||
- The keystroke ^] to complete a fragment to an existing full word.
|
||||
- The ability to display line numbers in front of the text (M-#).
|
||||
|
||||
107
NEWS
107
NEWS
@@ -1,3 +1,44 @@
|
||||
2017.06.25 - GNU nano 2.8.5 "Farouche" avoids a crash when waking from
|
||||
a suspension that was induced from the outside, allows
|
||||
negative line and column numbers on the command line,
|
||||
avoids some flickering when resizing the screen while
|
||||
in the file browser, opens files in the order they were
|
||||
mentioned on the command line, and does not pretend to
|
||||
have woken from suspension when receiving a SIGCONT.
|
||||
|
||||
2017.05.21 - GNU nano 2.8.4 "Our Version of Events" includes the nanorc
|
||||
man page again.
|
||||
|
||||
2017.05.18 - GNU nano 2.8.3 "Hirsch" fixes a misplacement of the spotlight
|
||||
during interactive replacing, avoids build failures on AIX
|
||||
and Solaris, fixes a crash on Solaris, speeds up backwards
|
||||
searching, improves PHP syntax highlighting, and no longer
|
||||
asks “save anyway?” when the user ^Q discards the buffer.
|
||||
|
||||
2017.05.04 - GNU nano 2.8.2 "Krats" adds another new feature: it makes
|
||||
the ^G help texts searchable with ^W. Apart from that,
|
||||
it fixes a crash when resizing the window in the middle
|
||||
of verbatim input, avoids an unlikely crash when used
|
||||
without UTF-8 support in some locales, avoids redrawing
|
||||
the screen twice when switching between buffers while
|
||||
line numbers are active, and works around a coloring
|
||||
bug on musl. Plus tweaks to the documentation; plus
|
||||
translation updates for fifteen languages.
|
||||
|
||||
2017.04.12 - GNU nano 2.8.1 "Ellert" fixes build failures on MacOS and
|
||||
on musl, fixes scrolling problems in softwrap mode when
|
||||
double-width characters on row boundaries are involved,
|
||||
shows double-width characters as ">" and "<" when split
|
||||
across two rows, moves the cursor more predictably (at
|
||||
the cost of sometimes putting it on the second "half"
|
||||
of a character), avoids creating lines that consist of
|
||||
only blanks when using autoindent, makes ^Home and ^End
|
||||
go to the start and end of the file (on terminals that
|
||||
support those keystrokes), places the cursor better when
|
||||
linting, lets the linter ask only once whether to open
|
||||
an included file, and adds bindings for ^Up and ^Down
|
||||
in the file browser. Don't sit on your hands.
|
||||
|
||||
2017.03.31 - GNU nano 2.8.0 "Axat" makes it easier to move around in
|
||||
softwrapped lines: the Up and Down keys now step from
|
||||
visual row to visual row instead of jumping between
|
||||
@@ -8,7 +49,7 @@
|
||||
of always per logical line. On an entirely different
|
||||
front: nano now makes use of gnulib, to make it build
|
||||
on more platforms. In short: there were many internal
|
||||
changes, not many user-visible ones (apart form the
|
||||
changes, not many user-visible ones (apart from the
|
||||
new softwrap navigation). The conversion to gnulib
|
||||
was done by Mike Frysinger, the softwrap overhaul by
|
||||
David Ramsey.
|
||||
@@ -51,8 +92,8 @@
|
||||
related to using line numbers in softwrap mode, allows to
|
||||
use the PageUp and PageDown keys together with Shift on
|
||||
VTE-based terminals, stops the help lines from flickering
|
||||
during interactive replacing, makes a "set fill" override
|
||||
an earlier "set nowrap", properly restores the selected
|
||||
during interactive replacing, makes a 'set fill' override
|
||||
an earlier 'set nowrap', properly restores the selected
|
||||
region after an external spell check, and improves a few
|
||||
other tidbits. If you should find any more bugs, please
|
||||
run 'man nano | grep bugs' and report them there.
|
||||
@@ -242,13 +283,12 @@
|
||||
handling of --tempfile mode, and better handling of
|
||||
command line arguments when also attempting to specify
|
||||
+<line number>. As always, please file any bugs you
|
||||
find at the Savannah page for nano, at
|
||||
https://savannah.gnu.org/bugs/index.php?42639 and
|
||||
thanks for using nano.
|
||||
find via https://savannah.gnu.org/bugs/?group=nano
|
||||
and thanks for using nano.
|
||||
|
||||
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry. This
|
||||
release contains only a small number of fixes, but in
|
||||
particular allows nano to compile on non-UTF-8 curses
|
||||
2014.06.02 - GNU nano 2.3.4 won't leave you high, won't leave you dry.
|
||||
This release contains only a small number of fixes, but
|
||||
in particular allows nano to compile on non-UTF-8 curses
|
||||
implementations (i.e. libncursesw). Other small fixes to
|
||||
the undo implementation and the default syntax config are
|
||||
also included. As always, Share and Enjoy!
|
||||
@@ -293,11 +333,11 @@
|
||||
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 flag, or via "set poslog"
|
||||
the -P or --poslog command-line flag, 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.
|
||||
for the 'set allow_insecure_backup' nanorc option.
|
||||
Don't stop, get it get it, don't stop, get it get it.
|
||||
|
||||
|
||||
@@ -317,7 +357,7 @@
|
||||
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
|
||||
'allow_insecure_backup' to be even more permissive and
|
||||
allow the write to proceed. Also included are some
|
||||
syntax highlighting updates, and that is about it.
|
||||
Keep fighting the good fight children.
|
||||
@@ -508,16 +548,16 @@
|
||||
an internal error occurs in the undo code, and fixes for
|
||||
various combinations of configure-time options and
|
||||
compiler flags. Also included is new support for
|
||||
changing the rc file name at configure time, and
|
||||
using GNU-style regexes for word-boundaries on systems
|
||||
which do not support them natively, as well as the ever
|
||||
popular translation updates. Rock the tarball.
|
||||
changing the rc file name at configure time, and using
|
||||
GNU-style regexes for word-boundaries on systems which
|
||||
do not support them natively, as well as the ever popular
|
||||
translation updates. Rock the tarball.
|
||||
|
||||
2008.08.09 - GNU nano 2.1.4 "I told you so!" is released. This release
|
||||
includes fixes for several severe issues with the new
|
||||
undo/redo code. Also the behavior of writing
|
||||
files when using backup mode has changed as well: if writing
|
||||
the backup file fails, nano will not attempt to write the
|
||||
undo/redo code. Also the behavior of writing files when
|
||||
using backup mode has changed as well: if writing the
|
||||
backup file fails, nano will not attempt to write the
|
||||
current file. This should help folks who enjoy "extreme
|
||||
text editing", i.e. editing files on file systems which
|
||||
are likely to run out of space; see Savannah bug #24000.
|
||||
@@ -1223,28 +1263,27 @@
|
||||
Have fun with it.
|
||||
|
||||
2001.03.22 - GNU Nano 1.0 is released! The autoindent wrapping bug
|
||||
has been fixed, as well as strange bug when using Pico
|
||||
has been fixed, as well as a strange bug when using Pico
|
||||
mode and regex search. There have also been some minor
|
||||
spelling and documentation updates. As stated on the
|
||||
website, there are currently no known bugs with nano,
|
||||
but some will pop up eventually and they will be
|
||||
addressed in subsequent releases. We hope you enjoy
|
||||
this first stable release of nano, and as always,
|
||||
feedback is welcome! nano@nano-editor.org.
|
||||
feedback is welcome! <nano@nano-editor.org>
|
||||
|
||||
|
||||
2001.02.19 - Nano 0.9.99pre3 brings a lot of changes! The most
|
||||
important being that nano is now officially a GNU
|
||||
program. Some changes have been made for GNU
|
||||
compatibility (like the default list of shortcuts, "^G
|
||||
Get Help" is now Listed and "^_ Goto Line" is not). The
|
||||
Yes/No/All keys have finally been internationalized
|
||||
also. All in all, quite a few changes, considering nano
|
||||
is supposed to be in a code freeze. But there are the
|
||||
usual helping of bugfixes, a nasty bug when cutting text
|
||||
in -k mode and some compatibility issues with older
|
||||
ncurses libraries have also been fixed. All in all, a
|
||||
lot to see.
|
||||
2001.02.19 - Nano 0.9.99pre3 brings a lot of changes! The most important
|
||||
being that nano is now officially a GNU program. Some
|
||||
changes have been made for GNU compatibility (like in the
|
||||
default list of shortcuts: "^G Get Help" is now listed
|
||||
and "^_ Goto Line" is not). The Yes/No/All keys have
|
||||
finally been internationalized also. All in all, quite
|
||||
a few changes, considering nano is supposed to be in
|
||||
a code freeze. But there are the usual helping of
|
||||
bugfixes, a nasty bug when cutting text in -k mode and
|
||||
some compatibility issues with older ncurses libraries
|
||||
have also been fixed. All in all, a lot to see.
|
||||
|
||||
2001.01.31 - Nano 0.9.99pre2 is released. Not surprisingly, all that is
|
||||
new is bugfixes, bugfixes, bugfixes. There were a few
|
||||
@@ -1253,7 +1292,7 @@
|
||||
is now a preliminary (read: needs testing) fix for
|
||||
resizing the editor in any mode other than normal edit
|
||||
mode. Other fixes include some more tab completion
|
||||
segfaults, and an silly segfault that occurred when
|
||||
segfaults, and a silly segfault that occurred when
|
||||
successfully writing a file on the 2nd try (i.e. after
|
||||
an initial write error). Slowly but surely, on toward
|
||||
1.0 we travel.
|
||||
|
||||
11
README
11
README
@@ -65,5 +65,12 @@ Bug Reports
|
||||
|
||||
Current Status
|
||||
|
||||
GNU nano has reached its seventh milestone, 2.6.x. Since 2.5.0, it
|
||||
is a "rolling" release: bug fixing and development go hand in hand.
|
||||
Since version 2.5.0, GNU nano has abandoned the distinction between
|
||||
a stable and a development branch: it is now on a "rolling" release
|
||||
-- fixing bugs and adding new features go hand in hand.
|
||||
|
||||
Copyright Years
|
||||
|
||||
When in any file of this package a copyright notice mentions a
|
||||
year range (such as 1999-2011), it is a shorthand for a list of
|
||||
all the years in that interval.
|
||||
|
||||
45
TODO
45
TODO
@@ -1,29 +1,12 @@
|
||||
A list of desired features
|
||||
--------------------------
|
||||
|
||||
Vague musings:
|
||||
- FriBidi support?
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
- 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 conversion between different character sets.
|
||||
- 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?
|
||||
- Allow searching for and replacing newlines?
|
||||
See also https://savannah.gnu.org/bugs/?47053.
|
||||
- New regression framework built on expect?
|
||||
- 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?
|
||||
|
||||
Somewhat urgent:
|
||||
- Allow text searches in the help viewer.
|
||||
See https://savannah.gnu.org/bugs/?28994.
|
||||
- Make undo/redo work also for justifying and indenting.
|
||||
- Detect when text is being pasted, so that we can handle it faster.
|
||||
See https://savannah.gnu.org/bugs/?40060.
|
||||
- Allow to define and execute a macro: a stored sequence of keystrokes.
|
||||
See https://savannah.gnu.org/bugs/?50314.
|
||||
- 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.
|
||||
@@ -31,6 +14,20 @@ Somewhat urgent:
|
||||
the command's output -- that is: generalize the spell-check flow.
|
||||
See also https://savannah.gnu.org/bugs/?28993.
|
||||
|
||||
Vague musings:
|
||||
- FriBidi support?
|
||||
- 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?
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
- 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?
|
||||
|
||||
For version 2.8:
|
||||
- Allow text searches in the help viewer. [DONE]
|
||||
|
||||
For version 2.4:
|
||||
- Handle window resizes better. After we've resized, we should stay
|
||||
wherever we were before we resized, as Pico does. [DONE]
|
||||
@@ -63,14 +60,13 @@ For version 2.0:
|
||||
|
||||
For version 1.2:
|
||||
- Single-line scroll up/down? [DONE]
|
||||
- Color syntax highlighting? (Certainly seems like there's a demand for
|
||||
it.) [DONE]
|
||||
- .nanorc [DONE]
|
||||
- Color syntax highlighting? (There seems to be a demand for it.) [DONE]
|
||||
- Support for a .nanorc file. [DONE]
|
||||
- Backup making (filename~)? [DONE]
|
||||
- Search/replace string history. [DONE]
|
||||
- Implement Pico's -j and -g flags, as they are pretty easy to do. [DONE]
|
||||
- Make mouse support work with clicking on the shortcuts (-m). [DONE]
|
||||
- Implement -o (chroot of sorts). [DONE]
|
||||
- Implement -o (--operatingdir, a chroot of sorts). [DONE]
|
||||
- Allow -r to take a negative argument, meaning right margin instead of
|
||||
left (allows resizing that way), formerly -W arg. [DONE]
|
||||
|
||||
@@ -81,7 +77,6 @@ For version 1.0:
|
||||
- Allow nano to be resized in X. [DONE]
|
||||
- On PageUp/Down, put the cursor on the first line (like Pico), not the
|
||||
center line. [DONE]
|
||||
- Rewrite edit_refresh, if at all possible. [DONE]
|
||||
- Implement justify function. [DONE]
|
||||
- Cut to end of line. [DONE]
|
||||
- Built-in speller command. [DONE]
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="4084b3a1094372b960ce4a97634e08f4538c8bdd"
|
||||
gnulib_hash="736844e30bb369d203d45503a7cab9f560113cab"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
getdelim
|
||||
getline
|
||||
getopt-gnu
|
||||
|
||||
221
configure.ac
221
configure.ac
@@ -1,7 +1,7 @@
|
||||
# Configuration for GNU nano - a small and user-friendly text editor
|
||||
#
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
# 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2014, 2017 Mike Frysinger
|
||||
#
|
||||
# GNU nano is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [2.8.0], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.8.5], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
@@ -63,9 +63,14 @@ AC_CHECK_HEADERS(libintl.h limits.h pwd.h termios.h sys/param.h)
|
||||
dnl Checks for options.
|
||||
|
||||
AC_ARG_ENABLE(browser,
|
||||
AS_HELP_STRING([--disable-browser], [Disable built-in file browser]))
|
||||
if test "x$enable_browser" = xno; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
AS_HELP_STRING([--disable-browser], [Disable the built-in file browser]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_browser" != xyes; then
|
||||
enable_browser=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_browser" != xno; then
|
||||
AC_DEFINE(ENABLE_BROWSER, 1, [Define this to enable the built-in file browser.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(color,
|
||||
@@ -85,7 +90,7 @@ else
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(comment,
|
||||
AS_HELP_STRING([--disable-comment], [Disable comment/uncomment functions]))
|
||||
AS_HELP_STRING([--disable-comment], [Disable the comment/uncomment function]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_comment" = xyes; then
|
||||
AC_MSG_ERROR([--enable-comment cannot work with --enable-tiny])
|
||||
@@ -93,22 +98,37 @@ if test "x$enable_tiny" = xyes; then
|
||||
enable_comment=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_comment" != xyes; then
|
||||
if test "x$enable_comment" != xno; then
|
||||
AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
|
||||
fi
|
||||
if test "x$enable_comment" != xno; then
|
||||
AC_DEFINE(ENABLE_COMMENT, 1, [Define this to enable the comment/uncomment function.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(extra,
|
||||
AS_HELP_STRING([--disable-extra], [Disable extra features, currently only easter eggs]))
|
||||
AS_HELP_STRING([--disable-extra], [Disable the Easter egg]))
|
||||
if test "x$enable_extra" = xno; then
|
||||
AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(help,
|
||||
AS_HELP_STRING([--disable-help], [Disable help functions]))
|
||||
if test "x$enable_help" = xno; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
|
||||
AS_HELP_STRING([--disable-help], [Disable the built-in help texts]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_help" = xyes; then
|
||||
if test "x$enable_multibuffer" != xyes; then
|
||||
AC_MSG_ERROR([--enable-help needs --enable-multibuffer to work])
|
||||
fi
|
||||
else
|
||||
enable_help=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_multibuffer" = xno; then
|
||||
if test "x$enable_help" = xyes; then
|
||||
AC_MSG_ERROR([--enable-help cannot work with --disable-multibuffer])
|
||||
else
|
||||
# Disabling multibuffer silently disables the help texts.
|
||||
enable_help=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_help" != xno; then
|
||||
AC_DEFINE(ENABLE_HELP, 1, [Define this to enable the Ctrl+G help texts.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(histories,
|
||||
@@ -118,7 +138,7 @@ if test "x$enable_histories" = xno; then
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(justify,
|
||||
AS_HELP_STRING([--disable-justify], [Disable justify/unjustify functions]))
|
||||
AS_HELP_STRING([--disable-justify], [Disable the justify/unjustify functions]))
|
||||
if test "x$enable_justify" = xno; then
|
||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
|
||||
fi
|
||||
@@ -133,52 +153,69 @@ if test "x$enable_tiny" = xyes; then
|
||||
enable_linenumbers=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_linenumbers" != xyes; then
|
||||
if test "x$enable_linenumbers" != xno; then
|
||||
AC_DEFINE(ENABLE_LINENUMBERS, 1, [Define this to enable line numbering.])
|
||||
fi
|
||||
if test "x$enable_linenumbers" != xno; then
|
||||
AC_DEFINE(ENABLE_LINENUMBERS, 1, [Define this to enable line numbering.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(mouse,
|
||||
AS_HELP_STRING([--disable-mouse], [Disable mouse support (and -m flag)]))
|
||||
if test "x$enable_mouse" = xno; then
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
|
||||
AS_HELP_STRING([--disable-mouse], [Disable mouse support]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_mouse" != xyes; then
|
||||
enable_mouse=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_mouse" != xno; then
|
||||
AC_DEFINE(ENABLE_MOUSE, 1, [Define this to enable mouse support.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(multibuffer,
|
||||
AS_HELP_STRING([--disable-multibuffer], [Disable multiple file buffers]))
|
||||
if test "x$enable_multibuffer" = xno; then
|
||||
AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_multibuffer" != xyes; then
|
||||
enable_multibuffer=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_multibuffer" != xno; then
|
||||
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(nanorc,
|
||||
AS_HELP_STRING([--disable-nanorc], [Disable use of .nanorc files]))
|
||||
if test "x$enable_nanorc" = xno; then
|
||||
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
|
||||
else
|
||||
AS_HELP_STRING([--disable-nanorc], [Disable the use of .nanorc files]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_nanorc" != xyes; then
|
||||
enable_nanorc=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_nanorc" != xno; then
|
||||
AC_DEFINE(ENABLE_NANORC, 1, [Define this to enable the use of .nanorc files.])
|
||||
nanorc_support=yes
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(operatingdir,
|
||||
AS_HELP_STRING([--disable-operatingdir], [Disable setting of operating directory (chroot of sorts)]))
|
||||
AS_HELP_STRING([--disable-operatingdir], [Disable the setting of an operating directory]))
|
||||
if test "x$enable_operatingdir" = xno; then
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of an operating directory (a chroot of sorts).])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(speller,
|
||||
AS_HELP_STRING([--disable-speller], [Disable spell checker functions]))
|
||||
AS_HELP_STRING([--disable-speller], [Disable the spell-checker functions]))
|
||||
if test "x$enable_speller" = xno; then
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(tabcomp,
|
||||
AS_HELP_STRING([--disable-tabcomp], [Disable tab completion functions]))
|
||||
if test "x$enable_tabcomp" = xno; then
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab completion functions for filenames and search strings.])
|
||||
AS_HELP_STRING([--disable-tabcomp], [Disable the tab-completion functions]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_tabcomp" != xyes; then
|
||||
enable_tabcomp=no
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_tabcomp" != xno; then
|
||||
AC_DEFINE(ENABLE_TABCOMP, 1, [Define this to have tab completion for filenames and search strings.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(wordcomp,
|
||||
AS_HELP_STRING([--disable-wordcomp], [Disable the word completion function]))
|
||||
AS_HELP_STRING([--disable-wordcomp], [Disable the word-completion function]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_wordcomp" = xyes; then
|
||||
AC_MSG_ERROR([--enable-wordcomp cannot work with --enable-tiny])
|
||||
@@ -186,16 +223,14 @@ if test "x$enable_tiny" = xyes; then
|
||||
enable_wordcomp=no
|
||||
fi
|
||||
fi
|
||||
if test "x$disable_wordcomp" != xyes; then
|
||||
if test "x$enable_wordcomp" != xno; then
|
||||
AC_DEFINE(ENABLE_WORDCOMPLETION, 1, [Define this to enable the word completion function.])
|
||||
fi
|
||||
if test "x$enable_wordcomp" != xno; then
|
||||
AC_DEFINE(ENABLE_WORDCOMPLETION, 1, [Define this to enable the word-completion function.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(wrapping,
|
||||
AS_HELP_STRING([--disable-wrapping], [Disable all wrapping of text (and -w flag)]))
|
||||
AS_HELP_STRING([--disable-wrapping], [Disable all hard-wrapping of text]))
|
||||
if test "x$enable_wrapping" = xno; then
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all hard text wrapping.])
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(wrapping-as-root,
|
||||
@@ -207,7 +242,7 @@ fi
|
||||
AC_ARG_ENABLE(debug,
|
||||
AS_HELP_STRING([--enable-debug], [Enable debugging (disabled by default)]))
|
||||
if test "x$enable_debug" = xyes; then
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable debug messages and assert warnings.])
|
||||
AC_DEFINE(DEBUG, 1, [Define this to enable debug messages and abortion on failing asserts.])
|
||||
else
|
||||
AC_DEFINE(NDEBUG, 1, [Shut up assert warnings :-)])
|
||||
fi
|
||||
@@ -216,23 +251,17 @@ AC_ARG_ENABLE(tiny,
|
||||
AS_HELP_STRING([--enable-tiny], [Disable features for the sake of size]))
|
||||
if test "x$enable_tiny" = xyes; then
|
||||
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.])
|
||||
if test "x$enable_browser" != xyes; then
|
||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||
fi
|
||||
if test "x$enable_color" != xyes; then
|
||||
AC_DEFINE(DISABLE_COLOR, 1, [Define this to disable syntax highlighting.])
|
||||
color_support=no
|
||||
else
|
||||
if test "x$enable_nanorc" != xyes; then
|
||||
AC_MSG_ERROR([--enable-color with --enable-tiny cannot work without --enable-nanorc])
|
||||
AC_MSG_ERROR([--enable-color needs --enable-nanorc to work])
|
||||
fi
|
||||
fi
|
||||
if test "x$enable_extra" != xyes; then
|
||||
AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
|
||||
fi
|
||||
if test "x$enable_help" != xyes; then
|
||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help text display.])
|
||||
fi
|
||||
if test "x$enable_histories" != xyes; then
|
||||
AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
|
||||
fi
|
||||
@@ -242,23 +271,11 @@ if test "x$enable_tiny" = xyes; then
|
||||
if test "x$enable_libmagic" != xyes; then
|
||||
enable_libmagic=no
|
||||
fi
|
||||
if test "x$enable_mouse" != xyes; then
|
||||
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable the mouse support.])
|
||||
fi
|
||||
if test "x$enable_multibuffer" != xyes; then
|
||||
AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
|
||||
fi
|
||||
if test "x$enable_nanorc" != xyes; then
|
||||
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
|
||||
fi
|
||||
if test "x$enable_operatingdir" != xyes; then
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of the operating directory (chroot of sorts).])
|
||||
AC_DEFINE(DISABLE_OPERATINGDIR, 1, [Define this to disable the setting of an operating directory (a chroot of sorts).])
|
||||
fi
|
||||
if test "x$enable_speller" != xyes; then
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell checker functions.])
|
||||
fi
|
||||
if test "x$enable_tabcomp" != xyes; then
|
||||
AC_DEFINE(DISABLE_TABCOMP, 1, [Define this to disable the tab completion functions for files and search strings.])
|
||||
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
|
||||
fi
|
||||
if test "x$enable_wrapping" != xyes; then
|
||||
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
|
||||
@@ -545,13 +562,13 @@ else
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], [use_default_colors],
|
||||
[AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() command.])],
|
||||
[AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors() function.])],
|
||||
[], [$CURSES_LIB])
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], [set_escdelay],
|
||||
[AC_DEFINE(HAVE_SET_ESCDELAY, 1, [Define this if your curses library has the set_escdelay() function.])],
|
||||
[], [$CURSES_LIB])
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], [key_defined],
|
||||
[AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() command.])],
|
||||
[AC_DEFINE(HAVE_KEY_DEFINED, 1, [Define this if your curses library has the key_defined() function.])],
|
||||
[], [$CURSES_LIB])
|
||||
|
||||
dnl Parse any configure options.
|
||||
@@ -587,36 +604,43 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for enhanced regular expression flag], nano_cv_flag_reg_extended,
|
||||
AC_CACHE_CHECK([for enhanced regular expression flag], nano_cv_flag_reg_enhanced,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <regex.h>]],
|
||||
[[
|
||||
#ifndef REG_ENHANCED
|
||||
error: No REG_ENHANCED support!
|
||||
#endif
|
||||
]])],
|
||||
[nano_cv_flag_reg_extended="REG_EXTENDED | REG_ENHANCED"],
|
||||
[nano_cv_flag_reg_extended="REG_EXTENDED"])])
|
||||
[nano_cv_flag_reg_enhanced=yes],
|
||||
[nano_cv_flag_reg_enhanced=no])])
|
||||
dnl The bundled gnulib regex module doesn't support REG_ENHANCED.
|
||||
if test "$ac_use_included_regex" = "yes"; then
|
||||
nano_cv_flag_reg_enhanced="no"
|
||||
fi
|
||||
if test "$nano_cv_flag_reg_enhanced" = "yes"; then
|
||||
nano_reg_extended="REG_EXTENDED | REG_ENHANCED"
|
||||
else
|
||||
nano_reg_extended="REG_EXTENDED"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_cv_flag_reg_extended,
|
||||
AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_reg_extended,
|
||||
[Flag(s) to use to get the full range of extended regular expressions])
|
||||
|
||||
# Check for word-boundary support (/< and />).
|
||||
AC_MSG_CHECKING([for GNU-style word boundary regex support])
|
||||
AC_ARG_WITH(wordbounds,
|
||||
AS_HELP_STRING([--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 can't test the target.
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
AC_TRY_RUN([
|
||||
[with_wordbounds=$withval], [with_wordbounds=auto])
|
||||
if test "$with_wordbounds" != "no"; then
|
||||
dnl If we're using the bundled gnulib regex module, we know it's supported.
|
||||
if test "$ac_use_included_regex" = "yes"; then
|
||||
with_wordbounds="yes"
|
||||
fi
|
||||
|
||||
dnl We explicitly don't check if the user forced the option, because
|
||||
dnl this is needed for cross compilers and we can't test the target.
|
||||
if test "$with_wordbounds" != "yes"; then
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@@ -627,18 +651,29 @@ int main(void)
|
||||
size_t nmatch;
|
||||
regmatch_t pmatch;
|
||||
|
||||
if (regcomp(&r, "\\\\>", $nano_cv_flag_reg_extended|REG_NOSUB))
|
||||
if (regcomp(&r, "\\\\>", $nano_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 this 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])
|
||||
)
|
||||
])
|
||||
with_wordbounds="yes",
|
||||
with_wordbounds="no",
|
||||
with_wordbounds="cross")
|
||||
fi
|
||||
fi
|
||||
case $with_wordbounds in
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.])
|
||||
;;
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
cross)
|
||||
AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x$color_support = xyes; then
|
||||
# if test x$CURSES_LIB_NAME = xcurses; then
|
||||
@@ -660,7 +695,7 @@ 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_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])
|
||||
@@ -678,7 +713,7 @@ int main(void)
|
||||
COLS = 25;
|
||||
return 0;
|
||||
}],
|
||||
AC_DEFINE(REDEFINING_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_DEFINE(REDEFINING_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]))
|
||||
|
||||
166
doc/faq.html
166
doc/faq.html
@@ -9,20 +9,21 @@
|
||||
<h1>The GNU nano editor FAQ</h1>
|
||||
<h2>Table of Contents</h2>
|
||||
<h2><a href="#1">1. General</a></h2>
|
||||
<blockquote><p><a href="#1.1">1.1 About this FAQ</a><br>
|
||||
<a href="#1.2">1.2. How do I contribute to it?</a><br>
|
||||
<a href="#1.3">1.3. What is GNU nano?</a><br>
|
||||
<a href="#1.4">1.4. What is the history behind nano?</a><br>
|
||||
<a href="#1.5">1.5. Why the name change from TIP?</a><br>
|
||||
<a href="#1.6">1.6. What is the current version of nano?</a><br>
|
||||
<a href="#1.7">1.7. I want to read the manpage without having to download the program!</a></p></blockquote>
|
||||
<blockquote><p>
|
||||
<a href="#1.1">1.1. What is GNU nano?</a><br>
|
||||
<a href="#1.2">1.2. What is the history behind nano?</a><br>
|
||||
<a href="#1.3">1.3. Why the name change from TIP?</a><br>
|
||||
<a href="#1.4">1.4. What is the current version of nano?</a><br>
|
||||
<a href="#1.5">1.5. I want to read the manpage without having to download the program!</a></p></blockquote>
|
||||
<h2><a href="#2">2. Where to get GNU nano.</a></h2>
|
||||
<blockquote><p><a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
|
||||
<a href="#2.2">2.2. RedHat and derivatives (.rpm) packages.</a><br>
|
||||
<a href="#2.3">2.3. Debian (.deb) packages.</a><br>
|
||||
<a href="#2.4">2.4. By GIT (for the brave).</a></p></blockquote>
|
||||
<h2><a href="#3">3. Installation and Configuration</a></h2>
|
||||
<blockquote><p><a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
|
||||
<a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
|
||||
<a href="#3.3">3.3. Why does everything go into /usr/local?</a><br>
|
||||
<a href="#3.5">3.5. nano should automatically run strip on the binary when installing it!</a><br>
|
||||
@@ -32,44 +33,44 @@
|
||||
<a href="#3.9a">3.9a. How do I make a .nanorc file that nano will read when I start it?</a><br>
|
||||
<a href="#3.9b">3.9b. 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>
|
||||
<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>
|
||||
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
|
||||
<a href="#4.4">4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</a><br>
|
||||
<a href="#4.5">4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.5">4.5. How do I type the F13-F16 keys listed in the help viewer? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.6">4.6. nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.7">4.7. nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.8">4.8. 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.8a">4.8a. 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.8b">4.8b. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?<a><br>
|
||||
<a href="#4.9">4.9. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.10">4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.11">4.11. 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.12">4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions 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>
|
||||
<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>
|
||||
<a href="#5.3">5.3. What is the status of Unicode support?</a></p></blockquote>
|
||||
<h2><a href="#6">6. Advocacy and Licensing</a></h2>
|
||||
<blockquote><p><a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
|
||||
<a href="#6.2">6.2. Why should I use Pico instead of nano?</a><br>
|
||||
<a href="#6.3">6.3. What is so bad about the older Pine license?</a><br>
|
||||
<a href="#6.4">6.4. Okay, well, what mail program should I use then?</a></p></blockquote>
|
||||
<h2><a href="#7">7. Miscellaneous</a></h2>
|
||||
<blockquote><p><a href="#7.1">7.1. nano-related mailing lists.</a><br>
|
||||
<a href="#7.2">7.2. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
||||
<a href="#7.3">7.3. How do I submit a bug report or patch?</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#7.1">7.1. Where can I ask questions or send suggestions?</a><br>
|
||||
<a href="#7.2">7.2. How do I submit a bug report or patch?</a><br>
|
||||
<a href="#7.3">7.3. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
||||
<a href="#7.4">7.4. How do I join the development team?</a><br>
|
||||
<a href="#7.5">7.5. Can I have write access to the GIT tree?</a></p></blockquote>
|
||||
<h2><a href="#8">8. ChangeLog</a></h2>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="1"></a>1. General</h1>
|
||||
<h2><a name="1.1"></a>1.1 About this FAQ</h2>
|
||||
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. It was then maintained by David Lawrence Ramsey <<a href="mailto:pooka109@gmail.com">pooka109@gmail.com</a>>. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
|
||||
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
|
||||
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
|
||||
<h2><a name="1.1"></a>1.1. What is GNU nano?</h2>
|
||||
<blockquote><p>GNU nano is designed to be a free replacement for the Pico text editor, part of the Pine email suite from <a href="http://www.washington.edu/pine/">The University of Washington</a>. It aims to "emulate Pico as closely as possible and then include extra functionality".</p></blockquote>
|
||||
<h2><a name="1.4"></a>1.4. What is the history behind nano?</h2>
|
||||
<h2><a name="1.2"></a>1.2. What is the history behind nano?</h2>
|
||||
<blockquote><p>Funny you should ask!</p>
|
||||
<p><b>In the beginning...</b></p>
|
||||
<p>For years Pine was THE program used to read email on a Unix system. The Pico text editor is the portion of the program one would use to compose his or her mail messages. Many beginners to Unix flocked to Pico and Pine because of their well organized, easy to use interfaces. With the proliferation of GNU/Linux in the mid to late 90's, many University students became intimately familiar with the strengths (and weaknesses) of Pine and Pico.</p>
|
||||
@@ -79,11 +80,11 @@
|
||||
<p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is in today.</p>
|
||||
<p>In February 2001, nano was declared an official GNU program by Richard Stallman. nano also reached its first production release on March 22, 2001.</p></blockquote>
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<h2><a name="1.3"></a>1.3. 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 <i>should</i> be <b>2.8.0</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> 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>
|
||||
<h2><a name="1.4"></a>1.4. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.8.5</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.5"></a>1.5. 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="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
@@ -138,27 +139,29 @@
|
||||
<pre>
|
||||
<b>--disable-browser</b> Disable the built-in file browser
|
||||
<b>--disable-color</b> Disable color and syntax highlighting
|
||||
<b>--disable-extra</b> Disable extra features (currently only an easter egg)
|
||||
<b>--disable-help</b> Disable help functions
|
||||
<b>--disable-comment</b> Disable the comment/uncomment function
|
||||
<b>--disable-extra</b> Disable the easter egg
|
||||
<b>--disable-help</b> Disable the built-in help texts
|
||||
<b>--disable-histories</b> Disable the saving of search strings and cursor positions
|
||||
<b>--disable-justify</b> Disable justify/unjustify functions
|
||||
<b>--disable-justify</b> Disable the justify/unjustify functions
|
||||
<b>--disable-libmagic</b> Disable the use of libmagic for determining a file's syntax
|
||||
<b>--disable-linenumbers</b> Disable line numbering
|
||||
<b>--disable-mouse</b> Disable mouse support
|
||||
<b>--disable-multibuffer</b> Disable having multiple file buffers open
|
||||
<b>--disable-multibuffer</b> Disable the opening of multiple file buffers
|
||||
<b>--disable-nanorc</b> Disable the use of .nanorc files
|
||||
<b>--disable-operatingdir</b> Disable the setting of an operating directory
|
||||
<b>--disable-speller</b> Disable spell checker functions
|
||||
<b>--disable-tabcomp</b> Disable tab completion functions
|
||||
<b>--disable-wordcomp</b> Disable the word completion function
|
||||
<b>--disable-speller</b> Disable the spell-checker functions
|
||||
<b>--disable-tabcomp</b> Disable the tab-completion functions
|
||||
<b>--disable-wordcomp</b> Disable the word-completion function
|
||||
<b>--disable-wrapping</b> Disable all hard-wrapping of text</pre>
|
||||
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use with Control-^ to select text). Also, if you know you aren't going to be using other languages, you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on whether you have locale support on your system. And finally, there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
|
||||
<p>With <b>--disable-wrapping-as-root</b> you can disable any hard-wrapping by default when the user is root, useful to prevent accidentally changing long lines in system configuration files.</p>
|
||||
</blockquote>
|
||||
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
|
||||
<blockquote><p>To use multiple file buffers, you must not have configured nano with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<blockquote><p>To use multiple file buffers, you must not have configured nano with <b>--disable-multibuffer</b> nor with <b>--enable-tiny</b> (use <b>nano -V</b> to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit <b>Meta-F</b> after typing <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily without holding Shift: <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
<h2><a name="3.8"></a>3.8. Tell me more about this verbatim input stuff!</h2>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the statusbar), then press the key(s) that generate the character you want.</p>
|
||||
<blockquote><p>When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press <b>Meta-V</b> (if you're not at a prompt, you'll get the message "Verbatim Input" on the status bar), then press the key(s) that generate the character you want.</p>
|
||||
<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. The statubar will change to "Unicode Input: ......" when you do this.</p></blockquote>
|
||||
<h2><a name="3.9a"></a>3.9a. How do I make a .nanorc file that will be read when I start nano?</h2>
|
||||
<blockquote><p>It's not hard at all! But, your nano must <b>not</b> have been compiled with <b>--disable-nanorc</b>. Then simply copy the <b>sample.nanorc</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 of the file is simple. Flags are turned on and off by using the words <b>set</b> and <b>unset</b> plus the long option name for the feature. For example, "set nowrap" or "set smarthome".</p></blockquote>
|
||||
@@ -183,17 +186,19 @@
|
||||
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> option on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</h2>
|
||||
<blockquote><p>This is a bug in the terminal, not in nano. When a key is repeating faster than nano can process it, the keyboard buffer becomes full and starts dropping incoming keystrokes. Unfortunately, it doesn't just drop whole keystrokes; it can also drop parts of multibyte key combinations, resulting in nano's receiving a wrong key.</p></blockquote>
|
||||
<h2><a name="4.5"></a>4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<blockquote><p>This was a bug in how nano handled consecutive escape sequences. It should be fixed since version 2.6.0.</p></blockquote>
|
||||
<h2><a name="4.5"></a>4.5. How do I type the F13-F16 keys listed in the help viewer? My keyboard only has F1-F12!</h2>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, and Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. nano crashes when I type <insert keystroke here>!</h2>
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or in the <a href="https://savannah.gnu.org/bugs/?group=nano">bug tracker</a> on Savannah.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<blockquote><p>Older versions of nano had this problem. Please upgrade to version 2.7.0 or newer.</p></blockquote>
|
||||
<h2><a name="4.8"></a>4.8. 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>
|
||||
<h2><a name="4.8a"></a>4.8a. 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.8b"></a>4.8b. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?</h2>
|
||||
<blockquote><p>When pasting from Windows, in some situations linefeeds are sent instead of carriage returns (Enters). And linefeeds are <b>^J</b>s, which make nano justify (rewrap) the current paragraph. To prevent these linefeeds from causing these unwanted justifications, add this line to your .nanorc on the remote Linux box: <b>unbind ^J main</b> or <b>bind ^J enter main</b>, depending on whether the paste contains CR + LF or only LF.</p></blockquote>
|
||||
<h2><a name="4.9"></a>4.9. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>doc/syntax</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9a">3.9a</a>.</p></blockquote>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the <b>syntax/</b> subdirectory of the nano source, which are normally installed to <b>/usr/local/share/nano/</b>. To enable all of them, uncomment the line <b># include "/usr/local/share/nano/*.nanorc"</b> in your nanorc. See also section <a href="#3.9a">3.9a</a>.</p></blockquote>
|
||||
<h2><a name="4.10"></a>4.10. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||
@@ -240,93 +245,22 @@
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="7"></a>7. Miscellaneous</h1>
|
||||
<h2><a name="7.1"></a>7.1. nano-related mailing lists.</h2>
|
||||
<h2><a name="7.1"></a>7.1. Where can I ask questions or send suggestions?</h2>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>: info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
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="https://savannah.gnu.org/bugs/?group=nano">bug</a> in the program or implement a <a href="https://nano-editor.org/dist/latest/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>
|
||||
<h2><a name="7.2"></a>7.3. How do I submit a bug report or patch?</h2>
|
||||
<blockquote>
|
||||
<p>The best way to submit bugs is through the <a href="https://savannah.gnu.org/bugs/?group=nano">Savannah bug tracker</a>, as you can check whether the bug you are reporting has already been submitted, and it makes it easier for the maintainers to keep track of them.
|
||||
<p>You can submit patches for nano via <a href="https://savannah.gnu.org/patch/?group=nano">Savannah's patch manager</a>.</p></blockquote>
|
||||
<h2><a name="7.3"></a>7.3. 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="https://savannah.gnu.org/bugs/?group=nano">bug</a> in the program or implement a <a href="https://nano-editor.org/dist/latest/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
|
||||
<blockquote><p>The easiest way is to consistently send in good patches that add some needed functionality, fix a bug or two, and/or make the program more optimized/efficient. Then ask nicely and you will probably be added to the Savannah development list and be given write access after a while. There is a lot of responsibility that goes along with being a team member, so don't think it's just something to add to your resume.</p></blockquote>
|
||||
<h2><a name="7.5"></a>7.5. Can I have write access to the git tree?</h2>
|
||||
<blockquote><p>Re-read section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="8"></a>8. ChangeLog</h1>
|
||||
<blockquote><p>
|
||||
2017.01.09 - Delete some obsolete items and update a few others. (Benno)<br>
|
||||
2016.04.17 - Update docs to refer to GIT instead of subversion. (Mike)<br>
|
||||
2015.07.18 - More small fixes and updates. (Benno)<br>
|
||||
2014.04.24 - A bunch of small fixes and updates. (Benno)<br>
|
||||
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. (Chris)<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>
|
||||
2007.04.18 - Add a new section 4.14 to explain how autoindent affects pasted text. (John M. Gabriele, minor tweaks by DLR)<br>
|
||||
2007.04.04 - Update email address. (DLR)<br>
|
||||
2007.01.01 - Update section 4.1 to describe how to open files with names beginning with '+' at specified columns as well as lines. (DLR)<br>
|
||||
2006.11.25 - Add miscellaneous wording and capitalization fixes. (DLR)<br>
|
||||
2006.10.28 - Update various links for the 2.0 branch of nano. (DLR)<br>
|
||||
2006.10.06 - Update the question in section 4.13 to match the version of it in the answer section. (DLR)<br>
|
||||
2006.07.25 - Update section 5.3 again to not state "the latest development version" before 1.3.12, as it's no longer accurate. Also add some minor spacing fixes. (DLR)<br>
|
||||
2006.06.12 - Update section 5.3, due to the display fix for two-column Unicode characters. (DLR)<br>
|
||||
2006.06.05 - Add a new section 4.8, and move all section 4 entries after it down one number, to explain how to deal with glibc 2.2.3's crashes involving extended regular expressions. (DLR)<br>
|
||||
2006.06.04 - Add minor punctuation, wording, and typo fixes. (DLR)<br>
|
||||
2006.05.27 - Update section 3.8 to mention the new "Unicode Input" prompt, and how Unicode input only works when Unicode support is enabled. (DLR)<br>
|
||||
2006.05.12 - Remove section 4.4, and move all section 4 entries after it up one number, since it no longer applies. Meta-] and Meta-[ are no longer used to indent and unindent marked text, since they require that the bracket matching key change to Ctrl-], which is used as the telnet escape key (found by Chris). Also, make the link to the nano CVS page a bit more readable. (DLR)<br>
|
||||
2006.05.08 - Add a new section 4.5, and move all section 4 entries after it down one number, to explain a problem that can occur when holding down keys to generate Meta sequences. Also add a few more capitalization and wording fixes. (Benno Schulenberg, minor tweaks by DLR)<br>
|
||||
2006.05.01 - Add a new section 4.4, and move all section 4 entries after it down one number, to explain how to deal with problems typing Meta-[. Also add a few capitalization and wording fixes. (DLR)<br>
|
||||
2006.04.14 - Clarify section 1.4: help menu -> help text display. (DLR, suggested by Benno Schulenberg)<br>
|
||||
2006.03.16 - Update the Free Translation Project's address, change the character set to UTF-8, and remove broken links to contributed RedHat nano packages. (DLR)<br>
|
||||
2005.11.21 - Clarify section 5.3 to better explain how to enable Unicode support, and remove the mention of quirks, since they turned out to not be a nano problem. (Mike Frysinger and DLR)<br>
|
||||
2005.11.19 - Add a new section 5.3 to explain the status of nano's Unicode support. (Mike Frysinger, minor tweaks by DLR)<br>
|
||||
2005.08.27 - Update email address. (DLR)<br>
|
||||
2005.08.10 - Add a new section 4.3, and move all section 4 entries after it down one number, to explain how to deal with numeric keypad problems. (DLR)<br>
|
||||
2005.08.08 - Update section 3.8 to mention that verbatim input mode now takes a six-digit hexadecimal number. (DLR)<br>
|
||||
2005.07.04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used. (DLR)<br>
|
||||
2005.06.15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
|
||||
2005.06.13 - Minor capitalization and wording fixes. (DLR)<br>
|
||||
2005.06.08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>
|
||||
2005.03.09 - Added question about opening files with names beginning with '+'s, and added a few more miscellaneous cosmetic fixes. (DLR)<br>
|
||||
2005.01.03 - Removed now-inaccurate note about verbatim input's not working at prompts, and update its description to mention that it handles hexadecimal values now. (DLR)<br>
|
||||
2004.11.21 - Listed sh as an example of a Bourne shell. (DLR)<br>
|
||||
2004.11.05 - Fixed inaccuracy: Pico compatibility mode was made the default in nano 1.1.99pre1, not 1.2.2. Also added question about how to type F13-F16 on terminals lacking keys past F12 (suggested by Chris), question about how to select text for the clipboard in X terminals with nano's mouse support turned on (answer found by Joseph Birthisel), and misc. fixes and link updates. (DLR)<br>
|
||||
2004.04.07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
|
||||
2004.01.30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
|
||||
2003.12.31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<br>
|
||||
2003.07.02 - Added question about nano's not showing color when it's compiled with color support (DLR; suggested by Jordi).<br>
|
||||
2003.02.23 - Updated RPM links for nano 1.2.x (DLR).<br>
|
||||
2003.01.16 - Split section 4.5 into 4.5a and 4.5b for search string behavior. Added --enable-all docs.<br>
|
||||
2002.12.28 - More misc. fixes (David Benbennick, DLR).<br>
|
||||
2002.10.25 - Misc. fixes and link updates (DLR).<br>
|
||||
2002.09.10 - Another typo fix (DLR).<br>
|
||||
2002.05.15 - Typo fix (DLR).<br>
|
||||
2001.12.26 - Misc. fixes (Aaron S. Hawley, DLR).<br>
|
||||
2001.10.02 - Update for Free Translation Project.<br>
|
||||
2001.10.02 - Assorted fixes, Debian additions.<br>
|
||||
2001.06.30 - Silly typo fix.<br>
|
||||
2001.05.05 - Spelling fixes by David Lawrence Ramsey.<br>
|
||||
2001.05.02 - Misc fixes.<br>
|
||||
2001.03.26 - Typo fix in an URL.<br>
|
||||
2001.02.17 - Advocacy updates.<br>
|
||||
2001.02.15 - Added GNU notes for 0.9.99pre3.<br>
|
||||
2001.02.06 - Typo fixes.<br>
|
||||
2001.01.14 - Added note about NumLock glitch.<br>
|
||||
2001.01.10 - Linux -> GNU/Linux.<br>
|
||||
2001.01.09 - Added "making exe smaller" section.<br>
|
||||
2000.12.19 - Typo and assorted error fixes.<br>
|
||||
2000.11.28 - Added blurb about make install-strip.<br>
|
||||
2000.11.19 - Changed Debian frozen to stable.<br>
|
||||
2000.11.18 - Previous string display (4.5).<br>
|
||||
2000.09.27 - Moved addresses to nano-editor.org.<br>
|
||||
2000.06.31 - Initial framework.</p></blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
39
doc/nano.1
39
doc/nano.1
@@ -1,5 +1,4 @@
|
||||
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
.\" 2009, 2010, 2013, 2014 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 1999-2011, 2013-2017 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:
|
||||
@@ -17,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.8.0" "March 2017"
|
||||
.TH NANO 1 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -28,15 +27,14 @@ nano \- Nano's ANOther editor, an enhanced free Pico clone
|
||||
.RI [ options "] [[+" line [, column "]]\ " file "]..."
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBnano\fP is a small, free and friendly editor which aims to replace
|
||||
Pico, the default editor included in the non-free Pine package. On
|
||||
top of copying Pico's look and feel, \fBnano\fP also implements some
|
||||
missing (or disabled by default) features in Pico, such as "search and
|
||||
replace" and "go to line and column number".
|
||||
\fBnano\fP is a small and friendly editor. It copies the look and feel
|
||||
of Pico, but is free software, and implements several features that Pico
|
||||
lacks, such as: opening multiple files, scrolling per line, undo/redo,
|
||||
syntax coloring, line numbering, and soft-wrapping overlong lines.
|
||||
|
||||
When opening a file, the cursor can be put on a specific line by adding
|
||||
the line number with a plus sign (\fB+\fR) before the filename, and even
|
||||
in a specific column by adding it with a comma.
|
||||
When giving a filename on the command line, the cursor can be put on a
|
||||
specific line by adding the line number with a plus sign (\fB+\fR) before
|
||||
the filename, and even in a specific column by adding it with a comma.
|
||||
|
||||
If the first file specified is a dash (\fB\-\fR), \fBnano\fR will read
|
||||
data from standard input.
|
||||
@@ -61,7 +59,7 @@ Since nano-2.7.0, text can also be selected by holding Shift and moving the
|
||||
cursor with the arrow keys. Holding down the Alt key too will increase the
|
||||
stride.
|
||||
.PP
|
||||
The two lines at the bottom of the screen show the most important commands;
|
||||
The two lines at the bottom of the screen show some important commands;
|
||||
the built-in help (\fB^G\fR) lists all the available ones.
|
||||
The default key bindings can be changed via the .nanorc file -- see
|
||||
.BR nanorc (5).
|
||||
@@ -81,7 +79,7 @@ filename suffixed with a tilde (\fB~\fP).
|
||||
.TP
|
||||
.BR \-C\ \fIdirectory\fR ", " \-\-backupdir= \fIdirectory
|
||||
Make and keep not just one backup file, but make and keep a uniquely
|
||||
numbered one every time a file is saved -- when backups are enabled.
|
||||
numbered one every time a file is saved -- when backups are enabled (\fB\-B\fR).
|
||||
The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||
.TP
|
||||
.BR \-D ", " \-\-boldtext
|
||||
@@ -91,10 +89,10 @@ Use bold text instead of reverse video text.
|
||||
Convert typed tabs to spaces.
|
||||
.TP
|
||||
.BR \-F ", " \-\-multibuffer
|
||||
Enable multiple file buffers (if support for them has been compiled in).
|
||||
Read a file into a new buffer by default.
|
||||
.TP
|
||||
.BR \-G ", " \-\-locking
|
||||
Enable vim-style file locking when editing files.
|
||||
Use vim-style file locking when editing files.
|
||||
.TP
|
||||
.BR \-H ", " \-\-historylog
|
||||
Log search and replace strings to \fI~/.nano/search_history\fP, so they can be
|
||||
@@ -115,7 +113,7 @@ Don't add newlines to the ends of files.
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
.BR \-O ", " \-\-morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
.TP
|
||||
.BR \-P ", " \-\-positionlog
|
||||
For the 200 most recent files, log the last position of the cursor,
|
||||
@@ -138,7 +136,7 @@ This restricted mode is also accessible by invoking \fBnano\fP
|
||||
with any name beginning with 'r' (e.g. "rnano").
|
||||
.TP
|
||||
.BR \-S ", " \-\-smooth
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
Use smooth scrolling: text will scroll line-by-line, instead of the
|
||||
usual chunk-by-chunk behavior.
|
||||
.TP
|
||||
.BR \-T\ \fInumber\fR ", " \-\-tabsize= \fInumber
|
||||
@@ -146,7 +144,7 @@ Set the size (width) of a tab to \fInumber\fP columns. The value of
|
||||
\fInumber\fP must be greater than 0. The default value is 8.
|
||||
.TP
|
||||
.BR \-U ", " \-\-quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25. Note that \fB\-c\fP overrides this.
|
||||
.TP
|
||||
.BR \-V ", " \-\-version
|
||||
@@ -166,7 +164,8 @@ Specify the name of the syntax highlighting to use from among the ones
|
||||
defined in the \fInanorc\fP files.
|
||||
.TP
|
||||
.BR \-c ", " \-\-constantshow
|
||||
Constantly show the cursor position. Note that this overrides \fB\-U\fP.
|
||||
Constantly show the cursor position on the status bar.
|
||||
Note that this overrides \fB\-U\fP.
|
||||
.TP
|
||||
.BR \-d ", " \-\-rebinddelete
|
||||
Interpret the Delete key differently so that both Backspace and Delete
|
||||
@@ -301,7 +300,7 @@ Please report any other bugs that you encounter via:
|
||||
\fIhttps://savannah.gnu.org/bugs/?group=nano\fR.
|
||||
|
||||
.SH HOMEPAGE
|
||||
https://nano-editor.org/
|
||||
\fIhttps://nano-editor.org/\fR
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR nanorc (5)
|
||||
|
||||
155
doc/nano.texi
155
doc/nano.texi
@@ -6,8 +6,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.4
|
||||
@set VERSION 2.8.0
|
||||
@set UPDATED March 2017
|
||||
@set VERSION 2.8.5
|
||||
@set UPDATED June 2017
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 2.8.0
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 2.8.5
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -30,8 +30,7 @@ This manual documents GNU @code{nano}, a small and friendly text editor.
|
||||
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp 4
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
2009, 2014, 2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2009, 2014-2017 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:
|
||||
@@ -82,8 +81,9 @@ file locking, backup files, and internationalization support.
|
||||
|
||||
The original goal for @code{nano} was to be a complete bug-for-bug
|
||||
emulation of Pico. But currently the goal is to be as compatible
|
||||
as possible while offering a superset of Pico's functionality. See
|
||||
@xref{Pico Compatibility}, for more info.
|
||||
as possible while offering a superset of Pico's functionality.
|
||||
@xref{Pico Compatibility} for more details on how @code{nano} and
|
||||
Pico differ.
|
||||
|
||||
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
|
||||
|
||||
@@ -108,7 +108,7 @@ adding it with a comma. So a more complete command synopsis is:
|
||||
@end quotation
|
||||
|
||||
Normally, however, you set your preferred options in a @file{.nanorc}
|
||||
file (see @xref{Nanorc Files}). And when using @code{set positionlog}
|
||||
file (@pxref{Nanorc Files}). And when using @code{set positionlog}
|
||||
(making @code{nano} remember the cursor position when you close a file),
|
||||
you will rarely need to specify a line number.
|
||||
|
||||
@@ -183,7 +183,7 @@ Disable automatic conversion of files from DOS/Mac format.
|
||||
|
||||
@item -O
|
||||
@itemx --morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
|
||||
@item -P
|
||||
@itemx --positionlog
|
||||
@@ -220,7 +220,7 @@ Set the displayed tab length to @var{number} columns. The value of
|
||||
|
||||
@item -U
|
||||
@itemx --quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25. Note that option @option{-c}
|
||||
(@option{--constantshow}) overrides this.
|
||||
|
||||
@@ -241,12 +241,13 @@ should be considered as parts of words. This overrides option
|
||||
|
||||
@item -Y @var{name}
|
||||
@itemx --syntax=@var{name}
|
||||
Specify a specific syntax from the nanorc files to use for highlighting.
|
||||
See @xref{Syntax Highlighting}, for more info.
|
||||
Specify the syntax to be used for highlighting.
|
||||
@xref{Syntax Highlighting} for more info.
|
||||
|
||||
@item -c
|
||||
@itemx --constantshow
|
||||
Constantly display the cursor position and line number on the statusbar.
|
||||
Constantly display the cursor position (line number, column number,
|
||||
and character number) on the status bar.
|
||||
Note that this overrides option @option{-U} (@option{--quickblank}).
|
||||
|
||||
@item -d
|
||||
@@ -352,7 +353,7 @@ Don't hard-wrap long lines at any length. This option conflicts with
|
||||
@item -x
|
||||
@itemx --nohelp
|
||||
Expert Mode: don't show the Shortcut List at the bottom of the screen.
|
||||
This affects the location of the statusbar as well, as in Expert Mode it
|
||||
This affects the location of the status bar as well, as in Expert Mode it
|
||||
is located at the very bottom of the editor.
|
||||
|
||||
Note: When accessing the help system, Expert Mode is temporarily
|
||||
@@ -476,21 +477,21 @@ If necessary, it can be toggled off manually with another ^6 or M-A.
|
||||
@section Screen Layout
|
||||
|
||||
The default screen of nano consists of five areas. From top to bottom
|
||||
these are: the titlebar, a blank line, the edit window, the statusbar,
|
||||
these are: the title bar, a blank line, the edit window, the status bar,
|
||||
and two help lines.
|
||||
|
||||
The titlebar consists of
|
||||
The title bar consists of
|
||||
three sections: left, center and right. The section on the left
|
||||
displays the version of @code{nano} being used. The center section
|
||||
displays the current filename, or "New Buffer" if the file has not yet
|
||||
been named. The section on the right displays "Modified" if the
|
||||
file has been modified since it was last saved or opened.
|
||||
|
||||
The statusbar is the third line from the bottom of the screen. It
|
||||
The status bar is the third line from the bottom of the screen. It
|
||||
shows important and informational messages. Any error messages that
|
||||
occur from using the editor will appear on the statusbar. Any questions
|
||||
that are asked of the user will be asked on the statusbar, and any user
|
||||
input (search strings, filenames, etc.) will be input on the statusbar.
|
||||
occur from using the editor will appear on the status bar. Any questions
|
||||
that are asked of the user will be asked on the status bar, and any user
|
||||
input (search strings, filenames, etc.) will be input on the status bar.
|
||||
|
||||
The two help lines at the bottom of the screen show some of the most
|
||||
essential functions of the editor. These two lines are called the
|
||||
@@ -546,7 +547,7 @@ and ^V (Page Down) keys. ^X exits the help system.
|
||||
|
||||
Toggles allow you to change on-the-fly certain aspects of the editor
|
||||
which would normally be specified via command-line options. They are
|
||||
invoked via Meta-key sequences (see @xref{Commands}, for more info).
|
||||
invoked via Meta-key sequences (@pxref{Commands} for more info).
|
||||
The following global toggles are available:
|
||||
|
||||
@table @code
|
||||
@@ -582,8 +583,7 @@ toggles the @code{-N} (@code{--noconvert}) command-line option.
|
||||
toggles the @code{-O} (@code{--morespace}) command-line option.
|
||||
|
||||
@item Whitespace Display Toggle (Meta-P)
|
||||
toggles the whitespace-display mode.
|
||||
See @xref{Whitespace}, for more info.
|
||||
toggles the whitespace-display mode (@pxref{Whitespace}).
|
||||
|
||||
@item Tabs to Spaces Toggle (Meta-Q)
|
||||
toggles the @code{-E} (@code{--tabstospaces}) command-line option.
|
||||
@@ -595,18 +595,18 @@ toggles the @code{-S} (@code{--smooth}) command-line option.
|
||||
toggles the @code{-x} (@code{--nohelp}) command-line option.
|
||||
|
||||
@item Color Syntax Highlighting Toggle (Meta-Y)
|
||||
toggles color syntax highlighting if you have color syntaxes in your
|
||||
nanorc. See @xref{Syntax Highlighting}, for more info.
|
||||
toggles color syntax highlighting (if your nanorc defines syntaxes
|
||||
--- @pxref{Syntax Highlighting}).
|
||||
|
||||
@item Suspension Toggle (Meta-Z)
|
||||
toggles the @code{-z} (@code{--suspend}) command-line option.
|
||||
|
||||
@item Soft Wrapping Toggle (Meta-$)
|
||||
toggles the @code{-$} (@code{--softwrap}) command-line option.
|
||||
|
||||
@item Line Numbers Toggle (Meta-#)
|
||||
toggles the @code{-l} (@code{--linenumbers}) command-line option.
|
||||
|
||||
@item Soft Wrapping Toggle (Meta-$)
|
||||
toggles the @code{-$} (@code{--softwrap}) command-line option.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -622,7 +622,7 @@ from @file{~/.nanorc}.
|
||||
A nanorc file accepts a series of "set" and "unset" commands, which can
|
||||
be used to configure @code{nano} on startup without using command-line
|
||||
options. Additionally, there are some commands to define syntax highlighting
|
||||
and to rebind keys --- @xref{Syntax Highlighting}, and @xref{Rebinding Keys}.
|
||||
and to rebind keys --- @pxref{Syntax Highlighting} and @ref{Rebinding Keys}.
|
||||
@code{nano} will read one command per line.
|
||||
|
||||
Options in nanorc files take precedence over @code{nano}'s defaults, and
|
||||
@@ -672,9 +672,10 @@ The uniquely numbered files are stored in the specified directory.
|
||||
Do backwards searches by default.
|
||||
|
||||
@item set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
and selected text. This can be overridden for the first three by setting
|
||||
the options @code{titlecolor}, @code{statuscolor}, and @code{keycolor}.
|
||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||
line numbers, and selected text. This can be overridden for the first four
|
||||
by setting the options @code{titlecolor}, @code{statuscolor}, @code{keycolor},
|
||||
and @code{numbercolor}.
|
||||
|
||||
@item set brackets "@var{string}"
|
||||
Set the characters treated as closing brackets when justifying
|
||||
@@ -687,7 +688,7 @@ closing brackets, can end sentences. The default value is
|
||||
Do case-sensitive searches by default.
|
||||
|
||||
@item set constantshow
|
||||
Constantly display the cursor position in the status bar.
|
||||
Constantly display the cursor position on the status bar.
|
||||
(The old form of this option, @code{set const}, is deprecated.)
|
||||
|
||||
@item set cut
|
||||
@@ -728,7 +729,7 @@ come before the closing set, and the two sets must be in the same order.
|
||||
The default value is @t{"(<[@{)>]@}"}.
|
||||
|
||||
@item set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
|
||||
@item set mouse
|
||||
Enable mouse support, so that mouse clicks can be used to place the
|
||||
@@ -779,7 +780,7 @@ specified closing punctuation, optionally followed by closing brackets
|
||||
The default value is @t{"!.?"}.
|
||||
|
||||
@item set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
|
||||
@item set quiet
|
||||
@@ -830,7 +831,7 @@ Use spelling checker "spellprog" instead of the built-in one, which
|
||||
calls "spell".
|
||||
|
||||
@item set statuscolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the statusbar.
|
||||
Specify the color combination to use for the status bar.
|
||||
See @code{set titlecolor} for more details.
|
||||
|
||||
@item set suspend
|
||||
@@ -847,7 +848,7 @@ Convert typed tabs to spaces.
|
||||
Save automatically on exit, don't prompt.
|
||||
|
||||
@item set titlecolor @var{fgcolor},@var{bgcolor}
|
||||
Specify the color combination to use for the titlebar.
|
||||
Specify the color combination to use for the title bar.
|
||||
Valid color names for foreground and background are:
|
||||
white, black, blue, green, red, cyan, yellow, and magenta.
|
||||
The name of the foreground color may be prefixed with 'bright'.
|
||||
@@ -893,12 +894,12 @@ via the following commands in a nanorc file:
|
||||
|
||||
@table @code
|
||||
|
||||
@item syntax "str" ["fileregex" @dots{}]
|
||||
Defines a syntax named "str" which can be activated via the @code{-Y/--syntax}
|
||||
@item syntax "name" ["fileregex" @dots{}]
|
||||
Defines a syntax named "name" which can be activated via the @code{-Y/--syntax}
|
||||
command-line option, or will be automatically activated if the current
|
||||
filename matches the extended regular expression "fileregex". All
|
||||
subsequent @code{color}, @code{icolor}, @code{header} and other such
|
||||
statements will apply to this "str" syntax until a new @code{syntax}
|
||||
statements will apply to this "name" syntax until a new @code{syntax}
|
||||
command is encountered.
|
||||
|
||||
The "none" syntax is reserved; specifying it on the command line is the
|
||||
@@ -947,26 +948,26 @@ terminal supports transparency, not specifying a "bgcolor" tells @code{nano}
|
||||
to attempt to use a transparent background.
|
||||
|
||||
@item icolor fgcolor,bgcolor "regex" @dots{}
|
||||
Same as above, except that the text matching is case insensitive.
|
||||
Same as above, except that the matching is case insensitive.
|
||||
|
||||
@item color fgcolor,bgcolor start="sr" end="er"
|
||||
@item color fgcolor,bgcolor start="fromrx" end="torx"
|
||||
Display all pieces of text whose start matches extended regular expression
|
||||
"sr" and whose end matches extended regular expression "er" with foreground
|
||||
color "fgcolor" and background color "bgcolor", at least one of which
|
||||
must be specified. This means that, after an initial instance of "sr",
|
||||
all text will be highlighted until the first instance of "er".
|
||||
"fromrx" and whose end matches extended regular expression "torx" with
|
||||
foreground color "fgcolor" and background color "bgcolor", at least one of
|
||||
which must be specified. This means that, after an initial instance of
|
||||
"fromrx", all text until the first instance of "torx" will be colored.
|
||||
This allows syntax highlighting to span multiple lines.
|
||||
|
||||
@item icolor fgcolor,bgcolor start="sr" end="er"
|
||||
Same as above, except that the text matching is case insensitive.
|
||||
@item icolor fgcolor,bgcolor start="fromrx" end="torx"
|
||||
Same as above, except that the matching is case insensitive.
|
||||
|
||||
@item include "syntaxfile"
|
||||
Read in self-contained color syntaxes from "syntaxfile". Note that
|
||||
"syntaxfile" may contain only the above commands, from @code{syntax}
|
||||
to @code{icolor}.
|
||||
|
||||
@item extendsyntax str directive [arg @dots{}]
|
||||
Extend the syntax previously defined as str to include new information.
|
||||
@item extendsyntax name directive [arg @dots{}]
|
||||
Extend the syntax previously defined as "name" to include new information.
|
||||
This allows you to add a new @code{color}, @code{icolor}, @code{header},
|
||||
@code{magic}, @code{comment}, @code{linter}, or @code{formatter} directive to an already
|
||||
defined syntax --- useful when you want to slightly improve a syntax defined
|
||||
@@ -1271,7 +1272,7 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
|
||||
@item morespace
|
||||
Toggles the presence of the blank line which 'separates' the titlebar from the file text.
|
||||
Toggles the presence of the blank line that 'separates' the title bar from the file text.
|
||||
|
||||
@item smoothscroll
|
||||
Toggles smooth scrolling (when moving around with the arrow keys).
|
||||
@@ -1387,7 +1388,7 @@ searching via ^W (or 'w') and changing directories via ^_ (or 'g'). The
|
||||
behavior of the Enter (or 's') key varies by what is currently selected.
|
||||
If the currently selected object is a directory, the file browser will
|
||||
enter and display the contents of the directory. If the object is a
|
||||
file, this filename and path are copied to the statusbar, and the file
|
||||
file, this filename and path are copied to the status bar, and the file
|
||||
browser exits.
|
||||
|
||||
|
||||
@@ -1419,6 +1420,16 @@ the .nanorc file), @code{nano} will store the position of the cursor
|
||||
when you close a file, and will place the cursor in that position
|
||||
again when you later reopen the file.
|
||||
|
||||
@item Current Cursor Position
|
||||
The output of the "Display Cursor Position" command (^C) displays
|
||||
not only the current line and character position of the cursor,
|
||||
but also (between the two) the current column position.
|
||||
|
||||
@item Spell Checking
|
||||
In the internal spell checker misspelled words are sorted alphabetically
|
||||
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will
|
||||
be prompted for correction separately.
|
||||
|
||||
@item Writing Selected Text to Files
|
||||
When using the Write-Out key (^O), text that has been selected using the
|
||||
marking key (^^) can not just be written out to a new (or existing) file,
|
||||
@@ -1428,6 +1439,13 @@ it can also be appended or prepended to an existing file.
|
||||
When using the Read-File key (^R), @code{nano} can not just read a file,
|
||||
it can also read the output of a command to be run (^X).
|
||||
|
||||
@item Reading from Working Directory
|
||||
By default, Pico will read files from the user's home directory (when
|
||||
using ^R), but it will write files to the current working directory
|
||||
(when using ^O). @code{nano} makes this symmetrical: always reading
|
||||
from and writing to the current working directory --- the directory
|
||||
that @code{nano} was started in.
|
||||
|
||||
@item File Browser
|
||||
In the file browser, @code{nano} does not implement the Add, Copy,
|
||||
Rename, and Delete commands that Pico provides. In @code{nano} the
|
||||
@@ -1437,18 +1455,8 @@ browser is just a file browser, not a file manager.
|
||||
Many options which alter the functionality of the program can be
|
||||
"toggled" on or off using Meta key sequences, meaning the program does
|
||||
not have to be restarted to turn a particular feature on or off.
|
||||
See the internal help function (^G) for a list of features that
|
||||
can be toggled. Or see @xref{Feature Toggles} instead.
|
||||
|
||||
@item Current Cursor Position
|
||||
The output of the "Display Cursor Position" command (^C) displays
|
||||
not only the current line and character position of the cursor,
|
||||
but also (between the two) the current column position.
|
||||
|
||||
@item Spell Checking
|
||||
In the internal spell checker misspelled words are sorted alphabetically
|
||||
and trimmed for uniqueness, such that the words 'apple' and 'Apple' will
|
||||
be prompted for correction separately.
|
||||
@xref{Feature Toggles} for a list of options that can be toggled.
|
||||
Or see the list at the end the main internal help text (^G) instead.
|
||||
|
||||
@end table
|
||||
|
||||
@@ -1473,15 +1481,18 @@ The possible options to @code{./configure} are:
|
||||
@table @code
|
||||
|
||||
@item --disable-browser
|
||||
Disable the mini file browser when reading or writing files.
|
||||
Disable the mini file browser that can be called with ^T when reading
|
||||
or writing files.
|
||||
|
||||
@item --disable-color
|
||||
Disable support for the syntax coloring of files. This also eliminates
|
||||
the @code{-Y} command-line option, which chooses a specific syntax.
|
||||
|
||||
@item --disable-comment
|
||||
Disable the single-keystroke comment/uncomment function (M-3).
|
||||
|
||||
@item --disable-extra
|
||||
Disable extra features. At the moment, this is just easter-egg-type
|
||||
stuff.
|
||||
Disable the Easter egg: a crawl of major contributors.
|
||||
|
||||
@item --disable-help
|
||||
Disable the help function. Doing this makes the binary much smaller,
|
||||
@@ -1503,6 +1514,10 @@ Disable the use of the library of magic-number tests (for determining
|
||||
the file type and thus which syntax to use for colouring --- often the
|
||||
tests on filename extension and header line will be enough).
|
||||
|
||||
@item --disable-linenumbers
|
||||
Disable the line-numbering function (M-#). This also eliminates the
|
||||
@code{-l} command-line option, which turns line numbering on.
|
||||
|
||||
@item --disable-mouse
|
||||
Disable all mouse functionality. This also eliminates the @code{-m}
|
||||
command-line option, which enables the mouse functionality.
|
||||
@@ -1516,7 +1531,7 @@ option, which causes a file to be read into a separate buffer by default.
|
||||
Disable support for reading the nanorc files at startup. With such
|
||||
support, you can store custom settings in a system-wide and a per-user
|
||||
nanorc file rather than having to pass command-line options to get
|
||||
the desired behavior. See @xref{Nanorc Files}, for more info.
|
||||
the desired behavior. @xref{Nanorc Files} for more info.
|
||||
Disabling this also eliminates the @code{-I} and @code{-q} command-line
|
||||
options; the first inhibits the reading of nanorcfiles, and the second
|
||||
suppresses warnings about errors in those files.
|
||||
@@ -1533,7 +1548,7 @@ command-line option, which allows specifying an alternate spell checker.
|
||||
Disable tab completion (when nano asks for a filename or a search string).
|
||||
|
||||
@item --disable-wordcomp
|
||||
Disable word completion.
|
||||
Disable word completion (^]).
|
||||
|
||||
@item --disable-wrapping
|
||||
Disable all hard-wrapping of overlong lines. This also eliminates the
|
||||
|
||||
55
doc/nanorc.5
55
doc/nanorc.5
@@ -1,5 +1,4 @@
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
.\" 2013, 2014, 2015 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 2003-2011, 2013-2017 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:
|
||||
@@ -17,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.8.0" "March 2017"
|
||||
.TH NANORC 5 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
@@ -75,9 +74,10 @@ The uniquely numbered files are stored in the specified \fIdirectory\fR.
|
||||
Do backwards searches by default.
|
||||
.TP
|
||||
.B set boldtext
|
||||
Use bold instead of reverse video for the titlebar, statusbar, key combos,
|
||||
and selected text. This can be overridden for the first three by setting
|
||||
the options \fBtitlecolor\fP, \fBstatuscolor\fP, and \fBkeycolor\fP.
|
||||
Use bold instead of reverse video for the title bar, status bar, key combos,
|
||||
line numbers, and selected text. This can be overridden for the first four
|
||||
by setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP,
|
||||
and \fBnumbercolor\fP.
|
||||
.TP
|
||||
.B set brackets "\fIstring\fP"
|
||||
Set the characters treated as closing brackets when justifying
|
||||
@@ -130,7 +130,7 @@ come before the closing set, and the two sets must be in the same order.
|
||||
The default value is "\fB(<[{)>]}\fP".
|
||||
.TP
|
||||
.B set morespace
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
Use the blank line below the title bar as extra editing space.
|
||||
.TP
|
||||
.B set mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
@@ -183,7 +183,7 @@ specfified closing punctuation, optionally followed by closing brackets
|
||||
(see \fBbrackets\fP), can end sentences. The default value is "\fB!.?\fP".
|
||||
.TP
|
||||
.B set quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
Do quick status-bar blanking: status-bar messages will disappear after 1
|
||||
keystroke instead of 25.
|
||||
.TP
|
||||
.B set quiet
|
||||
@@ -234,7 +234,7 @@ Use spelling checker \fIspellprog\fP instead of the built-in one, which
|
||||
calls \fIspell\fP.
|
||||
.TP
|
||||
.B set statuscolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the statusbar.
|
||||
Specify the color combination to use for the status bar.
|
||||
See \fBset titlecolor\fR for more details.
|
||||
.TP
|
||||
.B set suspend
|
||||
@@ -251,7 +251,7 @@ Convert typed tabs to spaces.
|
||||
Save automatically on exit, don't prompt.
|
||||
.TP
|
||||
.B set titlecolor \fIfgcolor\fR,\fIbgcolor\fR
|
||||
Specify the color combination to use for the titlebar.
|
||||
Specify the color combination to use for the title bar.
|
||||
Valid names for the foreground and background colors are:
|
||||
.BR white ", " black ", " blue ", " green ", " red ", " cyan ", " yellow ", and " magenta .
|
||||
The name of the foreground color may be prefixed with \fBbright\fR.
|
||||
@@ -289,14 +289,14 @@ good fit for a small editor like \fBnano\fR.
|
||||
A separate syntax can be defined for each kind of file
|
||||
via the following commands:
|
||||
.TP
|
||||
.BR syntax " ""\fIstr\fR"" [""\fIfileregex\fR"" ...]"
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
.BR syntax " ""\fIname\fR"" [""\fIfileregex\fR"" ...]"
|
||||
Defines a syntax named \fIname\fP which can be activated via the
|
||||
.BR \-Y / \-\-syntax
|
||||
command-line option, or will be automatically activated if
|
||||
the current filename matches the extended regular expression
|
||||
\fIfileregex\fP. All subsequent \fBcolor\fR, \fBicolor\fR,
|
||||
\fBheader\fR and other such statements will apply to this
|
||||
\fIstr\fP syntax until a new \fBsyntax\fR command is encountered.
|
||||
\fIname\fP syntax until a new \fBsyntax\fR command is encountered.
|
||||
|
||||
The \fBnone\fP syntax is reserved; specifying it on the command line is
|
||||
the same as not having a syntax at all. The \fBdefault\fP syntax is
|
||||
@@ -346,32 +346,33 @@ foreground. If your terminal supports transparency, not specifying a
|
||||
background.
|
||||
.TP
|
||||
.B icolor \fIfgcolor\fR,\fIbgcolor\fR """\fIregex\fR""" ...
|
||||
Same as above, except that the text matching is case insensitive.
|
||||
Same as above, except that the matching is case insensitive.
|
||||
.TP
|
||||
.BR color " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIsr\fR"" " end= """\fIer\fR""
|
||||
.BR color " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIfromrx\fR"" " end= """\fItorx\fR""
|
||||
Display all pieces of text whose start matches extended regular expression
|
||||
\fIsr\fP and whose end matches extended regular expression \fIer\fP with
|
||||
\fIfromrx\fP and whose end matches extended regular expression \fItorx\fP with
|
||||
foreground color \fIfgcolor\fP and background color \fIbgcolor\fP,
|
||||
at least one of which must be specified. This means that, after an
|
||||
initial instance of \fIsr\fP, all text will be highlighted until the
|
||||
first instance of \fIer\fP. This allows syntax highlighting to span
|
||||
initial instance of \fIfromrx\fP, all text until the first instance of
|
||||
\fItorx\fP will be colored. This allows syntax highlighting to span
|
||||
multiple lines.
|
||||
.TP
|
||||
.BR icolor " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIsr\fR"" " end= """\fIer\fR""
|
||||
Same as above, except that the text matching is case insensitive.
|
||||
.BR icolor " \fIfgcolor\fR,\fIbgcolor\fR " start= """\fIfromrx\fR"" " end= """\fItorx\fR""
|
||||
Same as above, except that the matching is case insensitive.
|
||||
.TP
|
||||
.BR include " ""\fIsyntaxfile\fR"""
|
||||
Read in self-contained color syntaxes from \fIsyntaxfile\fP. Note that
|
||||
\fIsyntaxfile\fP may contain only the above commands, from \fBsyntax\fP
|
||||
to \fBicolor\fP.
|
||||
.TP
|
||||
.BI extendsyntax " str directive " \fR[ "arg " \fR...]
|
||||
Extend the syntax previously defined as \fIstr\fP to include
|
||||
new information. This allows you to add a new \fBcolor\fP, \fBicolor\fP,
|
||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBformatter\fP directive
|
||||
to an already defined syntax -- useful when you want to
|
||||
.BI extendsyntax " name directive " \fR[ "arg " \fR...]
|
||||
Extend the syntax previously defined as \fIname\fP to include
|
||||
new information. This allows adding a new \fBcolor\fP, \fBicolor\fP,
|
||||
\fBheader\fP, \fBmagic\fP, \fBcomment\fP, \fBlinter\fP, or \fBformatter\fP
|
||||
directive to an already defined syntax -- useful when you want to
|
||||
slightly improve a syntax defined in one of the system-installed
|
||||
files (which are normally not writable)
|
||||
files (which are normally not writable).
|
||||
|
||||
.SH REBINDING KEYS
|
||||
Key bindings can be changed via the following two commands:
|
||||
.TP
|
||||
@@ -665,7 +666,7 @@ Toggles the presence of the two-line list of key bindings at the bottom of the s
|
||||
Toggles the constant display of the current line, column, and character positions.
|
||||
.TP
|
||||
.B morespace
|
||||
Toggles the presence of the blank line which 'separates' the titlebar from the file text.
|
||||
Toggles the presence of the blank line that 'separates' the title bar from the file text.
|
||||
.TP
|
||||
.B smoothscroll
|
||||
Toggles smooth scrolling (when moving around with the arrow keys).
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.8.0" "March 2017"
|
||||
.TH RNANO 1 "version 2.8.5" "June 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
## Do case-sensitive searches by default.
|
||||
# set casesensitive
|
||||
|
||||
## Constantly display the cursor position in the statusbar. Note that
|
||||
## Constantly display the cursor position in the status bar. Note that
|
||||
## this overrides "quickblank".
|
||||
# set constantshow
|
||||
## (The old form, 'const', is deprecated.)
|
||||
@@ -76,7 +76,7 @@
|
||||
## come before the latter set, and both must be in the same order.
|
||||
# set matchbrackets "(<[{)>]}"
|
||||
|
||||
## Use the blank line below the titlebar as extra editing space.
|
||||
## Use the blank line below the title bar as extra editing space.
|
||||
# set morespace
|
||||
|
||||
## Enable mouse support, if available for your system. When enabled,
|
||||
@@ -124,7 +124,7 @@
|
||||
## sentences.
|
||||
# set punct "!.?"
|
||||
|
||||
## Do quick statusbar blanking. Statusbar messages will disappear after
|
||||
## Do quick status-bar blanking. Status-bar messages will disappear after
|
||||
## 1 keystroke instead of 26. Note that "const" overrides this.
|
||||
# set quickblank
|
||||
|
||||
|
||||
1185
po/nano.pot
1185
po/nano.pot
File diff suppressed because it is too large
Load Diff
1096
po/pt_BR.po
1096
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1091
po/zh_CN.po
1091
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1091
po/zh_TW.po
1091
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -4,7 +4,7 @@ AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\" \
|
||||
CLEANFILES = revision.h
|
||||
|
||||
if BUILDING_FROM_GIT
|
||||
SOMETHING = "REVISION \"$(shell git describe --tags 2>/dev/null)\""
|
||||
SOMETHING = "REVISION \"`git describe --tags 2>/dev/null`\""
|
||||
else
|
||||
SOMETHING = "NOTHING \"from tarball\""
|
||||
endif
|
||||
@@ -12,12 +12,13 @@ endif
|
||||
nano.o: revision.h
|
||||
winio.o: revision.h
|
||||
|
||||
revision.h: update_revision
|
||||
# Always run the commands in this rule. But update the target
|
||||
# only when the revision actually changed.
|
||||
revision.h: FORCE
|
||||
@[ -f $@ ] || touch $@
|
||||
@echo "#define $(SOMETHING)" | cmp -s $@ - || \
|
||||
echo "#define $(SOMETHING)" > $@
|
||||
|
||||
.PHONY: update_revision
|
||||
echo "#define $(SOMETHING)" > $@
|
||||
FORCE:
|
||||
|
||||
bin_PROGRAMS = nano
|
||||
nano_SOURCES = browser.c \
|
||||
@@ -38,7 +39,7 @@ nano_SOURCES = browser.c \
|
||||
utils.c \
|
||||
winio.c
|
||||
|
||||
nano_LDADD = @LIBINTL@ $(top_builddir)/lib/libgnu.a
|
||||
nano_LDADD = @LIBINTL@ $(top_builddir)/lib/libgnu.a $(LIB_CLOCK_GETTIME)
|
||||
|
||||
install-exec-hook:
|
||||
cd $(DESTDIR)$(bindir) && rm -f rnano && $(LN_S) nano rnano
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* browser.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -28,7 +27,7 @@
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
|
||||
static char **filelist = NULL;
|
||||
/* The list of files to display in the file browser. */
|
||||
@@ -123,7 +122,7 @@ char *do_browser(char *path)
|
||||
|
||||
kbinput = get_kbinput(edit);
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
if (kbinput == KEY_MOUSE) {
|
||||
int mouse_x, mouse_y;
|
||||
|
||||
@@ -152,7 +151,7 @@ char *do_browser(char *path)
|
||||
|
||||
continue;
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
#endif /* ENABLE_MOUSE */
|
||||
|
||||
func = parse_browser_input(&kbinput);
|
||||
|
||||
@@ -163,7 +162,7 @@ char *do_browser(char *path)
|
||||
kbinput = KEY_WINCH;
|
||||
#endif
|
||||
} else if (func == do_help_void) {
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
do_help_void();
|
||||
#ifndef NANO_TINY
|
||||
/* The window dimensions might have changed, so act as if. */
|
||||
@@ -184,20 +183,29 @@ char *do_browser(char *path)
|
||||
} else if (func == do_right) {
|
||||
if (selected < filelist_len - 1)
|
||||
selected++;
|
||||
#ifndef NANO_TINY
|
||||
} else if (func == do_prev_word_void) {
|
||||
selected -= (selected % width);
|
||||
} else if (func == do_next_word_void) {
|
||||
selected += width - 1 - (selected % width);
|
||||
if (selected >= filelist_len)
|
||||
selected = filelist_len - 1;
|
||||
#endif
|
||||
} else if (func == do_up_void) {
|
||||
if (selected >= width)
|
||||
selected -= width;
|
||||
} else if (func == do_down_void) {
|
||||
if (selected + width <= filelist_len - 1)
|
||||
selected += width;
|
||||
} else if (func == do_prev_block) {
|
||||
selected = ((selected / (editwinrows * width)) *
|
||||
editwinrows * width) + selected % width;
|
||||
} else if (func == do_next_block) {
|
||||
selected = ((selected / (editwinrows * width)) *
|
||||
editwinrows * width) + selected % width +
|
||||
editwinrows * width - width;
|
||||
if (selected >= filelist_len)
|
||||
selected = (filelist_len / width) * width + selected % width;
|
||||
if (selected >= filelist_len)
|
||||
selected -= width;
|
||||
} else if (func == do_page_up) {
|
||||
if (selected < width)
|
||||
selected = 0;
|
||||
@@ -480,7 +488,11 @@ functionptrtype parse_browser_input(int *kbinput)
|
||||
return do_enter;
|
||||
case 'W':
|
||||
case 'w':
|
||||
case '/':
|
||||
return do_search;
|
||||
case 'N':
|
||||
case 'n':
|
||||
return do_research;
|
||||
}
|
||||
}
|
||||
return func_from_key(kbinput);
|
||||
@@ -798,4 +810,4 @@ char *strip_last_component(const char *path)
|
||||
return copy;
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif /* ENABLE_BROWSER */
|
||||
|
||||
242
src/chars.c
242
src/chars.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* chars.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -71,13 +70,11 @@ void mbtowc_reset(void)
|
||||
/* This function is equivalent to isalpha() for multibyte characters. */
|
||||
bool is_alpha_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 0;
|
||||
}
|
||||
@@ -91,13 +88,11 @@ bool is_alpha_mbchar(const char *c)
|
||||
/* This function is equivalent to isalnum() for multibyte characters. */
|
||||
bool is_alnum_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 0;
|
||||
}
|
||||
@@ -111,13 +106,11 @@ bool is_alnum_mbchar(const char *c)
|
||||
/* This function is equivalent to isblank() for multibyte characters. */
|
||||
bool is_blank_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 0;
|
||||
}
|
||||
@@ -159,13 +152,11 @@ bool is_cntrl_mbchar(const char *c)
|
||||
/* This function is equivalent to ispunct() for multibyte characters. */
|
||||
bool is_punct_mbchar(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 0;
|
||||
}
|
||||
@@ -188,7 +179,7 @@ bool is_word_mbchar(const char *c, bool allow_punct)
|
||||
return TRUE;
|
||||
|
||||
if (word_chars != NULL && *word_chars != '\0') {
|
||||
char symbol[mb_cur_max() + 1];
|
||||
char symbol[MAXCHARLEN + 1];
|
||||
int symlen = parse_mbchar(c, symbol, NULL);
|
||||
|
||||
symbol[symlen] = '\0';
|
||||
@@ -235,12 +226,10 @@ char control_mbrep(const char *c, bool isdata)
|
||||
* return the number of columns that the character occupies. */
|
||||
int length_of_char(const char *c, int *width)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
int charlen = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
int charlen = mbtowc(&wc, c, MAXCHARLEN);
|
||||
|
||||
/* If the sequence is invalid... */
|
||||
if (charlen < 0) {
|
||||
@@ -266,14 +255,12 @@ int length_of_char(const char *c, int *width)
|
||||
/* This function is equivalent to wcwidth() for multibyte characters. */
|
||||
int mbwidth(const char *c)
|
||||
{
|
||||
assert(c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
int width;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 1;
|
||||
}
|
||||
@@ -289,17 +276,6 @@ int mbwidth(const char *c)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return the maximum length (in bytes) of a character. */
|
||||
int mb_cur_max(void)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8)
|
||||
return MB_CUR_MAX;
|
||||
else
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Convert the Unicode value in chr to a multibyte character, if possible.
|
||||
* If the conversion succeeds, return the (dynamically allocated) multibyte
|
||||
* character and its length. Otherwise, return an undefined (dynamically
|
||||
@@ -310,7 +286,7 @@ char *make_mbchar(long chr, int *chr_mb_len)
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
chr_mb = charalloc(MB_CUR_MAX);
|
||||
chr_mb = charalloc(MAXCHARLEN);
|
||||
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
@@ -333,14 +309,10 @@ char *make_mbchar(long chr, int *chr_mb_len)
|
||||
* col isn't NULL, add the character's width (in columns) to it. */
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
{
|
||||
int length;
|
||||
|
||||
assert(buf != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
length = mblen(buf, MB_CUR_MAX);
|
||||
int length = mblen(buf, MAXCHARLEN);
|
||||
|
||||
/* When the multibyte sequence is invalid, only take the first byte. */
|
||||
if (length <= 0) {
|
||||
@@ -370,12 +342,11 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
} else
|
||||
*col += mbwidth(buf);
|
||||
}
|
||||
|
||||
return length;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* A byte character is one byte long. */
|
||||
length = 1;
|
||||
|
||||
/* When requested, store the byte character in chr. */
|
||||
if (chr != NULL)
|
||||
*chr = *buf;
|
||||
@@ -394,33 +365,48 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
else
|
||||
(*col)++;
|
||||
}
|
||||
}
|
||||
|
||||
return length;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
* before the one at pos. */
|
||||
size_t move_mbleft(const char *buf, size_t pos)
|
||||
{
|
||||
size_t before, char_len = 0;
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
size_t before, char_len = 0;
|
||||
|
||||
assert(buf != NULL && pos <= strlen(buf));
|
||||
if (pos < 4)
|
||||
before = 0;
|
||||
else {
|
||||
const char *ptr = buf + pos;
|
||||
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. So we just start groping for one at the farthest
|
||||
* possible point. */
|
||||
if (mb_cur_max() > pos)
|
||||
before = 0;
|
||||
else
|
||||
before = pos - mb_cur_max();
|
||||
/* Probe for a valid starter byte in the preceding four bytes. */
|
||||
if ((signed char)*(--ptr) > -65)
|
||||
before = pos - 1;
|
||||
else if ((signed char)*(--ptr) > -65)
|
||||
before = pos - 2;
|
||||
else if ((signed char)*(--ptr) > -65)
|
||||
before = pos - 3;
|
||||
else if ((signed char)*(--ptr) > -65)
|
||||
before = pos - 4;
|
||||
else
|
||||
before = pos - 1;
|
||||
}
|
||||
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
}
|
||||
/* Move forward again until we reach the original character,
|
||||
* so we know the length of its preceding the character. */
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
before += char_len;
|
||||
}
|
||||
|
||||
return before - char_len;
|
||||
return before - char_len;
|
||||
} else
|
||||
#endif
|
||||
return (pos == 0 ? 0 : pos - 1);
|
||||
}
|
||||
|
||||
/* Return the index in buf of the beginning of the multibyte character
|
||||
@@ -446,12 +432,12 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
while (*s1 != '\0' && *s2 != '\0' && n > 0) {
|
||||
bool bad1 = FALSE, bad2 = FALSE;
|
||||
|
||||
if (mbtowc(&wc1, s1, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc1, s1, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
bad1 = TRUE;
|
||||
}
|
||||
|
||||
if (mbtowc(&wc2, s2, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc2, s2, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
bad2 = TRUE;
|
||||
}
|
||||
@@ -485,12 +471,7 @@ char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
size_t needle_len;
|
||||
|
||||
if (*needle == '\0')
|
||||
return (char *)haystack;
|
||||
|
||||
needle_len = mbstrlen(needle);
|
||||
size_t needle_len = mbstrlen(needle);
|
||||
|
||||
while (*haystack != '\0') {
|
||||
if (mbstrncasecmp(haystack, needle, needle_len) == 0)
|
||||
@@ -506,19 +487,13 @@ char *mbstrcasestr(const char *haystack, const char *needle)
|
||||
}
|
||||
|
||||
/* This function is equivalent to strstr(), except in that it scans the
|
||||
* string in reverse, starting at rev_start. */
|
||||
* string in reverse, starting at pointer. */
|
||||
char *revstrstr(const char *haystack, const char *needle,
|
||||
const char *pointer)
|
||||
{
|
||||
size_t needle_len = strlen(needle);
|
||||
size_t tail_len = strlen(pointer);
|
||||
|
||||
if (needle_len == 0)
|
||||
return (char *)pointer;
|
||||
|
||||
if (strlen(haystack) < needle_len)
|
||||
return NULL;
|
||||
|
||||
if (tail_len < needle_len)
|
||||
pointer += tail_len - needle_len;
|
||||
|
||||
@@ -532,65 +507,53 @@ char *revstrstr(const char *haystack, const char *needle,
|
||||
}
|
||||
|
||||
/* This function is equivalent to strcasestr(), except in that it scans
|
||||
* the string in reverse, starting at rev_start. */
|
||||
char *revstrcasestr(const char *haystack, const char *needle, const char
|
||||
*rev_start)
|
||||
* the string in reverse, starting at pointer. */
|
||||
char *revstrcasestr(const char *haystack, const char *needle,
|
||||
const char *pointer)
|
||||
{
|
||||
size_t rev_start_len, needle_len;
|
||||
size_t needle_len = strlen(needle);
|
||||
size_t tail_len = strlen(pointer);
|
||||
|
||||
if (*needle == '\0')
|
||||
return (char *)rev_start;
|
||||
if (tail_len < needle_len)
|
||||
pointer += tail_len - needle_len;
|
||||
|
||||
needle_len = strlen(needle);
|
||||
|
||||
if (strlen(haystack) < needle_len)
|
||||
return NULL;
|
||||
|
||||
rev_start_len = strlen(rev_start);
|
||||
|
||||
for (; rev_start >= haystack; rev_start--, rev_start_len++) {
|
||||
if (rev_start_len >= needle_len && strncasecmp(rev_start,
|
||||
needle, needle_len) == 0)
|
||||
return (char *)rev_start;
|
||||
while (pointer >= haystack) {
|
||||
if (strncasecmp(pointer, needle, needle_len) == 0)
|
||||
return (char *)pointer;
|
||||
pointer--;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This function is equivalent to strcasestr() for multibyte strings,
|
||||
* except in that it scans the string in reverse, starting at rev_start. */
|
||||
char *mbrevstrcasestr(const char *haystack, const char *needle, const
|
||||
char *rev_start)
|
||||
* except in that it scans the string in reverse, starting at pointer. */
|
||||
char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
const char *pointer)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
size_t rev_start_len, needle_len;
|
||||
size_t needle_len = mbstrlen(needle);
|
||||
size_t tail_len = mbstrlen(pointer);
|
||||
|
||||
if (*needle == '\0')
|
||||
return (char *)rev_start;
|
||||
if (tail_len < needle_len)
|
||||
pointer += tail_len - needle_len;
|
||||
|
||||
needle_len = mbstrlen(needle);
|
||||
|
||||
if (mbstrlen(haystack) < needle_len)
|
||||
if (pointer < haystack)
|
||||
return NULL;
|
||||
|
||||
rev_start_len = mbstrlen(rev_start);
|
||||
|
||||
while (TRUE) {
|
||||
if (rev_start_len >= needle_len &&
|
||||
mbstrncasecmp(rev_start, needle, needle_len) == 0)
|
||||
return (char *)rev_start;
|
||||
if (mbstrncasecmp(pointer, needle, needle_len) == 0)
|
||||
return (char *)pointer;
|
||||
|
||||
/* If we've reached the head of the haystack, we found nothing. */
|
||||
if (rev_start == haystack)
|
||||
if (pointer == haystack)
|
||||
return NULL;
|
||||
|
||||
rev_start = haystack + move_mbleft(haystack, rev_start - haystack);
|
||||
rev_start_len++;
|
||||
pointer = haystack + move_mbleft(haystack, pointer - haystack);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
return revstrcasestr(haystack, needle, rev_start);
|
||||
return revstrcasestr(haystack, needle, pointer);
|
||||
}
|
||||
|
||||
/* This function is equivalent to strlen() for multibyte strings. */
|
||||
@@ -620,16 +583,14 @@ size_t mbstrnlen(const char *s, size_t maxlen)
|
||||
/* This function is equivalent to strchr() for multibyte strings. */
|
||||
char *mbstrchr(const char *s, const char *c)
|
||||
{
|
||||
assert(s != NULL && c != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
|
||||
char symbol[MB_CUR_MAX];
|
||||
char symbol[MAXCHARLEN];
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
wc = (unsigned char)*c;
|
||||
bad_c_mb = TRUE;
|
||||
@@ -678,59 +639,54 @@ char *mbstrpbrk(const char *s, const char *accept)
|
||||
return (char *) strpbrk(s, accept);
|
||||
}
|
||||
|
||||
/* This function is equivalent to strpbrk(), except in that it scans the
|
||||
* string in reverse, starting at rev_start. */
|
||||
char *revstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start)
|
||||
/* Locate, in the string that starts at head, the first occurrence of any of
|
||||
* the characters in the string accept, starting from pointer and searching
|
||||
* backwards. */
|
||||
char *revstrpbrk(const char *head, const char *accept, const char *pointer)
|
||||
{
|
||||
assert(s != NULL && accept != NULL && rev_start != NULL);
|
||||
|
||||
if (*rev_start == '\0') {
|
||||
if (rev_start == s)
|
||||
if (*pointer == '\0') {
|
||||
if (pointer == head)
|
||||
return NULL;
|
||||
rev_start--;
|
||||
pointer--;
|
||||
}
|
||||
|
||||
for (; rev_start >= s; rev_start--) {
|
||||
if (strchr(accept, *rev_start) != NULL)
|
||||
return (char *)rev_start;
|
||||
while (pointer >= head) {
|
||||
if (strchr(accept, *pointer) != NULL)
|
||||
return (char *)pointer;
|
||||
pointer--;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This function is equivalent to strpbrk() for multibyte strings,
|
||||
* except in that it scans the string in reverse, starting at rev_start. */
|
||||
char *mbrevstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start)
|
||||
/* The same as the preceding function but then for multibyte strings. */
|
||||
char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer)
|
||||
{
|
||||
assert(s != NULL && accept != NULL && rev_start != NULL);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
if (*rev_start == '\0') {
|
||||
if (rev_start == s)
|
||||
if (*pointer == '\0') {
|
||||
if (pointer == head)
|
||||
return NULL;
|
||||
rev_start = s + move_mbleft(s, rev_start - s);
|
||||
pointer = head + move_mbleft(head, pointer - head);
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
if (mbstrchr(accept, rev_start) != NULL)
|
||||
return (char *)rev_start;
|
||||
if (mbstrchr(accept, pointer) != NULL)
|
||||
return (char *)pointer;
|
||||
|
||||
/* If we've reached the head of the string, we found nothing. */
|
||||
if (rev_start == s)
|
||||
if (pointer == head)
|
||||
return NULL;
|
||||
|
||||
rev_start = s + move_mbleft(s, rev_start - s);
|
||||
pointer = head + move_mbleft(head, pointer - head);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
return revstrpbrk(s, accept, rev_start);
|
||||
return revstrpbrk(head, accept, pointer);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
/* Return TRUE if the string s contains one or more blank characters,
|
||||
* and FALSE otherwise. */
|
||||
bool has_blank_chars(const char *s)
|
||||
@@ -749,7 +705,7 @@ bool has_blank_mbchars(const char *s)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
char symbol[MB_CUR_MAX];
|
||||
char symbol[MAXCHARLEN];
|
||||
|
||||
for (; *s != '\0'; s += move_mbright(s, 0)) {
|
||||
parse_mbchar(s, symbol, NULL);
|
||||
@@ -763,7 +719,7 @@ bool has_blank_mbchars(const char *s)
|
||||
#endif
|
||||
return has_blank_chars(s);
|
||||
}
|
||||
#endif /* !DISABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
|
||||
#endif /* ENABLE_NANORC && (!NANO_TINY || !DISABLE_JUSTIFY) */
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Return TRUE if wc is valid Unicode, and FALSE otherwise. */
|
||||
@@ -776,7 +732,7 @@ bool is_valid_unicode(wchar_t wc)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Check if the string s is a valid multibyte string. Return TRUE if it
|
||||
* is, and FALSE otherwise. */
|
||||
bool is_valid_mbstring(const char *s)
|
||||
@@ -788,4 +744,4 @@ bool is_valid_mbstring(const char *s)
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* color.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016, 2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -133,6 +132,8 @@ void color_init(void)
|
||||
fprintf(stderr, "init_pair(): fg = %hd, bg = %hd\n", foreground, background);
|
||||
#endif
|
||||
}
|
||||
|
||||
have_palette = TRUE;
|
||||
}
|
||||
|
||||
/* Try to match the given shibboleth string with one of the regexes in
|
||||
|
||||
21
src/cut.c
21
src/cut.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* cut.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014 Mark Majeres *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
@@ -109,8 +108,8 @@ void cut_to_eof(void)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. If
|
||||
* copy_text is TRUE, copy the text back into the filestruct afterward.
|
||||
/* Move text from the current buffer into the cutbuffer. If
|
||||
* copy_text is TRUE, copy the text back into the buffer afterward.
|
||||
* If cut_till_eof is TRUE, move all text from the current cursor
|
||||
* position to the end of the file into the cutbuffer. */
|
||||
void do_cut_text(bool copy_text, bool cut_till_eof)
|
||||
@@ -202,7 +201,7 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
/* Move text from the current buffer into the cutbuffer. */
|
||||
void do_cut_text_void(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
@@ -215,8 +214,8 @@ void do_cut_text_void(void)
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Move text from the current filestruct into the cutbuffer, and copy it
|
||||
* back into the filestruct afterward. If the mark is set or the cursor
|
||||
/* Move text from the current buffer into the cutbuffer, and copy it
|
||||
* back into the buffer afterward. If the mark is set or the cursor
|
||||
* was moved, blow away previous contents of the cutbuffer. */
|
||||
void do_copy_text(void)
|
||||
{
|
||||
@@ -255,7 +254,7 @@ void do_cut_till_eof(void)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Copy text from the cutbuffer into the current filestruct. */
|
||||
/* Copy text from the cutbuffer into the current buffer. */
|
||||
void do_uncut_text(void)
|
||||
{
|
||||
ssize_t was_lineno = openfile->current->lineno;
|
||||
@@ -274,7 +273,7 @@ void do_uncut_text(void)
|
||||
was_leftedge = (xplustabs() / editwincols) * editwincols;
|
||||
#endif
|
||||
|
||||
/* Add a copy of the text in the cutbuffer to the current filestruct
|
||||
/* Add a copy of the text in the cutbuffer to the current buffer
|
||||
* at the current cursor position. */
|
||||
copy_from_buffer(cutbuffer);
|
||||
|
||||
@@ -292,8 +291,8 @@ void do_uncut_text(void)
|
||||
/* Mark the file as modified. */
|
||||
set_modified();
|
||||
|
||||
/* Update the cursor position to account for the inserted lines. */
|
||||
reset_cursor();
|
||||
/* Update current_y to account for the inserted lines. */
|
||||
place_the_cursor(TRUE);
|
||||
|
||||
refresh_needed = TRUE;
|
||||
|
||||
|
||||
221
src/files.c
221
src/files.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* files.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -63,32 +62,29 @@ bool has_valid_path(const char *filename)
|
||||
return validity;
|
||||
}
|
||||
|
||||
/* Add an entry to the circular list of openfile structs. */
|
||||
/* Add an item to the circular list of openfile structs. */
|
||||
void make_new_buffer(void)
|
||||
{
|
||||
openfilestruct *newnode = make_new_opennode();
|
||||
|
||||
if (openfile == NULL) {
|
||||
openfile = make_new_opennode();
|
||||
|
||||
/* Make the first open file the only element in the list. */
|
||||
openfile->prev = openfile;
|
||||
openfile->next = openfile;
|
||||
newnode->prev = newnode;
|
||||
newnode->next = newnode;
|
||||
} else {
|
||||
openfilestruct *newnode = make_new_opennode();
|
||||
|
||||
/* Add the new open file after the current one in the list. */
|
||||
newnode->prev = openfile;
|
||||
newnode->next = openfile->next;
|
||||
openfile->next->prev = newnode;
|
||||
openfile->next = newnode;
|
||||
|
||||
/* Make the new file the current one. */
|
||||
openfile = newnode;
|
||||
|
||||
/* There is more than one file open: show Close in help lines. */
|
||||
/* There is more than one file open: show "Close" in help lines. */
|
||||
exitfunc->desc = close_tag;
|
||||
}
|
||||
|
||||
/* Start initializing the new buffer. */
|
||||
/* Make the new buffer the current one, and start initializing it. */
|
||||
openfile = newnode;
|
||||
|
||||
openfile->filename = mallocstrcpy(NULL, "");
|
||||
|
||||
initialize_buffer_text();
|
||||
@@ -118,11 +114,9 @@ void make_new_buffer(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Initialize the text of the current openfile struct. */
|
||||
/* Initialize the text and pointers of the current openfile struct. */
|
||||
void initialize_buffer_text(void)
|
||||
{
|
||||
assert(openfile != NULL);
|
||||
|
||||
openfile->fileage = make_new_node(NULL);
|
||||
openfile->fileage->data = mallocstrcpy(NULL, "");
|
||||
|
||||
@@ -471,12 +465,12 @@ bool open_buffer(const char *filename, bool undoable)
|
||||
if (new_buffer) {
|
||||
make_new_buffer();
|
||||
|
||||
if (has_valid_path(realname)) {
|
||||
if (!inhelp && has_valid_path(realname)) {
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && filename[0] != '\0') {
|
||||
/* When not overriding an existing lock, discard the buffer. */
|
||||
if (do_lockfile(realname) < 0) {
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
close_buffer();
|
||||
#endif
|
||||
free(realname);
|
||||
@@ -490,7 +484,7 @@ bool open_buffer(const char *filename, bool undoable)
|
||||
/* If the filename isn't blank, and we are not in NOREAD_MODE,
|
||||
* open the file. Otherwise, treat it as a new file. */
|
||||
rc = (filename[0] != '\0' && !ISSET(NOREAD_MODE)) ?
|
||||
open_file(realname, new_buffer, FALSE, &f) : -2;
|
||||
open_file(realname, new_buffer, inhelp, &f) : -2;
|
||||
|
||||
/* If we have a file, and we're loading into a new buffer, update
|
||||
* the filename. */
|
||||
@@ -584,31 +578,29 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
|
||||
if (!old_no_newlines)
|
||||
UNSET(NO_NEWLINES);
|
||||
}
|
||||
#endif /* !ENABLE_TINY */
|
||||
#endif /* !NANO_TINY */
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
|
||||
/* Update the screen to account for the current buffer. */
|
||||
void display_buffer(void)
|
||||
/* Update the titlebar and the multiline cache to match the current buffer. */
|
||||
void prepare_for_display(void)
|
||||
{
|
||||
/* Update the titlebar, since the filename may have changed. */
|
||||
titlebar(NULL);
|
||||
if (!inhelp)
|
||||
titlebar(NULL);
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
/* Make sure we're using the buffer's associated colors. */
|
||||
color_init();
|
||||
|
||||
/* If there are multiline coloring regexes, and there is no
|
||||
* multiline cache data yet, precalculate it now. */
|
||||
if (openfile->syntax && openfile->syntax->nmultis > 0 &&
|
||||
openfile->fileage->multidata == NULL)
|
||||
precalc_multicolorinfo();
|
||||
#endif
|
||||
|
||||
/* Update the content of the edit window straightaway. */
|
||||
edit_refresh();
|
||||
have_palette = FALSE;
|
||||
#endif
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* Switch to a neighbouring file buffer; to the next if to_next is TRUE;
|
||||
* otherwise, to the previous one. */
|
||||
void switch_to_prevnext_buffer(bool to_next)
|
||||
@@ -616,7 +608,7 @@ void switch_to_prevnext_buffer(bool to_next)
|
||||
assert(openfile != NULL);
|
||||
|
||||
/* If only one file buffer is open, say so and get out. */
|
||||
if (openfile == openfile->next) {
|
||||
if (openfile == openfile->next && !inhelp) {
|
||||
statusbar(_("No more open file buffers"));
|
||||
return;
|
||||
}
|
||||
@@ -636,13 +628,14 @@ void switch_to_prevnext_buffer(bool to_next)
|
||||
openfile->firstcolumn = 0;
|
||||
#endif
|
||||
|
||||
/* Update the screen to account for the current buffer. */
|
||||
display_buffer();
|
||||
/* Update titlebar and multiline info to match the current buffer. */
|
||||
prepare_for_display();
|
||||
|
||||
/* Indicate the switch on the statusbar. */
|
||||
statusline(HUSH, _("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ?
|
||||
_("New Buffer") : openfile->filename));
|
||||
if (!inhelp)
|
||||
statusline(HUSH, _("Switched to %s"),
|
||||
((openfile->filename[0] == '\0') ?
|
||||
_("New Buffer") : openfile->filename));
|
||||
|
||||
#ifdef DEBUG
|
||||
dump_filestruct(openfile->current);
|
||||
@@ -690,7 +683,7 @@ bool close_buffer(void)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* !DISABLE_MULTIBUFFER */
|
||||
#endif /* ENABLE_MULTIBUFFER */
|
||||
|
||||
/* Do a quick permissions check by verifying whether the file is appendable.
|
||||
* Err on the side of permissiveness (reporting TRUE when it might be wrong)
|
||||
@@ -909,6 +902,10 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||
/* Set the desired x position at the end of what was inserted. */
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
/* If we've read a help file, don't give any feedback. */
|
||||
if (inhelp)
|
||||
return;
|
||||
|
||||
if (!writable)
|
||||
statusline(ALERT, _("File '%s' is unwritable"), filename);
|
||||
#ifndef NANO_TINY
|
||||
@@ -1002,7 +999,7 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
|
||||
if (*f == NULL) {
|
||||
statusline(ALERT, _("Error reading %s: %s"), filename, strerror(errno));
|
||||
close(fd);
|
||||
} else
|
||||
} else if (!inhelp)
|
||||
statusbar(_("Reading File"));
|
||||
}
|
||||
|
||||
@@ -1067,7 +1064,7 @@ void do_insertfile(void)
|
||||
while (TRUE) {
|
||||
#ifndef NANO_TINY
|
||||
if (execute) {
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER))
|
||||
/* TRANSLATORS: The next four messages are prompts. */
|
||||
msg = _("Command to execute in new buffer");
|
||||
@@ -1077,7 +1074,7 @@ void do_insertfile(void)
|
||||
} else
|
||||
#endif /* NANO_TINY */
|
||||
{
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER))
|
||||
msg = _("File to insert into new buffer [from %s]");
|
||||
else
|
||||
@@ -1109,14 +1106,13 @@ void do_insertfile(void)
|
||||
} else {
|
||||
ssize_t was_current_lineno = openfile->current->lineno;
|
||||
size_t was_current_x = openfile->current_x;
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_BROWSER)
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_BROWSER) || defined(ENABLE_MULTIBUFFER)
|
||||
functionptrtype func = func_from_key(&i);
|
||||
#endif
|
||||
given = mallocstrcpy(given, answer);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (func == new_buffer_void) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (func == flip_newbuffer) {
|
||||
/* Don't allow toggling when in view mode. */
|
||||
if (!ISSET(VIEW_MODE))
|
||||
TOGGLE(MULTIBUFFER);
|
||||
@@ -1125,13 +1121,13 @@ void do_insertfile(void)
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
if (func == flip_execute_void) {
|
||||
#ifndef NANO_TINY
|
||||
if (func == flip_execute) {
|
||||
execute = !execute;
|
||||
continue;
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#endif
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (func == to_files_void) {
|
||||
char *chosen = do_browse_from(answer);
|
||||
|
||||
@@ -1150,7 +1146,7 @@ void do_insertfile(void)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (execute) {
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* When in multibuffer mode, first open a blank buffer. */
|
||||
if (ISSET(MULTIBUFFER))
|
||||
open_buffer("", FALSE);
|
||||
@@ -1158,7 +1154,7 @@ void do_insertfile(void)
|
||||
/* Save the command's output in the current buffer. */
|
||||
execute_command(answer);
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* If this is a new buffer, put the cursor at the top. */
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
openfile->current = openfile->fileage;
|
||||
@@ -1179,7 +1175,7 @@ void do_insertfile(void)
|
||||
open_buffer(answer, TRUE);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
#ifndef DISABLE_HISTORIES
|
||||
if (ISSET(POS_HISTORY)) {
|
||||
@@ -1192,17 +1188,17 @@ void do_insertfile(void)
|
||||
}
|
||||
#endif /* !DISABLE_HISTORIES */
|
||||
/* Update stuff to account for the current buffer. */
|
||||
display_buffer();
|
||||
prepare_for_display();
|
||||
} else
|
||||
#endif /* !DISABLE_MULTIBUFFER */
|
||||
#endif /* ENABLE_MULTIBUFFER */
|
||||
{
|
||||
/* Mark the file as modified if it changed. */
|
||||
if (openfile->current->lineno != was_current_lineno ||
|
||||
openfile->current_x != was_current_x)
|
||||
set_modified();
|
||||
|
||||
/* Update the cursor position to account for inserted lines. */
|
||||
reset_cursor();
|
||||
/* Update current_y to account for inserted lines. */
|
||||
place_the_cursor(TRUE);
|
||||
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
@@ -1219,7 +1215,7 @@ void do_insertfile_void(void)
|
||||
{
|
||||
if (ISSET(RESTRICTED))
|
||||
show_restricted_warning();
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
else if (ISSET(VIEW_MODE) && !ISSET(MULTIBUFFER))
|
||||
statusbar(_("Key invalid in non-multibuffer mode"));
|
||||
#endif
|
||||
@@ -1541,12 +1537,14 @@ void init_backup_dir(void)
|
||||
|
||||
/* Read from inn, write to out. We assume inn is opened for reading,
|
||||
* and out for writing. We return 0 on success, -1 on read error, or -2
|
||||
* on write error. */
|
||||
int copy_file(FILE *inn, FILE *out)
|
||||
* on write error. inn is always closed by this function, out is closed
|
||||
* only if close_out is true. */
|
||||
int copy_file(FILE *inn, FILE *out, bool close_out)
|
||||
{
|
||||
int retval = 0;
|
||||
char buf[BUFSIZ];
|
||||
size_t charsread;
|
||||
int (*flush_out_fnc)(FILE *) = (close_out) ? fclose : fflush;
|
||||
|
||||
assert(inn != NULL && out != NULL && inn != out);
|
||||
|
||||
@@ -1564,7 +1562,7 @@ int copy_file(FILE *inn, FILE *out)
|
||||
|
||||
if (fclose(inn) == EOF)
|
||||
retval = -1;
|
||||
if (fclose(out) == EOF)
|
||||
if (flush_out_fnc(out) == EOF)
|
||||
retval = -2;
|
||||
|
||||
return retval;
|
||||
@@ -1655,13 +1653,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
int backup_fd;
|
||||
FILE *backup_file;
|
||||
char *backupname;
|
||||
struct utimbuf filetime;
|
||||
int copy_status;
|
||||
static struct timespec filetime[2];
|
||||
int backup_cflags;
|
||||
|
||||
/* Save the original file's access and modification times. */
|
||||
filetime.actime = openfile->current_stat->st_atime;
|
||||
filetime.modtime = openfile->current_stat->st_mtime;
|
||||
filetime[0].tv_sec = openfile->current_stat->st_atime;
|
||||
filetime[1].tv_sec = openfile->current_stat->st_mtime;
|
||||
|
||||
if (f_open == NULL) {
|
||||
/* Open the original file to copy to the backup. */
|
||||
@@ -1753,35 +1750,36 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
backupname, strerror(errno));
|
||||
free(backupname);
|
||||
/* If we can't make a backup, DON'T go on, since whatever caused
|
||||
* the backup to fail (e.g. disk full) may well cause the real
|
||||
* file write to fail, in which case we could lose both the
|
||||
* backup and the original! */
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
/* We shouldn't worry about chown()ing something if we're not
|
||||
* root, since it's likely to fail! */
|
||||
if (geteuid() == NANO_ROOT_UID && fchown(backup_fd,
|
||||
openfile->current_stat->st_uid, openfile->current_stat->st_gid) == -1
|
||||
&& !ISSET(INSECURE_BACKUP)) {
|
||||
/* Only try chowning the backup when we're root. */
|
||||
if (geteuid() == NANO_ROOT_UID &&
|
||||
fchown(backup_fd, openfile->current_stat->st_uid,
|
||||
openfile->current_stat->st_gid) == -1 &&
|
||||
!ISSET(INSECURE_BACKUP)) {
|
||||
fclose(backup_file);
|
||||
if (prompt_failed_backupwrite(backupname))
|
||||
goto skip_backup;
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
backupname, strerror(errno));
|
||||
free(backupname);
|
||||
fclose(backup_file);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (fchmod(backup_fd, openfile->current_stat->st_mode) == -1
|
||||
&& !ISSET(INSECURE_BACKUP)) {
|
||||
/* Set the backup's mode bits. */
|
||||
if (fchmod(backup_fd, openfile->current_stat->st_mode) == -1 &&
|
||||
!ISSET(INSECURE_BACKUP)) {
|
||||
fclose(backup_file);
|
||||
if (prompt_failed_backupwrite(backupname))
|
||||
goto skip_backup;
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
backupname, strerror(errno));
|
||||
free(backupname);
|
||||
fclose(backup_file);
|
||||
/* If we can't write to the backup, DONT go on, since
|
||||
* whatever caused the backup file to fail (e.g. disk
|
||||
* full) may well cause the real file write to fail, which
|
||||
* means we could lose both the backup and the original! */
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
@@ -1790,27 +1788,24 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
#endif
|
||||
|
||||
/* Copy the file. */
|
||||
copy_status = copy_file(f, backup_file);
|
||||
|
||||
if (copy_status != 0) {
|
||||
if (copy_file(f, backup_file, FALSE) != 0) {
|
||||
fclose(backup_file);
|
||||
statusline(ALERT, _("Error reading %s: %s"), realname,
|
||||
strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
/* And set its metadata. */
|
||||
if (utime(backupname, &filetime) == -1 && !ISSET(INSECURE_BACKUP)) {
|
||||
/* And set the backup's timestamps. */
|
||||
if (futimens(backup_fd, filetime) == -1 && !ISSET(INSECURE_BACKUP)) {
|
||||
fclose(backup_file);
|
||||
if (prompt_failed_backupwrite(backupname))
|
||||
goto skip_backup;
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
backupname, strerror(errno));
|
||||
/* If we can't write to the backup, DON'T go on, since
|
||||
* whatever caused the backup file to fail (e.g. disk full
|
||||
* may well cause the real file write to fail, which means
|
||||
* we could lose both the backup and the original! */
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
fclose(backup_file);
|
||||
free(backupname);
|
||||
}
|
||||
|
||||
@@ -1867,7 +1862,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
}
|
||||
}
|
||||
|
||||
if (f_source == NULL || copy_file(f_source, f) != 0) {
|
||||
if (f_source == NULL || copy_file(f_source, f, TRUE) != 0) {
|
||||
statusline(ALERT, _("Error writing temp file: %s"),
|
||||
strerror(errno));
|
||||
unlink(tempname);
|
||||
@@ -1975,7 +1970,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (copy_file(f_source, f) == -1) {
|
||||
if (copy_file(f_source, f, TRUE) != 0) {
|
||||
statusline(ALERT, _("Error writing %s: %s"), realname,
|
||||
strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
@@ -2051,7 +2046,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
/* Partition the filestruct so that it contains only the marked text. */
|
||||
/* Partition the buffer so that it contains only the marked text. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
filepart = partition_filestruct(top, top_x, bot, bot_x);
|
||||
@@ -2069,7 +2064,7 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
if (added_magicline)
|
||||
remove_magicline();
|
||||
|
||||
/* Unpartition the filestruct so that it contains all the text again. */
|
||||
/* Unpartition the buffer so that it contains all the text again. */
|
||||
unpartition_filestruct(&filepart);
|
||||
|
||||
if (old_modified)
|
||||
@@ -2132,11 +2127,12 @@ int do_writeout(bool exiting)
|
||||
msg = (method == PREPEND) ? _("Prepend Selection to File") :
|
||||
(method == APPEND) ? _("Append Selection to File") :
|
||||
_("Write Selection to File");
|
||||
else if (method != OVERWRITE)
|
||||
msg = (method == PREPEND) ? _("File Name to Prepend to") :
|
||||
_("File Name to Append to");
|
||||
else
|
||||
#endif /* !NANO_TINY */
|
||||
msg = (method == PREPEND) ? _("File Name to Prepend to") :
|
||||
(method == APPEND) ? _("File Name to Append to") :
|
||||
_("File Name to Write");
|
||||
msg = _("File Name to Write");
|
||||
|
||||
present_path = mallocstrcpy(present_path, "./");
|
||||
|
||||
@@ -2161,24 +2157,15 @@ int do_writeout(bool exiting)
|
||||
} else {
|
||||
functionptrtype func = func_from_key(&i);
|
||||
|
||||
/* Upon request, abandon the buffer, if user is sure. */
|
||||
/* Upon request, abandon the buffer. */
|
||||
if (func == discard_buffer) {
|
||||
if (openfile->modified)
|
||||
i = do_yesno_prompt(FALSE,
|
||||
_("Save modified buffer anyway? "));
|
||||
else
|
||||
i = 0;
|
||||
|
||||
if (i == 0) {
|
||||
free(given);
|
||||
return 2; /* Yes, discard the buffer. */
|
||||
} else
|
||||
continue; /* Go back to the filename prompt. */
|
||||
free(given);
|
||||
return 2;
|
||||
}
|
||||
|
||||
given = mallocstrcpy(given, answer);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (func == to_files_void) {
|
||||
char *chosen = do_browse_from(answer);
|
||||
|
||||
@@ -2189,7 +2176,7 @@ int do_writeout(bool exiting)
|
||||
free(answer);
|
||||
answer = chosen;
|
||||
} else
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
if (func == dos_format_void) {
|
||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
||||
@@ -2202,15 +2189,15 @@ int do_writeout(bool exiting)
|
||||
} else if (func == backup_file_void) {
|
||||
TOGGLE(BACKUP_FILE);
|
||||
continue;
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
if (func == prepend_void) {
|
||||
} else if (func == prepend_void) {
|
||||
method = (method == PREPEND) ? OVERWRITE : PREPEND;
|
||||
continue;
|
||||
} else if (func == append_void) {
|
||||
method = (method == APPEND) ? OVERWRITE : APPEND;
|
||||
continue;
|
||||
} else if (func == do_help_void) {
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
if (func == do_help_void) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2390,7 +2377,7 @@ char *real_dir_from_tilde(const char *buf)
|
||||
return retval;
|
||||
}
|
||||
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
/* Our sort routine for file listings. Sort alphabetically and
|
||||
* case-insensitively, and sort directories before filenames. */
|
||||
int diralphasort(const void *va, const void *vb)
|
||||
@@ -2427,7 +2414,7 @@ void free_chararray(char **array, size_t len)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
/* Is the given path a directory? */
|
||||
bool is_dir(const char *buf)
|
||||
{
|
||||
@@ -2634,7 +2621,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
char *mzero, *glued;
|
||||
const char *lastslash = revstrstr(buf, "/", buf + *place);
|
||||
size_t lastslash_len = (lastslash == NULL) ? 0 : lastslash - buf + 1;
|
||||
char char1[mb_cur_max()], char2[mb_cur_max()];
|
||||
char char1[MAXCHARLEN], char2[MAXCHARLEN];
|
||||
int len1, len2;
|
||||
|
||||
/* Get the number of characters that all matches have in common. */
|
||||
@@ -2751,7 +2738,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
|
||||
return buf;
|
||||
}
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
|
||||
/* Return the filename part of the given path. */
|
||||
const char *tail(const char *path)
|
||||
@@ -3007,7 +2994,7 @@ void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
|
||||
poshiststruct *posptr, *theone, *posprev = NULL;
|
||||
char *fullpath = get_full_path(filename);
|
||||
|
||||
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
|
||||
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/' || inhelp) {
|
||||
free(fullpath);
|
||||
return;
|
||||
}
|
||||
@@ -3079,7 +3066,7 @@ bool has_old_position(const char *file, ssize_t *line, ssize_t *column)
|
||||
free(fullpath);
|
||||
|
||||
if (posptr == NULL)
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
*line = posptr->lineno;
|
||||
*column = posptr->xno;
|
||||
|
||||
302
src/global.c
302
src/global.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* global.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -53,15 +52,32 @@ int margin = 0;
|
||||
int editwincols = -1;
|
||||
/* The number of usable columns in the edit window: COLS - margin. */
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
bool have_palette = FALSE;
|
||||
/* Whether the colors for the current syntax have been initialized. */
|
||||
#endif
|
||||
|
||||
bool suppress_cursorpos = FALSE;
|
||||
/* Should we skip constant position display for current keystroke? */
|
||||
|
||||
message_type lastmessage = HUSH;
|
||||
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
|
||||
|
||||
filestruct *pletion_line = NULL;
|
||||
/* The line where the last completion was found, if any. */
|
||||
|
||||
int controlleft, controlright, controlup, controldown;
|
||||
bool inhelp = FALSE;
|
||||
/* Whether we are in the help viewer. */
|
||||
char *title = NULL;
|
||||
/* When not NULL: the title of the current help text. */
|
||||
|
||||
int didfind = 0;
|
||||
/* Whether the last search found something. */
|
||||
|
||||
int controlleft, controlright, controlup, controldown, controlhome, controlend;
|
||||
#ifndef NANO_TINY
|
||||
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
||||
int shiftcontrolhome, shiftcontrolend;
|
||||
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
||||
#endif
|
||||
|
||||
@@ -82,14 +98,14 @@ char *present_path = NULL;
|
||||
|
||||
unsigned flags[4] = {0, 0, 0, 0};
|
||||
/* Our flag containing the states of all global options. */
|
||||
WINDOW *topwin;
|
||||
WINDOW *topwin = NULL;
|
||||
/* The top portion of the window, where we display the version
|
||||
* number of nano, the name of the current file, and whether the
|
||||
* current file has been modified. */
|
||||
WINDOW *edit;
|
||||
WINDOW *edit = NULL;
|
||||
/* The middle portion of the window, i.e. the edit window, where
|
||||
* we display the current file we're editing. */
|
||||
WINDOW *bottomwin;
|
||||
WINDOW *bottomwin = NULL;
|
||||
/* The bottom portion of the window, where we display statusbar
|
||||
* messages, the statusbar prompt, and a list of shortcuts. */
|
||||
int editwinrows = 0;
|
||||
@@ -133,9 +149,6 @@ char *quoteerr = NULL;
|
||||
char *word_chars = NULL;
|
||||
/* Nonalphanumeric characters that also form words. */
|
||||
|
||||
bool nodelay_mode = FALSE;
|
||||
/* Are we checking for a cancel wile doing something? */
|
||||
|
||||
char *answer = NULL;
|
||||
/* The answer string used by the statusbar prompt. */
|
||||
|
||||
@@ -253,10 +266,13 @@ void regexp_void(void)
|
||||
void backwards_void(void)
|
||||
{
|
||||
}
|
||||
void flip_replace(void)
|
||||
{
|
||||
}
|
||||
void gototext_void(void)
|
||||
{
|
||||
}
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
void to_files_void(void)
|
||||
{
|
||||
}
|
||||
@@ -264,6 +280,7 @@ void goto_dir_void(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void dos_format_void(void)
|
||||
{
|
||||
}
|
||||
@@ -279,18 +296,18 @@ void prepend_void(void)
|
||||
void backup_file_void(void)
|
||||
{
|
||||
}
|
||||
void flip_execute(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void flip_newbuffer(void)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
void discard_buffer(void)
|
||||
{
|
||||
}
|
||||
void new_buffer_void(void)
|
||||
{
|
||||
}
|
||||
void flip_replace_void(void)
|
||||
{
|
||||
}
|
||||
void flip_execute_void(void)
|
||||
{
|
||||
}
|
||||
|
||||
/* Add a function to the function list. */
|
||||
void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *help,
|
||||
@@ -309,7 +326,7 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
|
||||
f->menus = menus;
|
||||
f->desc = desc;
|
||||
f->viewok = viewok;
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
f->help = help;
|
||||
f->blank_after = blank_after;
|
||||
#endif
|
||||
@@ -475,16 +492,13 @@ void shortcut_init(void)
|
||||
/* TRANSLATORS: Try to keep this string at most 12 characters. */
|
||||
const char *whereis_next_tag = N_("WhereIs Next");
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
#ifdef ENABLE_HELP
|
||||
/* TRANSLATORS: The next long series of strings are shortcut descriptions;
|
||||
* they are best kept shorter than 56 characters, but may be longer. */
|
||||
const char *nano_justify_msg = N_("Justify the current paragraph");
|
||||
#endif
|
||||
const char *nano_cancel_msg = N_("Cancel the current function");
|
||||
const char *nano_help_msg = N_("Display this help text");
|
||||
const char *nano_exit_msg =
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
N_("Close the current file buffer / Exit from nano")
|
||||
#else
|
||||
N_("Exit from nano")
|
||||
@@ -496,12 +510,14 @@ void shortcut_init(void)
|
||||
N_("Insert another file into the current one");
|
||||
const char *nano_whereis_msg =
|
||||
N_("Search for a string or a regular expression");
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
const char *nano_browser_whereis_msg = N_("Search for a string");
|
||||
const char *nano_browser_refresh_msg = N_("Refresh the file list");
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_browser_lefthand_msg = N_("Go to lefthand column");
|
||||
const char *nano_browser_righthand_msg = N_("Go to righthand column");
|
||||
const char *nano_browser_toprow_msg = N_("Go to first row in this column");
|
||||
const char *nano_browser_bottomrow_msg = N_("Go to last row in this column");
|
||||
#endif
|
||||
#endif
|
||||
const char *nano_prevpage_msg = N_("Go one screenful up");
|
||||
@@ -551,7 +567,7 @@ void shortcut_init(void)
|
||||
const char *nano_scrolldown_msg =
|
||||
N_("Scroll down one line without scrolling the cursor");
|
||||
#endif
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_prevfile_msg = N_("Switch to the previous file buffer");
|
||||
const char *nano_nextfile_msg = N_("Switch to the next file buffer");
|
||||
#endif
|
||||
@@ -570,6 +586,7 @@ void shortcut_init(void)
|
||||
N_("Cut from the cursor position to the end of the file");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_justify_msg = N_("Justify the current paragraph");
|
||||
const char *nano_fulljustify_msg = N_("Justify the entire file");
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
@@ -604,9 +621,6 @@ void shortcut_init(void)
|
||||
const char *nano_next_history_msg =
|
||||
N_("Recall the next search/replace string");
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_dos_msg = N_("Toggle the use of DOS format");
|
||||
const char *nano_mac_msg = N_("Toggle the use of Mac format");
|
||||
@@ -615,11 +629,12 @@ void shortcut_init(void)
|
||||
const char *nano_backup_msg = N_("Toggle backing up of the original file");
|
||||
const char *nano_execute_msg = N_("Execute external command");
|
||||
#endif
|
||||
const char *nano_discard_buffer_msg = N_("Close buffer without saving it");
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
const char *nano_multibuffer_msg = N_("Toggle the use of a new buffer");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_newbuffer_msg = N_("Toggle the use of a new buffer");
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *nano_discard_buffer_msg = N_("Close buffer without saving it");
|
||||
#ifdef ENABLE_BROWSER
|
||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||
const char *nano_exitbrowser_msg = N_("Exit from the file browser");
|
||||
const char *nano_firstfile_msg = N_("Go to the first file in the list");
|
||||
const char *nano_lastfile_msg = N_("Go to the last file in the list");
|
||||
@@ -635,9 +650,9 @@ void shortcut_init(void)
|
||||
const char *nano_formatter_msg = N_("Invoke formatter, if available");
|
||||
#endif
|
||||
#endif
|
||||
#endif /* !DISABLE_HELP */
|
||||
#endif /* ENABLE_HELP */
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
#define IFSCHELP(help) help
|
||||
#else
|
||||
#define IFSCHELP(help) ""
|
||||
@@ -652,12 +667,12 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_cancel, ((MMOST & ~MMAIN & ~MBROWSER) | MYESNO),
|
||||
N_("Cancel"), IFSCHELP(nano_cancel_msg), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(do_exit, MMAIN,
|
||||
add_to_funcs(do_exit, MMAIN|MHELP,
|
||||
exit_tag, IFSCHELP(nano_exit_msg), TOGETHER, VIEW);
|
||||
/* Remember the entry for Exit, to be able to replace it with Close. */
|
||||
exitfunc = tailfunc;
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_exit, MBROWSER,
|
||||
exit_tag, IFSCHELP(nano_exitbrowser_msg), TOGETHER, VIEW);
|
||||
#endif
|
||||
@@ -676,7 +691,7 @@ void shortcut_init(void)
|
||||
read_file_tag, IFSCHELP(nano_insert_msg), BLANKAFTER,
|
||||
/* We allow inserting files in view mode if multibuffer mode
|
||||
* is switched on, so that we can view multiple files. */
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
VIEW);
|
||||
#else
|
||||
NOVIEW);
|
||||
@@ -694,7 +709,7 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_replace, MMAIN,
|
||||
replace_tag, IFSCHELP(nano_replace_msg), TOGETHER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_search, MBROWSER,
|
||||
whereis_tag, IFSCHELP(nano_browser_whereis_msg), TOGETHER, VIEW);
|
||||
|
||||
@@ -702,15 +717,13 @@ void shortcut_init(void)
|
||||
N_("Go To Dir"), IFSCHELP(nano_gotodir_msg), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
/* The description ("x") and blank_after (0) are irrelevant,
|
||||
* because the help viewer does not have a help text. */
|
||||
add_to_funcs(do_exit, MHELP, exit_tag, "x", 0, VIEW);
|
||||
|
||||
add_to_funcs(total_refresh, MHELP, refresh_tag, "x", 0, VIEW);
|
||||
|
||||
add_to_funcs(do_up_void, MHELP, prev_line_tag, "x", 0, VIEW);
|
||||
add_to_funcs(do_down_void, MHELP, next_line_tag, "x" , 0, VIEW);
|
||||
add_to_funcs(do_search, MHELP, whereis_tag, "x", 0, VIEW);
|
||||
add_to_funcs(do_research, MHELP, whereis_next_tag, "x", 0, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(do_cut_text_void, MMAIN,
|
||||
@@ -771,10 +784,10 @@ void shortcut_init(void)
|
||||
add_to_funcs(backwards_void, MWHEREIS|MREPLACE,
|
||||
N_("Backwards"), IFSCHELP(nano_reverse_msg), TOGETHER, VIEW);
|
||||
|
||||
add_to_funcs(flip_replace_void, MWHEREIS,
|
||||
add_to_funcs(flip_replace, MWHEREIS,
|
||||
replace_tag, IFSCHELP(nano_replace_msg), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(flip_replace_void, MREPLACE,
|
||||
add_to_funcs(flip_replace, MREPLACE,
|
||||
N_("No Replace"), IFSCHELP(nano_whereis_msg), BLANKAFTER, VIEW);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -802,7 +815,7 @@ void shortcut_init(void)
|
||||
N_("Back"), IFSCHELP(nano_back_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_right, MMAIN,
|
||||
N_("Forward"), IFSCHELP(nano_forward_msg), TOGETHER, VIEW);
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_left, MBROWSER,
|
||||
N_("Back"), IFSCHELP(nano_backfile_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_right, MBROWSER,
|
||||
@@ -819,9 +832,9 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_end_void, MMAIN,
|
||||
N_("End"), IFSCHELP(nano_end_msg), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(do_up_void, MMAIN|MBROWSER,
|
||||
add_to_funcs(do_up_void, MMAIN|MHELP|MBROWSER,
|
||||
prev_line_tag, IFSCHELP(nano_prevline_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_down_void, MMAIN|MBROWSER,
|
||||
add_to_funcs(do_down_void, MMAIN|MHELP|MBROWSER,
|
||||
next_line_tag, IFSCHELP(nano_nextline_msg), TOGETHER, VIEW);
|
||||
#ifndef NANO_TINY
|
||||
add_to_funcs(do_scroll_up, MMAIN,
|
||||
@@ -851,7 +864,7 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_last_line, MMAIN|MHELP|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE,
|
||||
N_("Last Line"), IFSCHELP(nano_lastline_msg), BLANKAFTER, VIEW);
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
add_to_funcs(switch_to_prev_buffer_void, MMAIN,
|
||||
N_("Prev File"), IFSCHELP(nano_prevfile_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(switch_to_next_buffer_void, MMAIN,
|
||||
@@ -870,9 +883,6 @@ void shortcut_init(void)
|
||||
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(do_verbatim_input, MMAIN,
|
||||
N_("Verbatim"), IFSCHELP(nano_verbatim_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(do_tab, MMAIN,
|
||||
N_("Tab"), IFSCHELP(nano_tab_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_enter, MMAIN,
|
||||
@@ -909,6 +919,9 @@ void shortcut_init(void)
|
||||
N_("Word Count"), IFSCHELP(nano_wordcount_msg), TOGETHER, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(do_verbatim_input, MMAIN,
|
||||
N_("Verbatim"), IFSCHELP(nano_verbatim_msg), BLANKAFTER, NOVIEW);
|
||||
|
||||
add_to_funcs(total_refresh, MMAIN,
|
||||
refresh_tag, IFSCHELP(nano_refresh_msg), TOGETHER, VIEW);
|
||||
|
||||
@@ -974,20 +987,20 @@ void shortcut_init(void)
|
||||
/* If we're using restricted mode, file insertion is disabled, and
|
||||
* thus command execution and the multibuffer toggle have no place. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
add_to_funcs(flip_execute_void, MINSERTFILE,
|
||||
add_to_funcs(flip_execute, MINSERTFILE,
|
||||
N_("Execute Command"), IFSCHELP(nano_execute_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(flip_execute_void, MEXTCMD,
|
||||
add_to_funcs(flip_execute, MEXTCMD,
|
||||
read_file_tag, IFSCHELP(nano_insert_msg), TOGETHER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
add_to_funcs(new_buffer_void, MINSERTFILE|MEXTCMD,
|
||||
N_("New Buffer"), IFSCHELP(nano_multibuffer_msg), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_funcs(flip_newbuffer, MINSERTFILE|MEXTCMD,
|
||||
N_("New Buffer"), IFSCHELP(nano_newbuffer_msg), TOGETHER, NOVIEW);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_funcs(to_files_void, MWRITEFILE|MINSERTFILE,
|
||||
N_("To Files"), IFSCHELP(nano_tofiles_msg), TOGETHER, VIEW);
|
||||
@@ -1006,7 +1019,7 @@ void shortcut_init(void)
|
||||
add_to_funcs(discard_buffer, MWRITEFILE,
|
||||
N_("Discard buffer"), IFSCHELP(nano_discard_buffer_msg), BLANKAFTER, NOVIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_funcs(do_research, MBROWSER,
|
||||
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(total_refresh, MBROWSER,
|
||||
@@ -1015,7 +1028,11 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_prev_word_void, MBROWSER,
|
||||
N_("Left Column"), IFSCHELP(nano_browser_lefthand_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_next_word_void, MBROWSER,
|
||||
N_("Right Column"), IFSCHELP(nano_browser_righthand_msg), BLANKAFTER, VIEW);
|
||||
N_("Right Column"), IFSCHELP(nano_browser_righthand_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_prev_block, MBROWSER,
|
||||
N_("Top Row"), IFSCHELP(nano_browser_toprow_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_next_block, MBROWSER,
|
||||
N_("Bottom Row"), IFSCHELP(nano_browser_bottomrow_msg), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1029,8 +1046,8 @@ void shortcut_init(void)
|
||||
|
||||
/* Start associating key combos with functions in specific menus. */
|
||||
|
||||
add_to_sclist(MMOST, "^G", 0, do_help_void, 0);
|
||||
add_to_sclist(MMOST, "F1", 0, do_help_void, 0);
|
||||
add_to_sclist(MMOST & ~MFINDINHELP, "^G", 0, do_help_void, 0);
|
||||
add_to_sclist(MMOST & ~MFINDINHELP, "F1", 0, do_help_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", 0, do_exit, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", 0, do_exit, 0);
|
||||
add_to_sclist(MMAIN, "^O", 0, do_writeout_void, 0);
|
||||
@@ -1038,8 +1055,8 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "^R", 0, do_insertfile_void, 0);
|
||||
add_to_sclist(MMAIN, "F5", 0, do_insertfile_void, 0);
|
||||
add_to_sclist(MMAIN, "Ins", 0, do_insertfile_void, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^W", 0, do_search, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "F6", 0, do_search, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^W", 0, do_search, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F6", 0, do_search, 0);
|
||||
add_to_sclist(MMAIN, "^\\", 0, do_replace, 0);
|
||||
add_to_sclist(MMAIN, "M-R", 0, do_replace, 0);
|
||||
add_to_sclist(MMAIN, "F14", 0, do_replace, 0);
|
||||
@@ -1068,22 +1085,26 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^Y", 0, do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F7", 0, do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgUp", KEY_PPAGE, do_page_up, 0);
|
||||
add_to_sclist(MHELP|MBROWSER, "Bsp", KEY_BACKSPACE, do_page_up, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "^V", 0, do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-\\", 0, do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "^Home", CONTROL_HOME, do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-|", 0, do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-/", 0, do_last_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "^End", CONTROL_END, do_last_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-?", 0, do_last_line, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "M-W", 0, do_research, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "F16", 0, do_research, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "M-W", 0, do_research, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F16", 0, do_research, 0);
|
||||
#ifndef NANO_TINY
|
||||
add_to_sclist(MMAIN, "M-]", 0, do_find_bracket, 0);
|
||||
add_to_sclist(MMAIN, "^^", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "^6", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "^^", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "F15", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-6", 0, do_copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-}", 0, do_indent_void, 0);
|
||||
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
|
||||
add_to_sclist(MMAIN, "M-U", 0, do_undo, 0);
|
||||
@@ -1096,18 +1117,20 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-3", 0, do_comment, 0);
|
||||
#endif
|
||||
add_to_sclist(MMOST, "^B", 0, do_left, 0);
|
||||
add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "^F", 0, do_right, 0);
|
||||
add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0);
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MMOST, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
add_to_sclist(MMOST, "\xE2\x86\x90", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "\xE2\x86\x92", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MSOME, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MSOME, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MMOST, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MSOME, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MSOME, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
}
|
||||
add_to_sclist(MMOST, "M-Space", 0, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Space", 0, do_next_word_void, 0);
|
||||
@@ -1116,18 +1139,20 @@ void shortcut_init(void)
|
||||
add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end_void, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down_void, 0);
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MMAIN, "^\xE2\x86\x91", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN, "^\xE2\x86\x93", CONTROL_DOWN, do_next_block, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x86\x91", KEY_UP, do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x86\x93", KEY_DOWN, do_down_void, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x86\x91", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x86\x93", CONTROL_DOWN, do_next_block, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MMAIN, "^Up", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN, "^Down", CONTROL_DOWN, do_next_block, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down_void, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^Up", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^Down", CONTROL_DOWN, do_next_block, 0);
|
||||
}
|
||||
add_to_sclist(MMAIN, "M-7", 0, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN, "M-8", 0, do_next_block, 0);
|
||||
@@ -1143,7 +1168,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-+", 0, do_scroll_down, 0);
|
||||
add_to_sclist(MMAIN, "M-=", 0, do_scroll_down, 0);
|
||||
#endif
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
add_to_sclist(MMAIN, "M-<", 0, switch_to_prev_buffer_void, 0);
|
||||
add_to_sclist(MMAIN, "M-,", 0, switch_to_prev_buffer_void, 0);
|
||||
add_to_sclist(MMAIN, "M->", 0, switch_to_next_buffer_void, 0);
|
||||
@@ -1163,7 +1188,7 @@ void shortcut_init(void)
|
||||
#ifndef NANO_TINY
|
||||
/* Group of "Appearance" toggles. */
|
||||
add_to_sclist(MMAIN, "M-X", 0, do_toggle_void, NO_HELP);
|
||||
add_to_sclist(MMAIN, "M-C", 0, do_toggle_void, CONST_UPDATE);
|
||||
add_to_sclist(MMAIN, "M-C", 0, do_toggle_void, CONSTANT_SHOW);
|
||||
add_to_sclist(MMAIN, "M-O", 0, do_toggle_void, MORE_SPACE);
|
||||
add_to_sclist(MMAIN, "M-S", 0, do_toggle_void, SMOOTH_SCROLL);
|
||||
add_to_sclist(MMAIN, "M-$", 0, do_toggle_void, SOFTWRAP);
|
||||
@@ -1186,10 +1211,10 @@ void shortcut_init(void)
|
||||
|
||||
/* Group of "Peripheral-feature" toggles. */
|
||||
add_to_sclist(MMAIN, "M-B", 0, do_toggle_void, BACKUP_FILE);
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
add_to_sclist(MMAIN, "M-F", 0, do_toggle_void, MULTIBUFFER);
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
add_to_sclist(MMAIN, "M-M", 0, do_toggle_void, USE_MOUSE);
|
||||
#endif
|
||||
add_to_sclist(MMAIN, "M-N", 0, do_toggle_void, NO_CONVERT);
|
||||
@@ -1204,7 +1229,7 @@ void shortcut_init(void)
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "M-C", 0, case_sens_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "M-R", 0, regexp_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "M-B", 0, backwards_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE, "^R", 0, flip_replace, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^Y", 0, do_first_line, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE, "^V", 0, do_last_line, 0);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -1214,20 +1239,30 @@ void shortcut_init(void)
|
||||
add_to_sclist(MWHEREIS, "^T", 0, do_gotolinecolumn_void, 0);
|
||||
add_to_sclist(MGOTOLINE, "^T", 0, gototext_void, 0);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "^P", 0, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Up", KEY_UP, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "^N", 0, get_history_newer_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", KEY_DOWN, get_history_newer_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "^P", 0, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "^N", 0, get_history_newer_void, 0);
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "\xE2\x86\x91", KEY_UP, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "\xE2\x86\x93", KEY_DOWN, get_history_newer_void, 0);
|
||||
} else
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
{
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "Up", KEY_UP, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE|MFINDINHELP, "Down", KEY_DOWN, get_history_newer_void, 0);
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_sclist(MWHEREISFILE, "^Y", 0, do_first_file, 0);
|
||||
add_to_sclist(MWHEREISFILE, "^V", 0, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-\\", 0, do_first_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", 0, do_first_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", 0, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", 0, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "Home", KEY_HOME, do_first_file, 0);
|
||||
add_to_sclist(MBROWSER, "End", KEY_END, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", 0, do_first_file, 0);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", 0, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "^Home", CONTROL_HOME, do_first_file, 0);
|
||||
add_to_sclist(MBROWSER, "^End", CONTROL_END, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "^_", 0, goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "M-G", 0, goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "F13", 0, goto_dir_void, 0);
|
||||
@@ -1235,26 +1270,34 @@ void shortcut_init(void)
|
||||
#endif
|
||||
if (ISSET(TEMP_FILE))
|
||||
add_to_sclist(MWRITEFILE, "^Q", 0, discard_buffer, 0);
|
||||
#ifndef NANO_TINY
|
||||
add_to_sclist(MWRITEFILE, "M-D", 0, dos_format_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-M", 0, mac_format_void, 0);
|
||||
/* In restricted mode, don't allow Appending, Prepending, nor making
|
||||
* backups, nor executing a command, nor opening a new buffer. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
/* Don't allow Appending, Prepending, nor Backups in restricted mode. */
|
||||
add_to_sclist(MWRITEFILE, "M-A", 0, append_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-P", 0, prepend_void, 0);
|
||||
add_to_sclist(MWRITEFILE, "M-B", 0, backup_file_void, 0);
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute, 0);
|
||||
}
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, flip_newbuffer, 0);
|
||||
#endif
|
||||
#ifdef ENABLE_BROWSER
|
||||
/* In restricted mode, don't allow entering the file browser. */
|
||||
if (!ISSET(RESTRICTED))
|
||||
add_to_sclist(MWRITEFILE|MINSERTFILE, "^T", 0, to_files_void, 0);
|
||||
#endif
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "^X", 0, flip_execute_void, 0);
|
||||
add_to_sclist(MINSERTFILE|MEXTCMD, "M-F", 0, new_buffer_void, 0);
|
||||
}
|
||||
add_to_sclist(MHELP|MBROWSER, "^C", 0, do_exit, 0);
|
||||
/* Allow exiting from the file browser and the help viewer with
|
||||
* the same key as they were entered. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
add_to_sclist(MBROWSER, "^T", 0, do_exit, 0);
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
add_to_sclist(MHELP, "^G", 0, do_exit, 0);
|
||||
add_to_sclist(MHELP, "Home", KEY_HOME, do_first_line, 0);
|
||||
add_to_sclist(MHELP, "End", KEY_END, do_last_line, 0);
|
||||
@@ -1316,7 +1359,7 @@ const char *flagtostr(int flag)
|
||||
/* TRANSLATORS: The next seventeen strings are toggle descriptions;
|
||||
* they are best kept shorter than 40 characters, but may be longer. */
|
||||
return N_("Help mode");
|
||||
case CONST_UPDATE:
|
||||
case CONSTANT_SHOW:
|
||||
return N_("Constant cursor position display");
|
||||
case MORE_SPACE:
|
||||
return N_("Use of one more line for editing");
|
||||
@@ -1356,7 +1399,7 @@ const char *flagtostr(int flag)
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Interpret a function string given in the rc file, and return a
|
||||
* shortcut struct with the corresponding function filled in. */
|
||||
sc *strtosc(const char *input)
|
||||
@@ -1367,7 +1410,7 @@ sc *strtosc(const char *input)
|
||||
s->toggle = 0;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
if (!strcasecmp(input, "help"))
|
||||
s->scfunc = do_help_void;
|
||||
else
|
||||
@@ -1452,18 +1495,10 @@ sc *strtosc(const char *input)
|
||||
s->scfunc = do_scroll_up;
|
||||
else if (!strcasecmp(input, "scrolldown"))
|
||||
s->scfunc = do_scroll_down;
|
||||
else if (!strcasecmp(input, "prevword"))
|
||||
s->scfunc = do_prev_word_void;
|
||||
else if (!strcasecmp(input, "nextword"))
|
||||
s->scfunc = do_next_word_void;
|
||||
else if (!strcasecmp(input, "cutwordleft"))
|
||||
s->scfunc = do_cut_prev_word;
|
||||
else if (!strcasecmp(input, "cutwordright"))
|
||||
s->scfunc = do_cut_next_word;
|
||||
else if (!strcasecmp(input, "prevblock"))
|
||||
s->scfunc = do_prev_block;
|
||||
else if (!strcasecmp(input, "nextblock"))
|
||||
s->scfunc = do_next_block;
|
||||
else if (!strcasecmp(input, "findbracket"))
|
||||
s->scfunc = do_find_bracket;
|
||||
else if (!strcasecmp(input, "wordcount"))
|
||||
@@ -1485,10 +1520,18 @@ sc *strtosc(const char *input)
|
||||
else if (!strcasecmp(input, "down") ||
|
||||
!strcasecmp(input, "nextline"))
|
||||
s->scfunc = do_down_void;
|
||||
else if (!strcasecmp(input, "prevword"))
|
||||
s->scfunc = do_prev_word_void;
|
||||
else if (!strcasecmp(input, "nextword"))
|
||||
s->scfunc = do_next_word_void;
|
||||
else if (!strcasecmp(input, "home"))
|
||||
s->scfunc = do_home_void;
|
||||
else if (!strcasecmp(input, "end"))
|
||||
s->scfunc = do_end_void;
|
||||
else if (!strcasecmp(input, "prevblock"))
|
||||
s->scfunc = do_prev_block;
|
||||
else if (!strcasecmp(input, "nextblock"))
|
||||
s->scfunc = do_next_block;
|
||||
else if (!strcasecmp(input, "pageup") ||
|
||||
!strcasecmp(input, "prevpage"))
|
||||
s->scfunc = do_page_up;
|
||||
@@ -1499,7 +1542,7 @@ sc *strtosc(const char *input)
|
||||
s->scfunc = do_first_line;
|
||||
else if (!strcasecmp(input, "lastline"))
|
||||
s->scfunc = do_last_line;
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
else if (!strcasecmp(input, "prevbuf"))
|
||||
s->scfunc = switch_to_prev_buffer_void;
|
||||
else if (!strcasecmp(input, "nextbuf"))
|
||||
@@ -1528,7 +1571,7 @@ sc *strtosc(const char *input)
|
||||
s->scfunc = backwards_void;
|
||||
else if (!strcasecmp(input, "flipreplace") ||
|
||||
!strcasecmp(input, "dontreplace")) /* Deprecated. Remove in 2018. */
|
||||
s->scfunc = flip_replace_void;
|
||||
s->scfunc = flip_replace;
|
||||
else if (!strcasecmp(input, "gototext"))
|
||||
s->scfunc = gototext_void;
|
||||
#ifndef DISABLE_HISTORIES
|
||||
@@ -1537,6 +1580,7 @@ sc *strtosc(const char *input)
|
||||
else if (!strcasecmp(input, "nexthistory"))
|
||||
s->scfunc = get_history_newer_void;
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
else if (!strcasecmp(input, "dosformat"))
|
||||
s->scfunc = dos_format_void;
|
||||
else if (!strcasecmp(input, "macformat"))
|
||||
@@ -1547,16 +1591,15 @@ sc *strtosc(const char *input)
|
||||
s->scfunc = prepend_void;
|
||||
else if (!strcasecmp(input, "backup"))
|
||||
s->scfunc = backup_file_void;
|
||||
#ifndef ENABLE_TINY
|
||||
else if (!strcasecmp(input, "flipexecute"))
|
||||
s->scfunc = flip_execute_void;
|
||||
s->scfunc = flip_execute;
|
||||
#endif
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
else if (!strcasecmp(input, "flipnewbuffer") ||
|
||||
!strcasecmp(input, "newbuffer")) /* Deprecated. Remove in 2018. */
|
||||
s->scfunc = new_buffer_void;
|
||||
s->scfunc = flip_newbuffer;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (!strcasecmp(input, "tofiles") ||
|
||||
!strcasecmp(input, "browser"))
|
||||
s->scfunc = to_files_void;
|
||||
@@ -1573,7 +1616,7 @@ sc *strtosc(const char *input)
|
||||
if (!strcasecmp(input, "nohelp"))
|
||||
s->toggle = NO_HELP;
|
||||
else if (!strcasecmp(input, "constupdate"))
|
||||
s->toggle = CONST_UPDATE;
|
||||
s->toggle = CONSTANT_SHOW;
|
||||
else if (!strcasecmp(input, "morespace"))
|
||||
s->toggle = MORE_SPACE;
|
||||
else if (!strcasecmp(input, "smoothscroll"))
|
||||
@@ -1600,11 +1643,11 @@ sc *strtosc(const char *input)
|
||||
s->toggle = TABS_TO_SPACES;
|
||||
else if (!strcasecmp(input, "backupfile"))
|
||||
s->toggle = BACKUP_FILE;
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
else if (!strcasecmp(input, "multibuffer"))
|
||||
s->toggle = MULTIBUFFER;
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
else if (!strcasecmp(input, "mouse"))
|
||||
s->toggle = USE_MOUSE;
|
||||
#endif
|
||||
@@ -1645,7 +1688,7 @@ int strtomenu(const char *input)
|
||||
else if (!strcasecmp(input, "externalcmd") ||
|
||||
!strcasecmp(input, "extcmd"))
|
||||
return MEXTCMD;
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
else if (!strcasecmp(input, "help"))
|
||||
return MHELP;
|
||||
#endif
|
||||
@@ -1655,7 +1698,7 @@ int strtomenu(const char *input)
|
||||
#endif
|
||||
else if (!strcasecmp(input, "linter"))
|
||||
return MLINTER;
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (!strcasecmp(input, "browser"))
|
||||
return MBROWSER;
|
||||
else if (!strcasecmp(input, "whereisfile"))
|
||||
@@ -1665,7 +1708,7 @@ int strtomenu(const char *input)
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -1676,7 +1719,8 @@ int strtomenu(const char *input)
|
||||
* function unless debugging is turned on. */
|
||||
void thanks_for_all_the_fish(void)
|
||||
{
|
||||
delwin(topwin);
|
||||
if (topwin != NULL)
|
||||
delwin(topwin);
|
||||
delwin(edit);
|
||||
delwin(bottomwin);
|
||||
|
||||
@@ -1771,7 +1815,7 @@ void thanks_for_all_the_fish(void)
|
||||
sclist = sclist->next;
|
||||
free(s);
|
||||
}
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
free(homedir);
|
||||
#endif
|
||||
}
|
||||
|
||||
344
src/help.c
344
src/help.c
@@ -1,9 +1,9 @@
|
||||
/**************************************************************************
|
||||
* help.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, *
|
||||
* 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* Copyright (C) 2000-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2017 Rishabh Dave *
|
||||
* Copyright (C) 2014-2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -25,165 +25,265 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
|
||||
static char *help_text = NULL;
|
||||
/* The text displayed in the help window. */
|
||||
|
||||
static const char *start_of_body = NULL;
|
||||
/* The point in the help text just after the title. */
|
||||
|
||||
static char *end_of_intro = NULL;
|
||||
/* The point in the help text where the introductory paragraphs end
|
||||
* and the shortcut descriptions begin. */
|
||||
/* The point in the help text where the shortcut descriptions begin. */
|
||||
|
||||
static size_t location;
|
||||
/* The offset (in bytes) of the topleft of the shown help text. */
|
||||
|
||||
char *tempfilename = NULL;
|
||||
/* Name of the temporary file used for wrapping the help text. */
|
||||
|
||||
/* Hard-wrap the help text, write it to the existing temporary file, and
|
||||
* read that file into a new buffer. */
|
||||
void wrap_the_help_text(bool redisplaying)
|
||||
{
|
||||
int sum = 0;
|
||||
const char *ptr = start_of_body;
|
||||
FILE *tempfile = fopen(tempfilename, "w+b");
|
||||
|
||||
/* If re-opening the temporary file failed, give up. */
|
||||
if (tempfile == NULL) {
|
||||
statusline(ALERT, _("Error writing temp file: %s"), strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write the body of the help_text into the temporary file. */
|
||||
while (*ptr != '\0') {
|
||||
int length = help_line_len(ptr);
|
||||
|
||||
fwrite(ptr, sizeof(char), length, tempfile);
|
||||
ptr += length;
|
||||
|
||||
/* Hard-wrap the lines in the help text. */
|
||||
if (*ptr != '\n')
|
||||
fwrite("\n", sizeof(char), 1, tempfile);
|
||||
else while (*ptr == '\n')
|
||||
fwrite(ptr++, sizeof(char), 1, tempfile);
|
||||
}
|
||||
|
||||
fclose(tempfile);
|
||||
|
||||
if (redisplaying)
|
||||
close_buffer();
|
||||
|
||||
open_buffer(tempfilename, FALSE);
|
||||
remove_magicline();
|
||||
|
||||
prepare_for_display();
|
||||
|
||||
/* Move to the position in the file where we were before. */
|
||||
while (TRUE) {
|
||||
sum += strlen(openfile->current->data);
|
||||
if (sum > location)
|
||||
break;
|
||||
openfile->current = openfile->current->next;
|
||||
}
|
||||
|
||||
openfile->edittop = openfile->current;
|
||||
}
|
||||
|
||||
/* Our main help-viewer function. */
|
||||
void do_help(void)
|
||||
{
|
||||
int kbinput = ERR;
|
||||
bool old_no_help = ISSET(NO_HELP);
|
||||
size_t line = 0;
|
||||
/* The line number in help_text of the first displayed help
|
||||
* line. This variable is zero-based. */
|
||||
size_t last_line = 0;
|
||||
/* The line number in help_text of the last help line. This
|
||||
* variable is zero-based. */
|
||||
int oldmenu = currmenu;
|
||||
/* The menu we were called from. */
|
||||
const char *ptr;
|
||||
/* The current line of the help text. */
|
||||
size_t old_line = (size_t)-1;
|
||||
/* The line we were on before the current line. */
|
||||
functionptrtype func;
|
||||
/* The function of the key the user typed in. */
|
||||
int oldmenu = currmenu;
|
||||
/* The menu we were called from. */
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
int was_margin = margin;
|
||||
#endif
|
||||
ssize_t was_tabsize = tabsize;
|
||||
#ifndef DISABLE_COLOR
|
||||
char *was_syntax = syntaxstr;
|
||||
#endif
|
||||
char *saved_answer = (answer != NULL) ? strdup(answer) : NULL;
|
||||
/* The current answer when the user invokes help at the prompt. */
|
||||
unsigned stash[sizeof(flags) / sizeof(flags[0])];
|
||||
/* A storage place for the current flag settings. */
|
||||
filestruct *line;
|
||||
int length;
|
||||
FILE *fp;
|
||||
|
||||
/* Don't show a cursor in the help screen. */
|
||||
curs_set(0);
|
||||
blank_edit();
|
||||
blank_statusbar();
|
||||
|
||||
/* Set help_text as the string to display. */
|
||||
help_init();
|
||||
/* Get a temporary file for the help text. If it fails, give up. */
|
||||
tempfilename = safe_tempfile(&fp);
|
||||
if (tempfilename == NULL) {
|
||||
statusline(ALERT, _("Error writing temp file: %s"), strerror(errno));
|
||||
free(saved_answer);
|
||||
return;
|
||||
}
|
||||
|
||||
assert(help_text != NULL);
|
||||
fclose(fp);
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
/* Make sure that the help screen's shortcut list will actually
|
||||
* be displayed. */
|
||||
/* Save the settings of all flags. */
|
||||
memcpy(stash, flags, sizeof(flags));
|
||||
|
||||
/* Ensure that the help screen's shortcut list can be displayed. */
|
||||
if (ISSET(NO_HELP) && LINES > 4) {
|
||||
UNSET(NO_HELP);
|
||||
window_init();
|
||||
}
|
||||
|
||||
/* When searching, do it forward, case insensitive, and without regexes. */
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
UNSET(CASE_SENSITIVE);
|
||||
UNSET(USE_REGEXP);
|
||||
|
||||
UNSET(WHITESPACE_DISPLAY);
|
||||
UNSET(NOREAD_MODE);
|
||||
SET(MULTIBUFFER);
|
||||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
UNSET(LINE_NUMBERS);
|
||||
margin = 0;
|
||||
#endif
|
||||
tabsize = 8;
|
||||
#ifndef DISABLE_COLOR
|
||||
syntaxstr = "nanohelp";
|
||||
#endif
|
||||
curs_set(0);
|
||||
|
||||
/* Compose the help text from all the pieces. */
|
||||
help_init();
|
||||
inhelp = TRUE;
|
||||
location = 0;
|
||||
|
||||
bottombars(MHELP);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
/* Extract the title from the head of the help text. */
|
||||
length = break_line(help_text, MAX_BUF_SIZE, TRUE);
|
||||
title = charalloc(length * sizeof(char) + 1);
|
||||
strncpy(title, help_text, length);
|
||||
title[length] = '\0';
|
||||
|
||||
titlebar(title);
|
||||
|
||||
/* Skip over the title to point at the start of the body text. */
|
||||
start_of_body = help_text + length;
|
||||
while (*start_of_body == '\n')
|
||||
start_of_body++;
|
||||
|
||||
wrap_the_help_text(FALSE);
|
||||
edit_refresh();
|
||||
|
||||
while (TRUE) {
|
||||
size_t i;
|
||||
|
||||
ptr = help_text;
|
||||
|
||||
/* Find the line number of the last line of the help text. */
|
||||
for (last_line = 0; *ptr != '\0'; last_line++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (last_line > 0)
|
||||
last_line--;
|
||||
|
||||
/* Redisplay if the text was scrolled or an invalid key was pressed. */
|
||||
if (line != old_line || kbinput == ERR) {
|
||||
blank_edit();
|
||||
|
||||
ptr = help_text;
|
||||
|
||||
/* Advance in the text to the first line to be displayed. */
|
||||
for (i = 0; i < line; i++) {
|
||||
ptr += help_line_len(ptr);
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
|
||||
/* Now display as many lines as the window will hold. */
|
||||
for (i = 0; i < editwinrows && *ptr != '\0'; i++) {
|
||||
size_t j = help_line_len(ptr);
|
||||
|
||||
mvwaddnstr(edit, i, 0, ptr, j);
|
||||
ptr += j;
|
||||
if (*ptr == '\n')
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
wnoutrefresh(edit);
|
||||
|
||||
old_line = line;
|
||||
|
||||
lastmessage = HUSH;
|
||||
focusing = TRUE;
|
||||
didfind = 0;
|
||||
|
||||
kbinput = get_kbinput(edit);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (kbinput == KEY_WINCH) {
|
||||
kbinput = ERR;
|
||||
continue; /* Redraw the screen. */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
if (kbinput == KEY_MOUSE) {
|
||||
int mouse_x, mouse_y;
|
||||
get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
||||
continue; /* Redraw the screen. */
|
||||
}
|
||||
#endif
|
||||
|
||||
func = parse_help_input(&kbinput);
|
||||
|
||||
if (func == total_refresh) {
|
||||
total_redraw();
|
||||
} else if (func == do_up_void) {
|
||||
if (line > 0)
|
||||
line--;
|
||||
do_up(TRUE);
|
||||
} else if (func == do_down_void) {
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line++;
|
||||
if (openfile->edittop->lineno + editwinrows - 1 <
|
||||
openfile->filebot->lineno)
|
||||
do_down(TRUE);
|
||||
} else if (func == do_page_up) {
|
||||
if (line > editwinrows - 2)
|
||||
line -= editwinrows - 2;
|
||||
else
|
||||
line = 0;
|
||||
do_page_up();
|
||||
} else if (func == do_page_down) {
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line += editwinrows - 2;
|
||||
do_page_down();
|
||||
} else if (func == do_first_line) {
|
||||
line = 0;
|
||||
do_first_line();
|
||||
} else if (func == do_last_line) {
|
||||
if (line + (editwinrows - 1) < last_line)
|
||||
line = last_line - (editwinrows - 1);
|
||||
do_last_line();
|
||||
} else if (func == do_search) {
|
||||
do_search();
|
||||
bottombars(MHELP);
|
||||
} else if (func == do_research) {
|
||||
do_research();
|
||||
currmenu = MHELP;
|
||||
#ifndef NANO_TINY
|
||||
} else if (kbinput == KEY_WINCH) {
|
||||
; /* Nothing to do. */
|
||||
#endif
|
||||
#ifdef ENABLE_MOUSE
|
||||
} else if (kbinput == KEY_MOUSE) {
|
||||
int dummy_x, dummy_y;
|
||||
get_mouseinput(&dummy_x, &dummy_y, TRUE);
|
||||
#endif
|
||||
} else if (func == do_exit) {
|
||||
/* Exit from the help viewer. */
|
||||
close_buffer();
|
||||
break;
|
||||
} else
|
||||
unbound_key(kbinput);
|
||||
|
||||
/* If we searched and found something, let the cursor show it. */
|
||||
if (didfind == 1)
|
||||
curs_set(1);
|
||||
else
|
||||
curs_set(0);
|
||||
|
||||
edit_refresh();
|
||||
|
||||
location = 0;
|
||||
line = openfile->fileage;
|
||||
|
||||
/* Count how far (in bytes) edittop is into the file. */
|
||||
while (line != openfile->edittop) {
|
||||
location += strlen(line->data);
|
||||
line = line->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (old_no_help) {
|
||||
/* Restore the settings of all flags. */
|
||||
memcpy(flags, stash, sizeof(flags));
|
||||
|
||||
#ifdef ENABLE_LINENUMBERS
|
||||
margin = was_margin;
|
||||
#endif
|
||||
tabsize = was_tabsize;
|
||||
#ifndef DISABLE_COLOR
|
||||
syntaxstr = was_syntax;
|
||||
#endif
|
||||
|
||||
/* Switch back to the buffer we were invoked from. */
|
||||
switch_to_prev_buffer_void();
|
||||
|
||||
if (ISSET(NO_HELP)) {
|
||||
blank_bottombars();
|
||||
wnoutrefresh(bottomwin);
|
||||
currmenu = oldmenu;
|
||||
SET(NO_HELP);
|
||||
window_init();
|
||||
} else
|
||||
bottombars(oldmenu);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
free(title);
|
||||
title = NULL;
|
||||
inhelp = FALSE;
|
||||
|
||||
#ifdef ENABLE_BROWSER
|
||||
if (oldmenu == MBROWSER || oldmenu == MWHEREISFILE || oldmenu == MGOTODIR)
|
||||
browser_refresh();
|
||||
else
|
||||
#endif
|
||||
edit_refresh();
|
||||
total_refresh();
|
||||
|
||||
free(answer);
|
||||
answer = saved_answer;
|
||||
|
||||
remove(tempfilename);
|
||||
free(tempfilename);
|
||||
|
||||
/* We're exiting from the help screen. */
|
||||
free(help_text);
|
||||
}
|
||||
|
||||
@@ -200,12 +300,6 @@ void help_init(void)
|
||||
const subnfunc *f;
|
||||
const sc *s;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
||||
|
||||
UNSET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
|
||||
/* First, set up the initial help text for the current function. */
|
||||
if (currmenu == MWHEREIS || currmenu == MREPLACE || currmenu == MREPLACEWITH) {
|
||||
htx[0] = N_("Search Command Help Text\n\n "
|
||||
@@ -259,7 +353,7 @@ void help_init(void)
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#ifndef DISABLE_BROWSER
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (currmenu == MBROWSER) {
|
||||
htx[0] = N_("File Browser Help Text\n\n "
|
||||
"The file browser is used to visually browse the "
|
||||
@@ -297,7 +391,7 @@ void help_init(void)
|
||||
htx[1] = NULL;
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#endif /* ENABLE_BROWSER */
|
||||
#ifndef DISABLE_SPELLER
|
||||
else if (currmenu == MSPELL) {
|
||||
htx[0] = N_("Spell Check Help Text\n\n "
|
||||
@@ -370,7 +464,7 @@ void help_init(void)
|
||||
* plus one or two \n's. */
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if (f->menus & currmenu)
|
||||
allocsize += (16 * mb_cur_max()) + strlen(f->help) + 2;
|
||||
allocsize += (16 * MAXCHARLEN) + strlen(_(f->help)) + 2;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
@@ -385,7 +479,7 @@ void help_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Allocate space for the help text. */
|
||||
/* Allocate memory for the help text. */
|
||||
help_text = charalloc(allocsize + 1);
|
||||
|
||||
/* Now add the text we want. */
|
||||
@@ -418,9 +512,9 @@ void help_init(void)
|
||||
/* Make the first column narrower (6) than the second (10),
|
||||
* but allow it to spill into the second, for "M-Space". */
|
||||
if (scsfound == 1) {
|
||||
sprintf(ptr, "%s ", s->keystr);
|
||||
sprintf(ptr, "%s ", s->keystr);
|
||||
/* Unicode arrows take three bytes instead of one. */
|
||||
if (s->keystr[1] == '\xE2')
|
||||
if (s->keystr[0] == '\xE2' || s->keystr[1] == '\xE2')
|
||||
ptr += 8;
|
||||
else
|
||||
ptr += 6;
|
||||
@@ -465,13 +559,10 @@ void help_init(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (old_whitespace)
|
||||
SET(WHITESPACE_DISPLAY);
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* If all went well, we didn't overwrite the allocated space. */
|
||||
assert(strlen(help_text) <= allocsize + 1);
|
||||
if (strlen(help_text) > allocsize)
|
||||
statusline(ALERT, "Help text spilled over -- please report a bug");
|
||||
}
|
||||
|
||||
/* Return the function that is bound to the given key, accepting certain
|
||||
@@ -484,6 +575,13 @@ functionptrtype parse_help_input(int *kbinput)
|
||||
return do_page_down;
|
||||
case '-':
|
||||
return do_page_up;
|
||||
case 'W':
|
||||
case 'w':
|
||||
case '/':
|
||||
return do_search;
|
||||
case 'N':
|
||||
case 'n':
|
||||
return do_research;
|
||||
case 'E':
|
||||
case 'e':
|
||||
case 'Q':
|
||||
@@ -525,17 +623,17 @@ size_t help_line_len(const char *ptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_HELP */
|
||||
#endif /* ENABLE_HELP */
|
||||
|
||||
/* Start the help viewer. */
|
||||
void do_help_void(void)
|
||||
{
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
do_help();
|
||||
#else
|
||||
if (currmenu == MMAIN)
|
||||
say_there_is_no_help();
|
||||
else
|
||||
beep();
|
||||
#endif /* !DISABLE_HELP */
|
||||
#endif
|
||||
}
|
||||
|
||||
57
src/move.c
57
src/move.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* move.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -56,7 +55,7 @@ void get_edge_and_target(size_t *leftedge, size_t *target_column)
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
size_t realspan = strlenpt(openfile->current->data);
|
||||
|
||||
if (openfile->placewewant < realspan)
|
||||
if (realspan > openfile->placewewant)
|
||||
realspan = openfile->placewewant;
|
||||
|
||||
*leftedge = (realspan / editwincols) * editwincols;
|
||||
@@ -96,7 +95,7 @@ void do_page_up(void)
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window up a page. */
|
||||
/* Move the viewport so that the cursor stays immobile, if possible. */
|
||||
adjust_viewport(STATIONARY);
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
@@ -128,16 +127,15 @@ void do_page_down(void)
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down a page. */
|
||||
/* Move the viewport so that the cursor stays immobile, if possible. */
|
||||
adjust_viewport(STATIONARY);
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Move up to the beginning of the last beginning-of-paragraph line
|
||||
* before the current line. If allow_update is TRUE, update the screen
|
||||
* afterwards. */
|
||||
void do_para_begin(bool allow_update)
|
||||
/* Move to the beginning of the last beginning-of-paragraph line before the
|
||||
* current line. If update_screen is TRUE, update the screen afterwards. */
|
||||
void do_para_begin(bool update_screen)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
@@ -149,12 +147,11 @@ void do_para_begin(bool allow_update)
|
||||
|
||||
openfile->current_x = 0;
|
||||
|
||||
if (allow_update)
|
||||
if (update_screen)
|
||||
edit_redraw(was_current);
|
||||
}
|
||||
|
||||
/* Move up to the beginning of the last beginning-of-paragraph line
|
||||
* before the current line, and update the screen afterwards. */
|
||||
/* Move up to first start of a paragraph before the current line. */
|
||||
void do_para_begin_void(void)
|
||||
{
|
||||
do_para_begin(TRUE);
|
||||
@@ -162,11 +159,11 @@ void do_para_begin_void(void)
|
||||
|
||||
/* Move down to the beginning of the last line of the current paragraph.
|
||||
* Then move down one line farther if there is such a line, or to the
|
||||
* end of the current line if not. If allow_update is TRUE, update the
|
||||
* end of the current line if not. If update_screen is TRUE, update the
|
||||
* screen afterwards. A line is the last line of a paragraph if it is
|
||||
* in a paragraph, and the next line either is the beginning line of a
|
||||
* paragraph or isn't in a paragraph. */
|
||||
void do_para_end(bool allow_update)
|
||||
void do_para_end(bool update_screen)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
|
||||
@@ -186,13 +183,11 @@ void do_para_end(bool allow_update)
|
||||
} else
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
|
||||
if (allow_update)
|
||||
if (update_screen)
|
||||
edit_redraw(was_current);
|
||||
}
|
||||
|
||||
/* Move down to the beginning of the last line of the current paragraph.
|
||||
* Then move down one line farther if there is such a line, or to the
|
||||
* end of the current line if not, and update the screen afterwards. */
|
||||
/* Move down to just after the first end of a paragraph. */
|
||||
void do_para_end_void(void)
|
||||
{
|
||||
do_para_end(TRUE);
|
||||
@@ -240,9 +235,9 @@ void do_next_block(void)
|
||||
}
|
||||
|
||||
/* Move to the previous word in the file. If allow_punct is TRUE, treat
|
||||
* punctuation as part of a word. If allow_update is TRUE, update the
|
||||
* punctuation as part of a word. If update_screen is TRUE, update the
|
||||
* screen afterwards. */
|
||||
void do_prev_word(bool allow_punct, bool allow_update)
|
||||
void do_prev_word(bool allow_punct, bool update_screen)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||
@@ -279,8 +274,7 @@ void do_prev_word(bool allow_punct, bool allow_update)
|
||||
openfile->current_x = move_mbright(openfile->current->data,
|
||||
openfile->current_x);
|
||||
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update) {
|
||||
if (update_screen) {
|
||||
focusing = FALSE;
|
||||
edit_redraw(was_current);
|
||||
}
|
||||
@@ -294,10 +288,10 @@ void do_prev_word_void(void)
|
||||
}
|
||||
|
||||
/* Move to the next word in the file. If allow_punct is TRUE, treat
|
||||
* punctuation as part of a word. If allow_update is TRUE, update the
|
||||
* punctuation as part of a word. If update_screen is TRUE, update the
|
||||
* screen afterwards. Return TRUE if we started on a word, and FALSE
|
||||
* otherwise. */
|
||||
bool do_next_word(bool allow_punct, bool allow_update)
|
||||
bool do_next_word(bool allow_punct, bool update_screen)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
bool started_on_word = is_word_mbchar(openfile->current->data +
|
||||
@@ -329,8 +323,7 @@ bool do_next_word(bool allow_punct, bool allow_update)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If allow_update is TRUE, update the screen. */
|
||||
if (allow_update) {
|
||||
if (update_screen) {
|
||||
focusing = FALSE;
|
||||
edit_redraw(was_current);
|
||||
}
|
||||
@@ -348,12 +341,12 @@ void do_next_word_void(void)
|
||||
|
||||
/* Move to the beginning of the current line (or softwrapped chunk).
|
||||
* If be_clever is TRUE, do a smart home when wanted and possible,
|
||||
* and do a dynamic home when in softwrap mode and it'spossible.
|
||||
* and do a dynamic home when in softwrap mode and it's possible.
|
||||
* If be_clever is FALSE, just do a simple home. */
|
||||
void do_home(bool be_clever)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
size_t was_column = xplustabs();
|
||||
size_t was_column = openfile->placewewant;
|
||||
bool moved_off_chunk = TRUE;
|
||||
#ifndef NANO_TINY
|
||||
bool moved = FALSE;
|
||||
@@ -383,17 +376,19 @@ void do_home(bool be_clever)
|
||||
if (!moved && ISSET(SOFTWRAP)) {
|
||||
/* If already at the left edge of the screen, move fully home.
|
||||
* Otherwise, move to the left edge. */
|
||||
if (openfile->current_x == leftedge_x && be_clever)
|
||||
if (was_column % editwincols == 0 && be_clever)
|
||||
openfile->current_x = 0;
|
||||
else {
|
||||
openfile->current_x = leftedge_x;
|
||||
openfile->placewewant = (was_column / editwincols) * editwincols;
|
||||
moved_off_chunk = FALSE;
|
||||
}
|
||||
} else if (!moved)
|
||||
#endif
|
||||
openfile->current_x = 0;
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
if (moved_off_chunk)
|
||||
openfile->placewewant = 0;
|
||||
|
||||
/* If we changed chunk, we might be offscreen. Otherwise,
|
||||
* update current if the mark is on or we changed "page". */
|
||||
@@ -416,7 +411,7 @@ void do_home_void(void)
|
||||
void do_end(bool be_clever)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
size_t was_column = xplustabs();
|
||||
size_t was_column = openfile->placewewant;
|
||||
size_t line_len = strlen(openfile->current->data);
|
||||
bool moved_off_chunk = TRUE;
|
||||
|
||||
|
||||
553
src/nano.c
553
src/nano.c
File diff suppressed because it is too large
Load Diff
34
src/nano.h
34
src/nano.h
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* nano.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -68,6 +67,13 @@
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
||||
|
||||
/* In UTF-8 a character is at most six bytes long. */
|
||||
#ifdef ENABLE_UTF8
|
||||
#define MAXCHARLEN 6
|
||||
#else
|
||||
#define MAXCHARLEN 1
|
||||
#endif
|
||||
|
||||
/* Set a default value for PATH_MAX if there isn't one. */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
@@ -118,10 +124,10 @@
|
||||
#include <signal.h>
|
||||
#include <assert.h>
|
||||
|
||||
/* If we aren't using ncurses with mouse support, turn the mouse support
|
||||
* off, as it's useless then. */
|
||||
/* If we aren't using an ncurses with mouse support, exclude any
|
||||
* mouse routines, as they are useless then. */
|
||||
#ifndef NCURSES_MOUSE_VERSION
|
||||
#define DISABLE_MOUSE 1
|
||||
#undef ENABLE_MOUSE
|
||||
#endif
|
||||
|
||||
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
|
||||
@@ -398,7 +404,7 @@ typedef struct openfilestruct {
|
||||
/* The preceding open file, if any. */
|
||||
} openfilestruct;
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
typedef struct rcoption {
|
||||
const char *name;
|
||||
/* The name of the rcfile option. */
|
||||
@@ -436,7 +442,7 @@ typedef struct subnfunc {
|
||||
/* In what menus this function applies. */
|
||||
const char *desc;
|
||||
/* The function's short description, for example "Where Is". */
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
const char *help;
|
||||
/* The help-screen text for this function. */
|
||||
bool blank_after;
|
||||
@@ -474,7 +480,7 @@ enum
|
||||
{
|
||||
DONTUSE,
|
||||
CASE_SENSITIVE,
|
||||
CONST_UPDATE,
|
||||
CONSTANT_SHOW,
|
||||
NO_HELP,
|
||||
SUSPEND,
|
||||
NO_WRAP,
|
||||
@@ -532,9 +538,15 @@ enum
|
||||
#define MGOTODIR (1<<12)
|
||||
#define MYESNO (1<<13)
|
||||
#define MLINTER (1<<14)
|
||||
#define MFINDINHELP (1<<15)
|
||||
/* This is an abbreviation for all menus except Help and YesNo. */
|
||||
#define MMOST (MMAIN|MWHEREIS|MREPLACE|MREPLACEWITH|MGOTOLINE|MWRITEFILE|MINSERTFILE|\
|
||||
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MSPELL|MLINTER)
|
||||
MEXTCMD|MBROWSER|MWHEREISFILE|MGOTODIR|MFINDINHELP|MSPELL|MLINTER)
|
||||
#ifndef NANO_TINY
|
||||
#define MSOME MMOST
|
||||
#else
|
||||
#define MSOME MMAIN|MBROWSER
|
||||
#endif
|
||||
|
||||
/* Basic control codes. */
|
||||
#define TAB_CODE 0x09
|
||||
@@ -546,10 +558,14 @@ enum
|
||||
#define CONTROL_RIGHT 0x402
|
||||
#define CONTROL_UP 0x403
|
||||
#define CONTROL_DOWN 0x404
|
||||
#define CONTROL_HOME 0x411
|
||||
#define CONTROL_END 0x412
|
||||
#define SHIFT_CONTROL_LEFT 0x405
|
||||
#define SHIFT_CONTROL_RIGHT 0x406
|
||||
#define SHIFT_CONTROL_UP 0x407
|
||||
#define SHIFT_CONTROL_DOWN 0x408
|
||||
#define SHIFT_CONTROL_HOME 0x413
|
||||
#define SHIFT_CONTROL_END 0x414
|
||||
#define SHIFT_ALT_LEFT 0x409
|
||||
#define SHIFT_ALT_RIGHT 0x40a
|
||||
#define SHIFT_ALT_UP 0x40b
|
||||
|
||||
79
src/prompt.c
79
src/prompt.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* prompt.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -58,7 +57,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
return KEY_WINCH;
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
/* If we got a mouse click and it was on a shortcut, read in the
|
||||
* shortcut character. */
|
||||
if (input == KEY_MOUSE) {
|
||||
@@ -96,7 +95,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
kbinput = (int *)nrealloc(kbinput, kbinput_len * sizeof(int));
|
||||
kbinput[kbinput_len - 1] = input;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If we got a shortcut, or if there aren't any other keystrokes waiting
|
||||
* after the one we read in, we need to insert all the characters in the
|
||||
@@ -165,7 +164,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
|
||||
return input;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
/* Handle a mouse click on the statusbar prompt or the shortcut list. */
|
||||
int do_statusbar_mouse(void)
|
||||
{
|
||||
@@ -197,7 +196,7 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
bool filtering)
|
||||
{
|
||||
char *output = charalloc(input_len + 1);
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
char onechar[MAXCHARLEN];
|
||||
int i, char_len;
|
||||
|
||||
/* Copy the typed stuff so it can be treated. */
|
||||
@@ -213,7 +212,7 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
output[i] = '\n';
|
||||
|
||||
/* Interpret the next multibyte character. */
|
||||
char_len = parse_mbchar(output + i, char_buf, NULL);
|
||||
char_len = parse_mbchar(output + i, onechar, NULL);
|
||||
|
||||
i += char_len;
|
||||
|
||||
@@ -225,12 +224,11 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
answer = charealloc(answer, strlen(answer) + char_len + 1);
|
||||
charmove(answer + statusbar_x + char_len, answer + statusbar_x,
|
||||
strlen(answer) - statusbar_x + 1);
|
||||
strncpy(answer + statusbar_x, char_buf, char_len);
|
||||
strncpy(answer + statusbar_x, onechar, char_len);
|
||||
|
||||
statusbar_x += char_len;
|
||||
}
|
||||
|
||||
free(char_buf);
|
||||
free(output);
|
||||
|
||||
update_the_statusbar();
|
||||
@@ -385,35 +383,18 @@ void reinit_statusbar_x(void)
|
||||
statusbar_x = HIGHEST_POSITIVE;
|
||||
}
|
||||
|
||||
/* Put the cursor in the answer at statusbar_x. */
|
||||
void reset_statusbar_cursor(void)
|
||||
{
|
||||
size_t start_col = strlenpt(prompt) + 2;
|
||||
size_t xpt = statusbar_xplustabs();
|
||||
|
||||
/* Work around a cursor-misplacement bug in VTEs. */
|
||||
wmove(bottomwin, 0, 0);
|
||||
wnoutrefresh(bottomwin);
|
||||
doupdate();
|
||||
|
||||
wmove(bottomwin, 0, start_col + xpt -
|
||||
get_statusbar_page_start(start_col, start_col + xpt));
|
||||
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
/* Repaint the statusbar. */
|
||||
/* Redraw the promptbar and place the cursor at the right spot. */
|
||||
void update_the_statusbar(void)
|
||||
{
|
||||
size_t base, the_page, end_page;
|
||||
size_t base = strlenpt(prompt) + 2;
|
||||
size_t the_page, end_page, column;
|
||||
char *expanded;
|
||||
|
||||
base = strlenpt(prompt) + 2;
|
||||
the_page = get_statusbar_page_start(base, base + strnlenpt(answer, statusbar_x));
|
||||
end_page = get_statusbar_page_start(base, base + strlenpt(answer) - 1);
|
||||
|
||||
/* Color the promptbar over its full width. */
|
||||
wattron(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
|
||||
blank_statusbar();
|
||||
|
||||
mvwaddstr(bottomwin, 0, 0, prompt);
|
||||
@@ -428,7 +409,14 @@ void update_the_statusbar(void)
|
||||
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR]);
|
||||
|
||||
reset_statusbar_cursor();
|
||||
/* Work around a cursor-misplacement bug in VTEs. */
|
||||
wmove(bottomwin, 0, 0);
|
||||
wrefresh(bottomwin);
|
||||
|
||||
/* Place the cursor at statusbar_x in the answer. */
|
||||
column = base + statusbar_xplustabs();
|
||||
wmove(bottomwin, 0, column - get_statusbar_page_start(base, column));
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
/* Get a string of input at the statusbar prompt. */
|
||||
@@ -442,7 +430,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
int kbinput = ERR;
|
||||
bool ran_func, finished;
|
||||
functionptrtype func;
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
bool tabbed = FALSE;
|
||||
/* Whether we've pressed Tab. */
|
||||
#endif
|
||||
@@ -452,7 +440,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
char *magichistory = NULL;
|
||||
/* The temporary string typed at the bottom of the history, if
|
||||
* any. */
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
int last_kbinput = ERR;
|
||||
/* The key we pressed before the current key. */
|
||||
size_t complete_len = 0;
|
||||
@@ -470,10 +458,6 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
|
||||
update_the_statusbar();
|
||||
|
||||
/* Refresh edit window and statusbar before getting input. */
|
||||
wnoutrefresh(edit);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
while (TRUE) {
|
||||
/* Ensure the cursor is shown when waiting for input. */
|
||||
curs_set(1);
|
||||
@@ -497,7 +481,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
if (func == do_cancel || func == do_enter)
|
||||
break;
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
if (func != do_tab)
|
||||
tabbed = FALSE;
|
||||
|
||||
@@ -518,7 +502,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
answer = input_tab(answer, allow_files, &statusbar_x,
|
||||
&tabbed, refresh_func, listed);
|
||||
} else
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#endif /* ENABLE_TABCOMP */
|
||||
#ifndef DISABLE_HISTORIES
|
||||
if (func == get_history_older_void) {
|
||||
if (history_list != NULL) {
|
||||
@@ -582,7 +566,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||
|
||||
update_the_statusbar();
|
||||
|
||||
#if !defined(DISABLE_HISTORIES) && !defined(DISABLE_TABCOMP)
|
||||
#if !defined(DISABLE_HISTORIES) && defined(ENABLE_TABCOMP)
|
||||
last_kbinput = kbinput;
|
||||
#endif
|
||||
}
|
||||
@@ -622,8 +606,9 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int retval;
|
||||
functionptrtype func = NULL;
|
||||
bool listed = FALSE;
|
||||
/* Save a possible current statusbar x position. */
|
||||
/* Save a possible current statusbar x position and prompt. */
|
||||
size_t was_statusbar_x = statusbar_x;
|
||||
char *saved_prompt = prompt;
|
||||
|
||||
bottombars(menu);
|
||||
|
||||
@@ -632,9 +617,9 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
#ifndef NANO_TINY
|
||||
redo_theprompt:
|
||||
#endif
|
||||
prompt = charalloc((COLS * mb_cur_max()) + 1);
|
||||
prompt = charalloc((COLS * MAXCHARLEN) + 1);
|
||||
va_start(ap, msg);
|
||||
vsnprintf(prompt, COLS * mb_cur_max(), msg, ap);
|
||||
vsnprintf(prompt, COLS * MAXCHARLEN, msg, ap);
|
||||
va_end(ap);
|
||||
/* Reserve five columns for colon plus angles plus answer, ":<aa>". */
|
||||
prompt[actual_x(prompt, (COLS < 5) ? 0 : COLS - 5)] = '\0';
|
||||
@@ -646,7 +631,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
refresh_func);
|
||||
|
||||
free(prompt);
|
||||
prompt = NULL;
|
||||
prompt = saved_prompt;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (retval == KEY_WINCH)
|
||||
@@ -672,7 +657,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
fprintf(stderr, "answer = \"%s\"\n", answer);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
/* If we've done tab completion, there might still be a list of
|
||||
* filename matches on the edit window. Clear them off. */
|
||||
if (listed)
|
||||
@@ -753,7 +738,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
|
||||
if (func == do_cancel)
|
||||
response = -1;
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
int mouse_x, mouse_y;
|
||||
/* We can click on the Yes/No/All shortcuts to select an answer. */
|
||||
@@ -775,7 +760,7 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
response = -2;
|
||||
}
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
#endif /* ENABLE_MOUSE */
|
||||
else {
|
||||
/* Look for the kbinput in the Yes, No (and All) strings. */
|
||||
if (strchr(yesstr, kbinput) != NULL)
|
||||
|
||||
187
src/proto.h
187
src/proto.h
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* proto.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -25,6 +24,7 @@
|
||||
#include "nano.h"
|
||||
|
||||
/* All external variables. See global.c for their descriptions. */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
extern volatile sig_atomic_t the_window_resized;
|
||||
#endif
|
||||
@@ -43,19 +43,34 @@ extern bool as_an_at;
|
||||
extern int margin;
|
||||
extern int editwincols;
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
extern bool have_palette;
|
||||
#endif
|
||||
|
||||
extern bool suppress_cursorpos;
|
||||
|
||||
extern message_type lastmessage;
|
||||
|
||||
extern filestruct *pletion_line;
|
||||
|
||||
extern bool inhelp;
|
||||
extern char *title;
|
||||
|
||||
extern int didfind;
|
||||
|
||||
extern int controlleft;
|
||||
extern int controlright;
|
||||
extern int controlup;
|
||||
extern int controldown;
|
||||
extern int controlhome;
|
||||
extern int controlend;
|
||||
#ifndef NANO_TINY
|
||||
extern int shiftcontrolleft;
|
||||
extern int shiftcontrolright;
|
||||
extern int shiftcontrolup;
|
||||
extern int shiftcontroldown;
|
||||
extern int shiftcontrolhome;
|
||||
extern int shiftcontrolend;
|
||||
extern int shiftaltleft;
|
||||
extern int shiftaltright;
|
||||
extern int shiftaltup;
|
||||
@@ -106,8 +121,6 @@ extern char *quoteerr;
|
||||
|
||||
extern char *word_chars;
|
||||
|
||||
extern bool nodelay_mode;
|
||||
|
||||
extern char *answer;
|
||||
|
||||
extern ssize_t tabsize;
|
||||
@@ -162,17 +175,13 @@ extern char *homedir;
|
||||
|
||||
typedef void (*functionptrtype)(void);
|
||||
|
||||
/* All functions in browser.c. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
char *do_browser(char *path);
|
||||
/* Most functions in browser.c. */
|
||||
#ifdef ENABLE_BROWSER
|
||||
char *do_browse_from(const char *inpath);
|
||||
void read_the_list(const char *path, DIR *dir);
|
||||
functionptrtype parse_browser_input(int *kbinput);
|
||||
void browser_refresh(void);
|
||||
void browser_select_dirname(const char *needle);
|
||||
int filesearch_init(void);
|
||||
void findnextfile(const char *needle);
|
||||
void filesearch_abort(void);
|
||||
void do_filesearch(void);
|
||||
void do_fileresearch(void);
|
||||
void do_first_file(void);
|
||||
@@ -188,18 +197,13 @@ bool using_utf8(void);
|
||||
char *addstrings(char* str1, size_t len1, char* str2, size_t len2);
|
||||
bool is_byte(int c);
|
||||
bool is_alpha_mbchar(const char *c);
|
||||
bool is_alnum_mbchar(const char *c);
|
||||
bool is_blank_mbchar(const char *c);
|
||||
bool is_ascii_cntrl_char(int c);
|
||||
bool is_cntrl_char(int c);
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
bool is_punct_mbchar(const char *c);
|
||||
bool is_word_mbchar(const char *c, bool allow_punct);
|
||||
char control_rep(const signed char c);
|
||||
char control_mbrep(const char *c, bool isdata);
|
||||
int length_of_char(const char *c, int *width);
|
||||
int mbwidth(const char *c);
|
||||
int mb_cur_max(void);
|
||||
char *make_mbchar(long chr, int *chr_mb_len);
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col);
|
||||
size_t move_mbleft(const char *buf, size_t pos);
|
||||
@@ -208,11 +212,9 @@ int mbstrcasecmp(const char *s1, const char *s2);
|
||||
int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
char *mbstrcasestr(const char *haystack, const char *needle);
|
||||
char *revstrstr(const char *haystack, const char *needle,
|
||||
const char *pointer);
|
||||
char *revstrcasestr(const char *haystack, const char *needle, const char
|
||||
*rev_start);
|
||||
char *mbrevstrcasestr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
const char *index);
|
||||
char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
const char *index);
|
||||
size_t mbstrlen(const char *s);
|
||||
size_t mbstrnlen(const char *s, size_t maxlen);
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||
@@ -220,19 +222,16 @@ char *mbstrchr(const char *s, const char *c);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
char *mbstrpbrk(const char *s, const char *accept);
|
||||
char *revstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start);
|
||||
char *mbrevstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start);
|
||||
char *revstrpbrk(const char *head, const char *accept, const char *index);
|
||||
char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
|
||||
#endif
|
||||
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
bool has_blank_chars(const char *s);
|
||||
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
bool has_blank_mbchars(const char *s);
|
||||
#endif
|
||||
#ifdef ENABLE_UTF8
|
||||
bool is_valid_unicode(wchar_t wc);
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
bool is_valid_mbstring(const char *s);
|
||||
#endif
|
||||
|
||||
@@ -246,14 +245,11 @@ void alloc_multidata_if_needed(filestruct *fileptr);
|
||||
void precalc_multicolorinfo(void);
|
||||
#endif
|
||||
|
||||
/* All functions in cut.c. */
|
||||
/* Most functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
bool keeping_cutbuffer(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_TINY
|
||||
void cut_marked(bool *right_side_up);
|
||||
void cut_to_eol(void);
|
||||
void cut_to_eof(void);
|
||||
#endif
|
||||
void do_cut_text(bool copy_text, bool cut_till_eof);
|
||||
void do_cut_text_void(void);
|
||||
@@ -264,7 +260,6 @@ void do_cut_till_eof(void);
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Most functions in files.c. */
|
||||
void make_new_buffer(void);
|
||||
void initialize_buffer_text(void);
|
||||
bool open_buffer(const char *filename, bool undoable);
|
||||
#ifndef DISABLE_SPELLER
|
||||
@@ -274,20 +269,18 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x);
|
||||
#endif
|
||||
#endif
|
||||
void display_buffer(void);
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
void prepare_for_display(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void switch_to_prev_buffer_void(void);
|
||||
void switch_to_next_buffer_void(void);
|
||||
bool close_buffer(void);
|
||||
#endif
|
||||
char *encode_data(char *buf, size_t buf_len);
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||
bool checkwritable);
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile_void(void);
|
||||
char *get_full_path(const char *origpath);
|
||||
char *check_writable_directory(const char *path);
|
||||
char *safe_tempfile(FILE **f);
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
void init_operating_dir(void);
|
||||
@@ -298,7 +291,7 @@ 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);
|
||||
int copy_file(FILE *inn, FILE *out, bool close_out);
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
kind_of_writing_type method, bool nonamechange);
|
||||
#ifndef NANO_TINY
|
||||
@@ -311,24 +304,17 @@ void do_writeout_void(void);
|
||||
void do_savefile(void);
|
||||
#endif
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER)
|
||||
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
|
||||
int diralphasort(const void *va, const void *vb);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool is_dir(const char *buf);
|
||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
size_t buf_len);
|
||||
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
*num_matches, size_t buf_len);
|
||||
#ifdef ENABLE_TABCOMP
|
||||
char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
bool *lastwastab, void (*refresh_func)(void), bool *listed);
|
||||
#endif
|
||||
const char *tail(const char *path);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, const filestruct *head);
|
||||
void save_history(void);
|
||||
int check_dotnano(void);
|
||||
void load_poshistory(void);
|
||||
@@ -358,7 +344,8 @@ void thanks_for_all_the_fish(void);
|
||||
#endif
|
||||
|
||||
/* All functions in help.c. */
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
void wrap_the_help_text(bool redisplaying);
|
||||
void do_help(void);
|
||||
void help_init(void);
|
||||
functionptrtype parse_help_input(int *kbinput);
|
||||
@@ -372,16 +359,16 @@ void do_last_line(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void do_para_begin(bool allow_update);
|
||||
void do_para_begin(bool update_screen);
|
||||
void do_para_begin_void(void);
|
||||
void do_para_end(bool allow_update);
|
||||
void do_para_end(bool update_screen);
|
||||
void do_para_end_void(void);
|
||||
#endif
|
||||
void do_prev_block(void);
|
||||
void do_next_block(void);
|
||||
void do_prev_word(bool allow_punct, bool allow_update);
|
||||
void do_prev_word(bool allow_punct, bool update_screen);
|
||||
void do_prev_word_void(void);
|
||||
bool do_next_word(bool allow_punct, bool allow_update);
|
||||
bool do_next_word(bool allow_punct, bool update_screen);
|
||||
void do_next_word_void(void);
|
||||
void do_home(bool be_clever);
|
||||
void do_home_void(void);
|
||||
@@ -398,9 +385,8 @@ void do_scroll_down(void);
|
||||
void do_left(void);
|
||||
void do_right(void);
|
||||
|
||||
/* All functions in nano.c. */
|
||||
/* Most functions in nano.c. */
|
||||
filestruct *make_new_node(filestruct *prevnode);
|
||||
filestruct *copy_node(const filestruct *src);
|
||||
void splice_node(filestruct *afterthis, filestruct *newnode);
|
||||
void unlink_node(filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
@@ -419,24 +405,15 @@ void unlink_opennode(openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
void print_view_warning(void);
|
||||
void show_restricted_warning(void);
|
||||
#ifdef DISABLE_HELP
|
||||
#ifndef ENABLE_HELP
|
||||
void say_there_is_no_help(void);
|
||||
#endif
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename, struct stat *die_stat);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
void disable_mouse_support(void);
|
||||
void enable_mouse_support(void);
|
||||
void mouse_init(void);
|
||||
#endif
|
||||
void print_opt(const char *shortflag, const char *longflag, const char *desc);
|
||||
void usage(void);
|
||||
void version(void);
|
||||
void do_exit(void);
|
||||
void close_and_go(void);
|
||||
void signal_init(void);
|
||||
RETSIGTYPE handle_hupterm(int signal);
|
||||
RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_continue(int signal);
|
||||
@@ -453,13 +430,13 @@ void enable_flow_control(void);
|
||||
void terminal_init(void);
|
||||
void unbound_key(int code);
|
||||
int do_input(bool allow_funcs);
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
int do_mouse(void);
|
||||
#endif
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls);
|
||||
|
||||
/* Most functions in prompt.c. */
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
int do_statusbar_mouse(void);
|
||||
#endif
|
||||
void do_statusbar_output(int *the_input, size_t input_len,
|
||||
@@ -479,7 +456,6 @@ void do_statusbar_verbatim_input(void);
|
||||
size_t statusbar_xplustabs(void);
|
||||
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void reinit_statusbar_x(void);
|
||||
void reset_statusbar_cursor(void);
|
||||
void update_the_statusbar(void);
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer,
|
||||
@@ -490,24 +466,18 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
/* Most functions in rcfile.c. */
|
||||
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
|
||||
char *parse_next_word(char *ptr);
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef DISABLE_COLOR
|
||||
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
|
||||
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
|
||||
#endif
|
||||
void parse_rcfile(FILE *rcstream, bool syntax_only);
|
||||
void do_rcfiles(void);
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* All functions in search.c. */
|
||||
bool regexp_init(const char *regexp);
|
||||
void regexp_cleanup(void);
|
||||
/* Most functions in search.c. */
|
||||
void not_found_msg(const char *str);
|
||||
void search_replace_abort(void);
|
||||
int search_init(bool replacing, bool use_answer);
|
||||
int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
|
||||
void do_search(void);
|
||||
@@ -517,8 +487,6 @@ void do_findnext(void);
|
||||
#endif
|
||||
void do_research(void);
|
||||
void go_looking(void);
|
||||
int replace_regexp(char *string, bool create);
|
||||
char *replace_line(const char *needle);
|
||||
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
const filestruct *real_current, size_t *real_current_x);
|
||||
void do_replace(void);
|
||||
@@ -527,9 +495,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive);
|
||||
void do_gotolinecolumn_void(void);
|
||||
#ifndef NANO_TINY
|
||||
bool find_bracket_match(bool reverse, const char *bracket_set);
|
||||
void do_find_bracket(void);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
#endif
|
||||
#endif
|
||||
@@ -537,8 +504,6 @@ char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
bool history_has_changed(void);
|
||||
void history_init(void);
|
||||
void history_reset(const filestruct *h);
|
||||
filestruct *find_history(const filestruct *h_start, const filestruct
|
||||
*h_end, const char *s, size_t len);
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
@@ -546,7 +511,7 @@ void get_history_older_void(void);
|
||||
void get_history_newer_void(void);
|
||||
#endif
|
||||
|
||||
/* All functions in text.c. */
|
||||
/* Most functions in text.c. */
|
||||
#ifndef NANO_TINY
|
||||
void do_mark(void);
|
||||
#endif
|
||||
@@ -584,7 +549,7 @@ void update_undo(undo_type action);
|
||||
void wrap_reset(void);
|
||||
bool do_wrap(filestruct *line);
|
||||
#endif
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
|
||||
#if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
|
||||
#endif
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||
@@ -592,23 +557,13 @@ size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void justify_format(filestruct *paragraph, size_t skip);
|
||||
size_t quote_length(const char *line);
|
||||
bool quotes_match(const char *a_line, size_t a_quote, const char
|
||||
*b_line);
|
||||
bool indents_match(const char *a_line, size_t a_indent, const char
|
||||
*b_line, size_t b_indent);
|
||||
bool begpar(const filestruct *const foo);
|
||||
bool inpar(const filestruct *const foo);
|
||||
void backup_lines(filestruct *first_line, size_t par_len);
|
||||
bool find_paragraph(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool do_int_spell_fix(const char *word);
|
||||
const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
@@ -650,8 +605,10 @@ size_t actual_x(const char *s, size_t column);
|
||||
size_t strnlenpt(const char *s, size_t maxlen);
|
||||
size_t strlenpt(const char *s);
|
||||
void new_magicline(void);
|
||||
#ifndef NANO_TINY
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
void remove_magicline(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
#endif
|
||||
@@ -667,34 +624,25 @@ void dump_filestruct_reverse(void);
|
||||
/* Most functions in winio.c. */
|
||||
void get_key_buffer(WINDOW *win);
|
||||
size_t get_key_buffer_len(void);
|
||||
void unget_input(int *input, size_t input_len);
|
||||
void unget_kbinput(int kbinput, bool metakey);
|
||||
int *get_input(WINDOW *win, size_t input_len);
|
||||
int get_kbinput(WINDOW *win);
|
||||
int parse_kbinput(WINDOW *win);
|
||||
int arrow_from_abcd(int kbinput);
|
||||
int parse_escape_sequence(WINDOW *win, int kbinput);
|
||||
int get_byte_kbinput(int kbinput);
|
||||
#ifdef ENABLE_UTF8
|
||||
long add_unicode_digit(int kbinput, long factor, long *uni);
|
||||
long get_unicode_kbinput(WINDOW *win, int kbinput);
|
||||
#endif
|
||||
int get_control_kbinput(int kbinput);
|
||||
void unparse_kbinput(char *output, size_t output_len);
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
|
||||
int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
#endif
|
||||
const sc *get_shortcut(int *kbinput);
|
||||
void blank_row(WINDOW *win, int y, int x, int n);
|
||||
void blank_titlebar(void);
|
||||
void blank_edit(void);
|
||||
void blank_statusbar(void);
|
||||
void blank_bottombars(void);
|
||||
void check_statusblank(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
bool dollars);
|
||||
char *display_string(const char *buf, size_t column, size_t span, bool isdata);
|
||||
void titlebar(const char *path);
|
||||
extern void set_modified(void);
|
||||
void statusbar(const char *msg);
|
||||
@@ -702,7 +650,7 @@ void warn_and_shortly_pause(const char *msg);
|
||||
void statusline(message_type importance, const char *msg, ...);
|
||||
void bottombars(int menu);
|
||||
void onekey(const char *keystroke, const char *desc, int length);
|
||||
void reset_cursor(void);
|
||||
void place_the_cursor(bool forreal);
|
||||
void edit_draw(filestruct *fileptr, const char *converted,
|
||||
int line, size_t from_col);
|
||||
int update_line(filestruct *fileptr, size_t index);
|
||||
@@ -714,10 +662,9 @@ int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
|
||||
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
|
||||
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
|
||||
void edit_scroll(scroll_dir direction, int nrows);
|
||||
#ifndef NANO_TINY
|
||||
void ensure_firstcolumn_is_aligned(void);
|
||||
bool current_is_above_screen(void);
|
||||
bool current_is_below_screen(void);
|
||||
bool current_is_offscreen(void);
|
||||
#endif
|
||||
void edit_redraw(filestruct *old_current);
|
||||
void edit_refresh(void);
|
||||
void adjust_viewport(update_type location);
|
||||
@@ -730,28 +677,34 @@ void spotlight(bool active, const char *word);
|
||||
void xon_complaint(void);
|
||||
void xoff_complaint(void);
|
||||
void do_suspend_void(void);
|
||||
void enable_nodelay(void);
|
||||
void disable_nodelay(void);
|
||||
void disable_waiting(void);
|
||||
void enable_waiting(void);
|
||||
#ifndef DISABLE_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
||||
/* May as well throw these here, since they are just placeholders. */
|
||||
/* These are just name definitions. */
|
||||
void do_cancel(void);
|
||||
void case_sens_void(void);
|
||||
void regexp_void(void);
|
||||
void backwards_void(void);
|
||||
void flip_replace(void);
|
||||
void gototext_void(void);
|
||||
#ifdef ENABLE_BROWSER
|
||||
void to_files_void(void);
|
||||
void goto_dir_void(void);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void dos_format_void(void);
|
||||
void mac_format_void(void);
|
||||
void append_void(void);
|
||||
void prepend_void(void);
|
||||
void backup_file_void(void);
|
||||
void flip_execute(void);
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
void flip_newbuffer(void);
|
||||
#endif
|
||||
void discard_buffer(void);
|
||||
void new_buffer_void(void);
|
||||
void backwards_void(void);
|
||||
void goto_dir_void(void);
|
||||
void flip_replace_void(void);
|
||||
void flip_execute_void(void);
|
||||
|
||||
#endif /* !PROTO_H */
|
||||
|
||||
27
src/rcfile.c
27
src/rcfile.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* rcfile.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014 Mike Frysinger *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
@@ -31,7 +30,7 @@
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
|
||||
#ifndef RCFILE_NAME
|
||||
#define RCFILE_NAME ".nanorc"
|
||||
@@ -45,8 +44,8 @@ static const rcoption rcopts[] = {
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
{"brackets", 0},
|
||||
#endif
|
||||
{"const", CONST_UPDATE}, /* deprecated form, remove in 2018 */
|
||||
{"constantshow", CONST_UPDATE},
|
||||
{"const", CONSTANT_SHOW}, /* deprecated form, remove in 2018 */
|
||||
{"constantshow", CONSTANT_SHOW},
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
{"fill", 0},
|
||||
#endif
|
||||
@@ -54,10 +53,10 @@ static const rcoption rcopts[] = {
|
||||
{"historylog", HISTORYLOG},
|
||||
#endif
|
||||
{"morespace", MORE_SPACE},
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
{"mouse", USE_MOUSE},
|
||||
#endif
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
{"multibuffer", MULTIBUFFER},
|
||||
#endif
|
||||
{"nohelp", NO_HELP},
|
||||
@@ -78,6 +77,7 @@ static const rcoption rcopts[] = {
|
||||
{"punct", 0},
|
||||
{"quotestr", 0},
|
||||
#endif
|
||||
{"quickblank", QUICK_BLANK},
|
||||
{"rebinddelete", REBIND_DELETE},
|
||||
{"rebindkeypad", REBIND_KEYPAD},
|
||||
{"regexp", USE_REGEXP},
|
||||
@@ -100,7 +100,6 @@ static const rcoption rcopts[] = {
|
||||
{"locking", LOCKING},
|
||||
{"matchbrackets", 0},
|
||||
{"noconvert", NO_CONVERT},
|
||||
{"quickblank", QUICK_BLANK},
|
||||
{"quiet", QUIET},
|
||||
{"showcursor", SHOW_CURSOR},
|
||||
{"smarthome", SMART_HOME},
|
||||
@@ -160,9 +159,9 @@ void rcfile_error(const char *msg, ...)
|
||||
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
|
||||
#if defined(ENABLE_NANORC) || !defined(DISABLE_HISTORIES)
|
||||
/* Parse the next word from the string, null-terminate it, and return
|
||||
* a pointer to the first character after the null terminator. The
|
||||
* returned pointer will point to '\0' if we hit the end of the line. */
|
||||
@@ -182,9 +181,9 @@ char *parse_next_word(char *ptr)
|
||||
|
||||
return ptr;
|
||||
}
|
||||
#endif /* !DISABLE_NANORC || !DISABLE_HISTORIES */
|
||||
#endif /* ENABLE_NANORC || !DISABLE_HISTORIES */
|
||||
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifdef ENABLE_NANORC
|
||||
/* Parse an argument, with optional quotes, after a keyword that takes
|
||||
* one. If the next word starts with a ", we say that it ends with the
|
||||
* last " of the line. Otherwise, we interpret it as usual, so that the
|
||||
@@ -351,7 +350,9 @@ bool is_universal(void (*func))
|
||||
{
|
||||
if (func == do_left || func == do_right ||
|
||||
func == do_home_void || func == do_end_void ||
|
||||
#ifndef NANO_TINY
|
||||
func == do_prev_word_void || func == do_next_word_void ||
|
||||
#endif
|
||||
func == do_verbatim_input || func == do_cut_text_void ||
|
||||
func == do_delete || func == do_backspace ||
|
||||
func == do_tab || func == do_enter)
|
||||
@@ -1301,4 +1302,4 @@ void do_rcfiles(void)
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* !DISABLE_NANORC */
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
59
src/search.c
59
src/search.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* search.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015, 2016, 2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -144,7 +143,8 @@ int search_init(bool replacing, bool use_answer)
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = do_prompt(FALSE, FALSE,
|
||||
replacing ? MREPLACE : MWHEREIS, backupstring,
|
||||
inhelp ? MFINDINHELP : (replacing ? MREPLACE : MWHEREIS),
|
||||
backupstring,
|
||||
#ifndef DISABLE_HISTORIES
|
||||
&search_history,
|
||||
#endif
|
||||
@@ -202,7 +202,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
} else if (func == do_replace || func == flip_replace_void) {
|
||||
} else if (func == flip_replace) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
} else if (func == do_gotolinecolumn_void) {
|
||||
@@ -234,8 +234,10 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
size_t found_x;
|
||||
/* The x coordinate of a found occurrence. */
|
||||
time_t lastkbcheck = time(NULL);
|
||||
/* The time we last looked at the keyboard. */
|
||||
|
||||
enable_nodelay();
|
||||
/* Set non-blocking input so that we can just peek for a Cancel. */
|
||||
disable_waiting();
|
||||
|
||||
if (begin == NULL)
|
||||
came_full_circle = FALSE;
|
||||
@@ -252,7 +254,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
while (input) {
|
||||
if (func_from_key(&input) == do_cancel) {
|
||||
statusbar(_("Cancelled"));
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return -2;
|
||||
}
|
||||
input = parse_kbinput(NULL);
|
||||
@@ -303,7 +305,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
/* If we're back at the beginning, then there is no needle. */
|
||||
if (came_full_circle) {
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -317,7 +319,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
* but stop when spell-checking or replacing in a region. */
|
||||
if (line == NULL) {
|
||||
if (whole_word_only || have_region) {
|
||||
disable_nodelay();
|
||||
enable_waiting();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -343,16 +345,15 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
|
||||
found_x = found - line->data;
|
||||
|
||||
enable_waiting();
|
||||
|
||||
/* Ensure that the found occurrence is not beyond the starting x. */
|
||||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && found_x > begin_x) ||
|
||||
(ISSET(BACKWARDS_SEARCH) && found_x < begin_x))) {
|
||||
not_found_msg(needle);
|
||||
disable_nodelay();
|
||||
return 0;
|
||||
}
|
||||
|
||||
disable_nodelay();
|
||||
|
||||
/* Set the current position to point at what we found. */
|
||||
openfile->current = line;
|
||||
openfile->current_x = found_x;
|
||||
@@ -361,8 +362,11 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
if (match_len != NULL)
|
||||
*match_len = found_len;
|
||||
|
||||
if (feedback > 0)
|
||||
/* Wipe the "Searching..." message and unset the suppression flag. */
|
||||
if (feedback > 0) {
|
||||
blank_statusbar();
|
||||
suppress_cursorpos = FALSE;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -438,7 +442,6 @@ void go_looking(void)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
size_t was_current_x = openfile->current_x;
|
||||
int didfind;
|
||||
#ifdef DEBUG
|
||||
clock_t start = clock();
|
||||
#endif
|
||||
@@ -856,10 +859,10 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (line < 1)
|
||||
if (line == 0)
|
||||
line = openfile->current->lineno;
|
||||
|
||||
if (column < 1)
|
||||
if (column == 0)
|
||||
column = openfile->placewewant + 1;
|
||||
}
|
||||
|
||||
@@ -884,6 +887,12 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
openfile->current_x = actual_x(openfile->current->data, column - 1);
|
||||
openfile->placewewant = column - 1;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP) && openfile->placewewant / editwincols >
|
||||
strlenpt(openfile->current->data) / editwincols)
|
||||
openfile->placewewant = strlenpt(openfile->current->data);
|
||||
#endif
|
||||
|
||||
/* When the position was manually given, center the target line. */
|
||||
if (interactive) {
|
||||
adjust_viewport(CENTERING);
|
||||
@@ -994,7 +1003,7 @@ void do_find_bracket(void)
|
||||
* the bracket at the current cursor position. */
|
||||
int wanted_ch_len;
|
||||
/* The length of wanted_ch in bytes. */
|
||||
char *bracket_set;
|
||||
char bracket_set[MAXCHARLEN * 2 + 1];
|
||||
/* The pair of characters in ch and wanted_ch. */
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
@@ -1008,8 +1017,6 @@ void do_find_bracket(void)
|
||||
/* The initial bracket count. */
|
||||
bool reverse;
|
||||
/* The direction we search. */
|
||||
char *found_ch;
|
||||
/* The character we find. */
|
||||
|
||||
assert(mbstrlen(matchbrackets) % 2 == 0);
|
||||
|
||||
@@ -1057,20 +1064,16 @@ void do_find_bracket(void)
|
||||
wanted_ch_len = parse_mbchar(wanted_ch, NULL, NULL);
|
||||
|
||||
/* Fill bracket_set in with the values of ch and wanted_ch. */
|
||||
bracket_set = charalloc((mb_cur_max() * 2) + 1);
|
||||
strncpy(bracket_set, ch, ch_len);
|
||||
strncpy(bracket_set + ch_len, wanted_ch, wanted_ch_len);
|
||||
bracket_set[ch_len + wanted_ch_len] = '\0';
|
||||
|
||||
found_ch = charalloc(mb_cur_max() + 1);
|
||||
|
||||
while (TRUE) {
|
||||
if (find_bracket_match(reverse, bracket_set)) {
|
||||
/* If we found an identical bracket, increment count. If we
|
||||
* found a complementary bracket, decrement it. */
|
||||
parse_mbchar(openfile->current->data + openfile->current_x,
|
||||
found_ch, NULL);
|
||||
count += (strncmp(found_ch, ch, ch_len) == 0) ? 1 : -1;
|
||||
count += (strncmp(openfile->current->data + openfile->current_x,
|
||||
ch, ch_len) == 0) ? 1 : -1;
|
||||
|
||||
/* If count is zero, we've found a matching bracket. Update
|
||||
* the screen and get out. */
|
||||
@@ -1088,10 +1091,6 @@ void do_find_bracket(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up. */
|
||||
free(bracket_set);
|
||||
free(found_ch);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -1235,7 +1234,7 @@ void get_history_older_void(void)
|
||||
;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifdef ENABLE_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
|
||||
* string. If there isn't one, or if len is 0, don't move h and return
|
||||
@@ -1288,5 +1287,5 @@ char *get_history_completion(filestruct **h, char *s, size_t len)
|
||||
* match, or len is 0. Return s. */
|
||||
return (char *)s;
|
||||
}
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#endif /* ENSABLE_TABCOMP */
|
||||
#endif /* !DISABLE_HISTORIES */
|
||||
|
||||
126
src/text.c
126
src/text.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* text.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015 Mark Majeres *
|
||||
* Copyright (C) 2016 Mike Scalora *
|
||||
* Copyright (C) 2015, 2016 Benno Schulenberg *
|
||||
@@ -768,11 +767,13 @@ void do_undo(void)
|
||||
break;
|
||||
}
|
||||
undidmsg = _("line break");
|
||||
size_t from_x = (u->begin == 0) ? 0 : u->mark_begin_x;
|
||||
size_t to_x = (u->begin == 0) ? u->mark_begin_x : u->begin;
|
||||
f->data = charealloc(f->data, strlen(f->data) +
|
||||
strlen(&f->next->data[u->mark_begin_x]) + 1);
|
||||
strcat(f->data, &f->next->data[u->mark_begin_x]);
|
||||
strlen(&u->strdata[from_x]) + 1);
|
||||
strcat(f->data, &u->strdata[from_x]);
|
||||
unlink_node(f->next);
|
||||
goto_line_posx(u->lineno, u->begin);
|
||||
goto_line_posx(u->lineno, to_x);
|
||||
break;
|
||||
#ifdef ENABLE_COMMENT
|
||||
case COMMENT:
|
||||
@@ -982,11 +983,8 @@ void do_enter(void)
|
||||
{
|
||||
filestruct *newnode = make_new_node(openfile->current);
|
||||
size_t extra = 0;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(ENTER);
|
||||
bool allblanks = FALSE;
|
||||
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
extra = indent_length(openfile->current->data);
|
||||
@@ -995,6 +993,8 @@ void do_enter(void)
|
||||
* indentation to the current x position. */
|
||||
if (extra > openfile->current_x)
|
||||
extra = openfile->current_x;
|
||||
else if (extra == openfile->current_x)
|
||||
allblanks = TRUE;
|
||||
}
|
||||
#endif
|
||||
newnode->data = charalloc(strlen(openfile->current->data +
|
||||
@@ -1005,13 +1005,19 @@ void do_enter(void)
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
/* Copy the whitespace from the current line to the new one. */
|
||||
strncpy(newnode->data, openfile->current->data, extra);
|
||||
openfile->totsize += extra;
|
||||
/* If there were only blanks before the cursor, trim them. */
|
||||
if (allblanks)
|
||||
openfile->current_x = 0;
|
||||
else
|
||||
openfile->totsize += extra;
|
||||
}
|
||||
#endif
|
||||
|
||||
null_at(&openfile->current->data, openfile->current_x);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(ENTER);
|
||||
|
||||
/* Adjust the mark if it was on the current line after the cursor. */
|
||||
if (openfile->mark_set && openfile->current == openfile->mark_begin &&
|
||||
openfile->current_x < openfile->mark_begin_x) {
|
||||
@@ -1134,7 +1140,9 @@ bool execute_command(const char *command)
|
||||
void discard_until(const undo *thisitem, openfilestruct *thefile)
|
||||
{
|
||||
undo *dropit = thefile->undotop;
|
||||
#ifdef ENABLE_COMMENT
|
||||
undo_group *group;
|
||||
#endif
|
||||
|
||||
while (dropit != NULL && dropit != thisitem) {
|
||||
thefile->undotop = dropit->next;
|
||||
@@ -1221,7 +1229,7 @@ void add_undo(undo_type action)
|
||||
u->xflags = WAS_FINAL_BACKSPACE;
|
||||
case DEL:
|
||||
if (openfile->current->data[openfile->current_x] != '\0') {
|
||||
char *char_buf = charalloc(mb_cur_max() + 1);
|
||||
char *char_buf = charalloc(MAXCHARLEN + 1);
|
||||
int char_len = parse_mbchar(&openfile->current->data[u->begin],
|
||||
char_buf, NULL);
|
||||
char_buf[char_len] = '\0';
|
||||
@@ -1354,7 +1362,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
|
||||
fprintf(stderr, " >> openfile->current->data = \"%s\", current_x = %lu, u->begin = %lu\n",
|
||||
openfile->current->data, (unsigned long)openfile->current_x, (unsigned long)u->begin);
|
||||
#endif
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
char *char_buf = charalloc(MAXCHARLEN);
|
||||
int char_len = parse_mbchar(&openfile->current->data[u->mark_begin_x], char_buf, NULL);
|
||||
u->strdata = addstrings(u->strdata, u->strdata ? strlen(u->strdata) : 0, char_buf, char_len);
|
||||
#ifdef DEBUG
|
||||
@@ -1366,7 +1374,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
|
||||
}
|
||||
case BACK:
|
||||
case DEL: {
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
char *char_buf = charalloc(MAXCHARLEN);
|
||||
int char_len = parse_mbchar(&openfile->current->data[openfile->current_x], char_buf, NULL);
|
||||
if (openfile->current_x == u->begin) {
|
||||
/* They deleted more: add removed character after earlier stuff. */
|
||||
@@ -1602,7 +1610,7 @@ bool do_wrap(filestruct *line)
|
||||
}
|
||||
#endif /* !DISABLE_WRAPPING */
|
||||
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
|
||||
#if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
|
||||
/* We are trying to break a chunk off line. We find the last blank such
|
||||
* that the display length to there is at most (goal + 1). If there is
|
||||
* no such blank, then we find the first blank. We then take the last
|
||||
@@ -1637,7 +1645,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
|
||||
if (column <= goal)
|
||||
return index;
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
#ifdef ENABLE_HELP
|
||||
/* If we're wrapping a help text and no blank was found, or was
|
||||
* found only as the first character, force a line break. */
|
||||
if (snap_at_nl && lastblank < 1)
|
||||
@@ -1674,7 +1682,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
|
||||
|
||||
return lastblank;
|
||||
}
|
||||
#endif /* !DISABLE_HELP || !DISABLE_WRAPJUSTIFY */
|
||||
#endif /* ENABLE_HELP || !DISABLE_WRAPJUSTIFY */
|
||||
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||
/* The "indentation" of a line is the whitespace between the quote part
|
||||
@@ -1682,25 +1690,19 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
|
||||
size_t indent_length(const char *line)
|
||||
{
|
||||
size_t len = 0;
|
||||
char *blank_mb;
|
||||
int blank_mb_len;
|
||||
|
||||
assert(line != NULL);
|
||||
|
||||
blank_mb = charalloc(mb_cur_max());
|
||||
char onechar[MAXCHARLEN];
|
||||
int charlen;
|
||||
|
||||
while (*line != '\0') {
|
||||
blank_mb_len = parse_mbchar(line, blank_mb, NULL);
|
||||
charlen = parse_mbchar(line, onechar, NULL);
|
||||
|
||||
if (!is_blank_mbchar(blank_mb))
|
||||
if (!is_blank_mbchar(onechar))
|
||||
break;
|
||||
|
||||
line += blank_mb_len;
|
||||
len += blank_mb_len;
|
||||
line += charlen;
|
||||
len += charlen;
|
||||
}
|
||||
|
||||
free(blank_mb);
|
||||
|
||||
return len;
|
||||
}
|
||||
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
|
||||
@@ -2009,13 +2011,11 @@ void backup_lines(filestruct *first_line, size_t par_len)
|
||||
for (i = par_len; i > 0 && bot != openfile->filebot; i--)
|
||||
bot = bot->next;
|
||||
|
||||
/* Move the paragraph from the current buffer's filestruct to the
|
||||
* justify buffer. */
|
||||
/* Move the paragraph from the current buffer to the justify buffer. */
|
||||
extract_buffer(&jusbuffer, &jusbottom, top, 0, bot,
|
||||
(i == 1 && bot == openfile->filebot) ? strlen(bot->data) : 0);
|
||||
|
||||
/* Copy the paragraph back to the current buffer's filestruct from
|
||||
* the justify buffer. */
|
||||
/* Copy the paragraph back to the current buffer. */
|
||||
copy_from_buffer(jusbuffer);
|
||||
|
||||
/* Move upward from the last line of the paragraph to the first
|
||||
@@ -2441,17 +2441,15 @@ void do_justify(bool full_justify)
|
||||
do {
|
||||
#endif
|
||||
statusbar(_("Can now UnJustify!"));
|
||||
reset_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
curs_set(1);
|
||||
kbinput = do_input(FALSE);
|
||||
#ifndef NANO_TINY
|
||||
} while (kbinput == KEY_WINCH);
|
||||
#endif
|
||||
|
||||
/* If needed, unset the cursor-position suppression flag, so the cursor
|
||||
* position /will/ be displayed upon a return to the main loop. */
|
||||
if (ISSET(CONST_UPDATE))
|
||||
do_cursorpos(FALSE);
|
||||
/* Unset the suppression flag after showing the Unjustify message. */
|
||||
suppress_cursorpos = FALSE;
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
@@ -3265,30 +3263,55 @@ void do_linter(void)
|
||||
SET(MULTIBUFFER);
|
||||
open_buffer(curlint->filename, FALSE);
|
||||
} else {
|
||||
char *dontwantfile = curlint->filename;
|
||||
char *dontwantfile = mallocstrcpy(NULL, curlint->filename);
|
||||
lintstruct *restlint = NULL;
|
||||
|
||||
while (curlint != NULL && !strcmp(curlint->filename, dontwantfile))
|
||||
curlint = curlint->next;
|
||||
if (curlint == NULL) {
|
||||
while (curlint != NULL) {
|
||||
if (strcmp(curlint->filename, dontwantfile) == 0) {
|
||||
if (curlint == lints)
|
||||
lints = curlint->next;
|
||||
else
|
||||
curlint->prev->next = curlint->next;
|
||||
if (curlint->next != NULL)
|
||||
curlint->next->prev = curlint->prev;
|
||||
tmplint = curlint;
|
||||
curlint = curlint->next;
|
||||
free(tmplint->msg);
|
||||
free(tmplint->filename);
|
||||
free(tmplint);
|
||||
} else {
|
||||
if (restlint == NULL)
|
||||
restlint = curlint;
|
||||
curlint = curlint->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (restlint == NULL) {
|
||||
statusbar(_("No more errors in unopened files, cancelling"));
|
||||
napms(2400);
|
||||
break;
|
||||
} else
|
||||
} else {
|
||||
curlint = restlint;
|
||||
goto new_lint_loop;
|
||||
}
|
||||
|
||||
free(dontwantfile);
|
||||
}
|
||||
} else
|
||||
openfile = tmpof;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
do_gotolinecolumn(curlint->lineno, curlint->colno, FALSE, FALSE);
|
||||
goto_line_posx(curlint->lineno, curlint->colno - 1);
|
||||
titlebar(NULL);
|
||||
adjust_viewport(CENTERING);
|
||||
edit_refresh();
|
||||
statusbar(curlint->msg);
|
||||
bottombars(MLINTER);
|
||||
}
|
||||
|
||||
/* Place and show the cursor to indicate the affected line. */
|
||||
reset_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
wnoutrefresh(edit);
|
||||
curs_set(1);
|
||||
|
||||
@@ -3363,8 +3386,10 @@ void do_formatter(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* We're not supporting partial formatting, oi vey. */
|
||||
openfile->mark_set = FALSE;
|
||||
#endif
|
||||
status = write_file(temp, temp_file, TRUE, OVERWRITE, FALSE);
|
||||
|
||||
if (!status) {
|
||||
@@ -3430,10 +3455,11 @@ void do_formatter(void)
|
||||
|
||||
set_modified();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Flush the undo stack, to avoid a mess or crash when
|
||||
* the user tries to undo things in reformatted lines. */
|
||||
discard_until(NULL, openfile);
|
||||
|
||||
#endif
|
||||
finalstatus = _("Finished formatting");
|
||||
}
|
||||
|
||||
@@ -3471,7 +3497,7 @@ void do_wordlinechar_count(void)
|
||||
filestruct *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
|
||||
/* If the mark is on, partition the filestruct so that it
|
||||
/* If the mark is on, partition the buffer so that it
|
||||
* contains only the marked text, and turn the mark off. */
|
||||
if (old_mark_set) {
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
@@ -3501,7 +3527,7 @@ void do_wordlinechar_count(void)
|
||||
nlines = openfile->filebot->lineno - openfile->fileage->lineno + 1;
|
||||
chars = get_totsize(openfile->fileage, openfile->filebot);
|
||||
|
||||
/* Unpartition the filestruct so that it contains all the text
|
||||
/* Unpartition the buffer so that it contains all the text
|
||||
* again, and turn the mark back on. */
|
||||
unpartition_filestruct(&filepart);
|
||||
openfile->mark_set = TRUE;
|
||||
@@ -3532,15 +3558,15 @@ void do_verbatim_input(void)
|
||||
/* TRANSLATORS: This is displayed when the next keystroke will be
|
||||
* inserted verbatim. */
|
||||
statusbar(_("Verbatim Input"));
|
||||
reset_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
curs_set(1);
|
||||
|
||||
/* Read in all the verbatim characters. */
|
||||
kbinput = get_verbatim_kbinput(edit, &kbinput_len);
|
||||
|
||||
/* Unsuppress cursor-position display or blank the statusbar. */
|
||||
if (ISSET(CONST_UPDATE))
|
||||
do_cursorpos(FALSE);
|
||||
if (ISSET(CONSTANT_SHOW))
|
||||
suppress_cursorpos = FALSE;
|
||||
else {
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
78
src/utils.c
78
src/utils.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* utils.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -61,30 +60,29 @@ void get_homedir(void)
|
||||
int digits(ssize_t n)
|
||||
{
|
||||
if (n < 100000) {
|
||||
if (n < 1000) {
|
||||
if (n < 100)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
} else {
|
||||
if (n < 10000)
|
||||
return 4;
|
||||
else
|
||||
return 5;
|
||||
}
|
||||
if (n < 1000) {
|
||||
if (n < 100)
|
||||
return 2;
|
||||
else
|
||||
return 3;
|
||||
} else {
|
||||
if (n < 10000)
|
||||
return 4;
|
||||
else
|
||||
return 5;
|
||||
}
|
||||
} else {
|
||||
if (n < 10000000) {
|
||||
if (n < 1000000)
|
||||
return 6;
|
||||
else
|
||||
return 7;
|
||||
}
|
||||
else {
|
||||
if (n < 100000000)
|
||||
return 8;
|
||||
else
|
||||
return 9;
|
||||
}
|
||||
if (n < 10000000) {
|
||||
if (n < 1000000)
|
||||
return 6;
|
||||
else
|
||||
return 7;
|
||||
} else {
|
||||
if (n < 100000000)
|
||||
return 8;
|
||||
else
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -118,7 +116,7 @@ bool parse_line_column(const char *str, ssize_t *line, ssize_t *column)
|
||||
const char *comma;
|
||||
|
||||
while (*str == ' ')
|
||||
str++;
|
||||
str++;
|
||||
|
||||
comma = strpbrk(str, "m,. /;");
|
||||
|
||||
@@ -215,7 +213,7 @@ const char *fixbounds(const char *r)
|
||||
* a separate word? That is: is it not part of a longer word?*/
|
||||
bool is_separate_word(size_t position, size_t length, const char *buf)
|
||||
{
|
||||
char before[mb_cur_max()], after[mb_cur_max()];
|
||||
char before[MAXCHARLEN], after[MAXCHARLEN];
|
||||
size_t word_end = position + length;
|
||||
|
||||
/* Get the characters before and after the word, if any. */
|
||||
@@ -238,6 +236,13 @@ bool is_separate_word(size_t position, size_t length, const char *buf)
|
||||
const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start)
|
||||
{
|
||||
if (*needle == '\0') {
|
||||
#ifndef NANO_TINY
|
||||
statusline(ALERT, "Searching for nothing -- please report a bug");
|
||||
#endif
|
||||
return (char *)start;
|
||||
}
|
||||
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
size_t last_find, ceiling, far_end;
|
||||
@@ -276,7 +281,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
regmatches[0].rm_eo = far_end;
|
||||
if (regexec(&search_regexp, haystack, 10, regmatches,
|
||||
REG_STARTEND) != 0)
|
||||
statusline(ALERT, "BAD: failed to refind the match!");
|
||||
return NULL;
|
||||
|
||||
return haystack + regmatches[0].rm_so;
|
||||
}
|
||||
@@ -393,10 +398,10 @@ size_t xplustabs(void)
|
||||
* not overshoot the given column. */
|
||||
size_t actual_x(const char *text, size_t column)
|
||||
{
|
||||
size_t index = 0;
|
||||
/* The index in text, returned. */
|
||||
const char *start = text;
|
||||
/* From where we start walking through the text. */
|
||||
size_t width = 0;
|
||||
/* The screen display width to text[index], in columns. */
|
||||
/* The current accumulated span, in columns. */
|
||||
|
||||
while (*text != '\0') {
|
||||
int charlen = parse_mbchar(text, NULL, &width);
|
||||
@@ -404,11 +409,10 @@ size_t actual_x(const char *text, size_t column)
|
||||
if (width > column)
|
||||
break;
|
||||
|
||||
index += charlen;
|
||||
text += charlen;
|
||||
}
|
||||
|
||||
return index;
|
||||
return (text - start);
|
||||
}
|
||||
|
||||
/* A strnlen() with tabs and multicolumn characters factored in:
|
||||
@@ -454,7 +458,7 @@ void new_magicline(void)
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
|
||||
/* Remove the magicline from filebot, if there is one and it isn't the
|
||||
* only line in the file. Assume that edittop and current are not at
|
||||
* filebot. */
|
||||
@@ -468,7 +472,9 @@ void remove_magicline(void)
|
||||
openfile->totsize--;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
|
||||
* respectively, based on the locations of top and bot. If
|
||||
* right_side_up isn't NULL, set it to TRUE if the mark begins with
|
||||
@@ -537,7 +543,7 @@ size_t get_totsize(const filestruct *begin, const filestruct *end)
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Dump the filestruct inptr to stderr. */
|
||||
/* Dump the given buffer to stderr. */
|
||||
void dump_filestruct(const filestruct *inptr)
|
||||
{
|
||||
if (inptr == openfile->fileage)
|
||||
@@ -553,7 +559,7 @@ void dump_filestruct(const filestruct *inptr)
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump the current buffer's filestruct to stderr in reverse. */
|
||||
/* Dump the current buffer to stderr in reverse. */
|
||||
void dump_filestruct_reverse(void)
|
||||
{
|
||||
const filestruct *fileptr = openfile->filebot;
|
||||
|
||||
362
src/winio.c
362
src/winio.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* winio.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016, 2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -46,10 +45,10 @@ static size_t key_buffer_len = 0;
|
||||
/* The length of the keystroke buffer. */
|
||||
static bool solitary = FALSE;
|
||||
/* Whether an Esc arrived by itself -- not as leader of a sequence. */
|
||||
static bool waiting_mode = TRUE;
|
||||
/* Whether getting a character will wait for a key to be pressed. */
|
||||
static int statusblank = 0;
|
||||
/* The number of keystrokes left before we blank the statusbar. */
|
||||
static bool suppress_cursorpos = FALSE;
|
||||
/* Should we skip constant position display for one keystroke? */
|
||||
#ifdef USING_OLD_NCURSES
|
||||
static bool seen_wide = FALSE;
|
||||
/* Whether we've seen a multicolumn character in the current line. */
|
||||
@@ -136,7 +135,7 @@ void get_key_buffer(WINDOW *win)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (input == ERR && nodelay_mode)
|
||||
if (input == ERR && !waiting_mode)
|
||||
return;
|
||||
|
||||
while (input == ERR) {
|
||||
@@ -145,7 +144,7 @@ void get_key_buffer(WINDOW *win)
|
||||
* check if errno is set to EIO ("Input/output error") and die in
|
||||
* that case, but it's not always set properly. Argh. */
|
||||
if (++errcount == MAX_BUF_SIZE)
|
||||
handle_hupterm(0);
|
||||
die(_("Too many errors from stdin"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (the_window_resized) {
|
||||
@@ -189,7 +188,7 @@ void get_key_buffer(WINDOW *win)
|
||||
}
|
||||
|
||||
/* Restore waiting mode if it was on. */
|
||||
if (!nodelay_mode)
|
||||
if (waiting_mode)
|
||||
nodelay(win, FALSE);
|
||||
|
||||
#ifdef DEBUG
|
||||
@@ -328,7 +327,7 @@ int parse_kbinput(WINDOW *win)
|
||||
/* Read in a character. */
|
||||
kbinput = get_input(win, 1);
|
||||
|
||||
if (kbinput == NULL && nodelay_mode)
|
||||
if (kbinput == NULL && !waiting_mode)
|
||||
return 0;
|
||||
|
||||
while (kbinput == NULL)
|
||||
@@ -505,6 +504,10 @@ int parse_kbinput(WINDOW *win)
|
||||
return CONTROL_UP;
|
||||
else if (retval == controldown)
|
||||
return CONTROL_DOWN;
|
||||
else if (retval == controlhome)
|
||||
return CONTROL_HOME;
|
||||
else if (retval == controlend)
|
||||
return CONTROL_END;
|
||||
#ifndef NANO_TINY
|
||||
else if (retval == shiftcontrolleft) {
|
||||
shift_held = TRUE;
|
||||
@@ -518,6 +521,12 @@ int parse_kbinput(WINDOW *win)
|
||||
} else if (retval == shiftcontroldown) {
|
||||
shift_held = TRUE;
|
||||
return CONTROL_DOWN;
|
||||
} else if (retval == shiftcontrolhome) {
|
||||
shift_held = TRUE;
|
||||
return CONTROL_HOME;
|
||||
} else if (retval == shiftcontrolend) {
|
||||
shift_held = TRUE;
|
||||
return CONTROL_END;
|
||||
} else if (retval == shiftaltleft) {
|
||||
shift_held = TRUE;
|
||||
return KEY_HOME;
|
||||
@@ -554,6 +563,10 @@ int parse_kbinput(WINDOW *win)
|
||||
return CONTROL_LEFT;
|
||||
else if (retval == KEY_RIGHT)
|
||||
return CONTROL_RIGHT;
|
||||
else if (retval == KEY_HOME)
|
||||
return CONTROL_HOME;
|
||||
else if (retval == KEY_END)
|
||||
return CONTROL_END;
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
/* Are both Shift and Alt being held? */
|
||||
@@ -690,8 +703,9 @@ int parse_kbinput(WINDOW *win)
|
||||
#ifdef KEY_RESIZE
|
||||
/* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
||||
case KEY_RESIZE:
|
||||
return ERR;
|
||||
#endif
|
||||
case KEY_F0:
|
||||
return ERR;
|
||||
}
|
||||
|
||||
return retval;
|
||||
@@ -953,6 +967,10 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
return CONTROL_RIGHT;
|
||||
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on xterm. */
|
||||
return CONTROL_LEFT;
|
||||
case 'F': /* Esc [ 1 ; 5 F == Ctrl-End on xterm. */
|
||||
return CONTROL_END;
|
||||
case 'H': /* Esc [ 1 ; 5 H == Ctrl-Home on xterm. */
|
||||
return CONTROL_HOME;
|
||||
}
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
@@ -966,6 +984,10 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
return shiftcontrolright;
|
||||
case 'D': /* Esc [ 1 ; 6 D == Shift-Ctrl-Left on xterm. */
|
||||
return shiftcontrolleft;
|
||||
case 'F': /* Esc [ 1 ; 6 F == Shift-Ctrl-End on xterm. */
|
||||
return shiftcontrolend;
|
||||
case 'H': /* Esc [ 1 ; 6 H == Shift-Ctrl-Home on xterm. */
|
||||
return shiftcontrolhome;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -1030,19 +1052,35 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
return KEY_NPAGE;
|
||||
break;
|
||||
case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt,
|
||||
* Esc [ 7 $ == Shift-Home on Eterm/rxvt. */
|
||||
case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt;
|
||||
* Esc [ 7 $ == Shift-Home on Eterm/rxvt;
|
||||
* Esc [ 7 ^ == Control-Home on Eterm/rxvt;
|
||||
* Esc [ 7 @ == Shift-Control-Home on same. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
return KEY_HOME;
|
||||
else if (seq_len > 2 && seq[2] == '$')
|
||||
return SHIFT_HOME;
|
||||
else if (seq_len > 2 && seq[2] == '^')
|
||||
return CONTROL_HOME;
|
||||
#ifndef NANO_TINY
|
||||
else if (seq_len > 2 && seq[2] == '@')
|
||||
return shiftcontrolhome;
|
||||
#endif
|
||||
break;
|
||||
case '8': /* Esc [ 8 ~ == End on Eterm/rxvt.
|
||||
* Esc [ 8 $ == Shift-End on Eterm/rxvt. */
|
||||
case '8': /* Esc [ 8 ~ == End on Eterm/rxvt;
|
||||
* Esc [ 8 $ == Shift-End on Eterm/rxvt;
|
||||
* Esc [ 8 ^ == Control-End on Eterm/rxvt;
|
||||
* Esc [ 8 @ == Shift-Control-End on same. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
return KEY_END;
|
||||
else if (seq_len > 2 && seq[2] == '$')
|
||||
return SHIFT_END;
|
||||
else if (seq_len > 2 && seq[2] == '^')
|
||||
return CONTROL_END;
|
||||
#ifndef NANO_TINY
|
||||
else if (seq_len > 2 && seq[2] == '@')
|
||||
return shiftcontrolend;
|
||||
#endif
|
||||
break;
|
||||
case '9': /* Esc [ 9 == Delete on Mach console. */
|
||||
return KEY_DC;
|
||||
@@ -1198,7 +1236,7 @@ int parse_escape_sequence(WINDOW *win, int kbinput)
|
||||
suppress_cursorpos = FALSE;
|
||||
lastmessage = HUSH;
|
||||
if (currmenu == MMAIN) {
|
||||
reset_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
curs_set(1);
|
||||
}
|
||||
}
|
||||
@@ -1408,26 +1446,6 @@ int get_control_kbinput(int kbinput)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Put the output-formatted characters in output back into the keystroke
|
||||
* buffer, so that they can be parsed and displayed as output again. */
|
||||
void unparse_kbinput(char *output, size_t output_len)
|
||||
{
|
||||
int *input;
|
||||
size_t i;
|
||||
|
||||
if (output_len == 0)
|
||||
return;
|
||||
|
||||
input = (int *)nmalloc(output_len * sizeof(int));
|
||||
|
||||
for (i = 0; i < output_len; i++)
|
||||
input[i] = (int)output[i];
|
||||
|
||||
unget_input(input, output_len);
|
||||
|
||||
free(input);
|
||||
}
|
||||
|
||||
/* Read in a stream of characters verbatim, and return the length of the
|
||||
* string in kbinput_len. Assume nodelay(win) is FALSE. */
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
||||
@@ -1446,7 +1464,8 @@ int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
||||
retval = parse_verbatim_kbinput(win, kbinput_len);
|
||||
|
||||
/* If the code is invalid in the current mode, discard it. */
|
||||
if ((*retval == '\n' && as_an_at) || (*retval == '\0' && !as_an_at)) {
|
||||
if (retval != NULL && ((*retval == '\n' && as_an_at) ||
|
||||
(*retval == '\0' && !as_an_at))) {
|
||||
*kbinput_len = 0;
|
||||
beep();
|
||||
}
|
||||
@@ -1535,7 +1554,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *count)
|
||||
return get_input(NULL, *count);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_MOUSE
|
||||
#ifdef ENABLE_MOUSE
|
||||
/* Handle any mouse event that may have occurred. We currently handle
|
||||
* releases/clicks of the first mouse button. If allow_shortcuts is
|
||||
* TRUE, releasing/clicking on a visible shortcut will put back the
|
||||
@@ -1689,7 +1708,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||
/* Ignore all other mouse events. */
|
||||
return 2;
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
#endif /* ENABLE_MOUSE */
|
||||
|
||||
/* Return the shortcut that corresponds to the values of kbinput (the
|
||||
* key itself) and meta_key (whether the key is a meta sequence). The
|
||||
@@ -1774,14 +1793,12 @@ void check_statusblank(void)
|
||||
statusblank--;
|
||||
|
||||
/* When editing and 'constantshow' is active, skip the blanking. */
|
||||
if (currmenu == MMAIN && ISSET(CONST_UPDATE))
|
||||
if (currmenu == MMAIN && ISSET(CONSTANT_SHOW))
|
||||
return;
|
||||
|
||||
if (statusblank == 0) {
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
reset_cursor();
|
||||
wnoutrefresh(edit);
|
||||
}
|
||||
|
||||
/* If the subwindows overlap, make sure to show the edit window now. */
|
||||
@@ -1789,68 +1806,60 @@ void check_statusblank(void)
|
||||
edit_refresh();
|
||||
}
|
||||
|
||||
/* Convert buf into a string that can be displayed on screen. The
|
||||
* caller wants to display buf starting with column start_col, and
|
||||
* extending for at most span columns. start_col is zero-based. span
|
||||
* is one-based, so span == 0 means you get "" returned. The returned
|
||||
* string is dynamically allocated, and should be freed. If isdata is
|
||||
* TRUE, the caller might put "$" at the beginning or end of the line if
|
||||
* it's too long. */
|
||||
char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
bool isdata)
|
||||
/* Convert buf into a string that can be displayed on screen. The caller
|
||||
* wants to display buf starting with the given column, and extending for
|
||||
* at most span columns. column is zero-based, and span is one-based, so
|
||||
* span == 0 means you get "" returned. The returned string is dynamically
|
||||
* allocated, and should be freed. If isdata is TRUE, the caller might put
|
||||
* "$" at the beginning or end of the line if it's too long. */
|
||||
char *display_string(const char *buf, size_t column, size_t span, bool isdata)
|
||||
{
|
||||
size_t start_index;
|
||||
/* Index in buf of the first character shown. */
|
||||
size_t column;
|
||||
/* Screen column that start_index corresponds to. */
|
||||
size_t start_index = actual_x(buf, column);
|
||||
/* The index of the first character that the caller wishes to show. */
|
||||
size_t start_col = strnlenpt(buf, start_index);
|
||||
/* The actual column where that first character starts. */
|
||||
char *converted;
|
||||
/* The string we return. */
|
||||
size_t index;
|
||||
/* The expanded string we will return. */
|
||||
size_t index = 0;
|
||||
/* Current position in converted. */
|
||||
size_t beyond = start_col + span;
|
||||
size_t beyond = column + span;
|
||||
/* The column number just beyond the last shown character. */
|
||||
|
||||
start_index = actual_x(buf, start_col);
|
||||
column = strnlenpt(buf, start_index);
|
||||
|
||||
assert(column <= start_col);
|
||||
|
||||
index = 0;
|
||||
#ifdef USING_OLD_NCURSES
|
||||
seen_wide = FALSE;
|
||||
#endif
|
||||
buf += start_index;
|
||||
|
||||
/* Allocate enough space for converting the relevant part of the line. */
|
||||
converted = charalloc(strlen(buf) * (mb_cur_max() + tabsize) + 1);
|
||||
converted = charalloc(strlen(buf) * (MAXCHARLEN + tabsize) + 1);
|
||||
|
||||
/* If the first character starts before the left edge, or would be
|
||||
* overwritten by a "$" token, then show spaces instead. */
|
||||
if (*buf != '\0' && *buf != '\t' && (column < start_col ||
|
||||
(column > 0 && isdata && !ISSET(SOFTWRAP)))) {
|
||||
* overwritten by a "$" token, then show placeholders instead. */
|
||||
if (*buf != '\0' && *buf != '\t' && (start_col < column ||
|
||||
(start_col > 0 && isdata && !ISSET(SOFTWRAP)))) {
|
||||
if (is_cntrl_mbchar(buf)) {
|
||||
if (column < start_col) {
|
||||
if (start_col < column) {
|
||||
converted[index++] = control_mbrep(buf, isdata);
|
||||
start_col++;
|
||||
column++;
|
||||
buf += parse_mbchar(buf, NULL, NULL);
|
||||
}
|
||||
}
|
||||
#ifdef ENABLE_UTF8
|
||||
else if (using_utf8() && mbwidth(buf) == 2) {
|
||||
if (column >= start_col) {
|
||||
else if (mbwidth(buf) == 2) {
|
||||
if (start_col == column) {
|
||||
converted[index++] = ' ';
|
||||
start_col++;
|
||||
column++;
|
||||
}
|
||||
|
||||
converted[index++] = ' ';
|
||||
start_col++;
|
||||
|
||||
/* Display the right half of a two-column character as '<'. */
|
||||
converted[index++] = '<';
|
||||
column++;
|
||||
buf += parse_mbchar(buf, NULL, NULL);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
while (*buf != '\0' && start_col < beyond) {
|
||||
while (*buf != '\0' && column < beyond) {
|
||||
int charlength, charwidth = 1;
|
||||
|
||||
if (*buf == ' ') {
|
||||
@@ -1864,7 +1873,7 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
} else
|
||||
#endif
|
||||
converted[index++] = ' ';
|
||||
start_col++;
|
||||
column++;
|
||||
buf++;
|
||||
continue;
|
||||
} else if (*buf == '\t') {
|
||||
@@ -1878,11 +1887,11 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
} else
|
||||
#endif
|
||||
converted[index++] = ' ';
|
||||
start_col++;
|
||||
column++;
|
||||
/* Fill the tab up with the required number of spaces. */
|
||||
while (start_col % tabsize != 0) {
|
||||
while (column % tabsize != 0) {
|
||||
converted[index++] = ' ';
|
||||
start_col++;
|
||||
column++;
|
||||
}
|
||||
buf++;
|
||||
continue;
|
||||
@@ -1894,7 +1903,7 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
if (is_cntrl_mbchar(buf)) {
|
||||
converted[index++] = '^';
|
||||
converted[index++] = control_mbrep(buf, isdata);
|
||||
start_col += 2;
|
||||
column += 2;
|
||||
buf += charlength;
|
||||
continue;
|
||||
}
|
||||
@@ -1904,7 +1913,7 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
for (; charlength > 0; charlength--)
|
||||
converted[index++] = *(buf++);
|
||||
|
||||
start_col += charwidth;
|
||||
column += charwidth;
|
||||
#ifdef USING_OLD_NCURSES
|
||||
if (charwidth > 1)
|
||||
seen_wide = TRUE;
|
||||
@@ -1916,8 +1925,7 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
converted[index++] = '\xEF';
|
||||
converted[index++] = '\xBF';
|
||||
converted[index++] = '\xBD';
|
||||
|
||||
start_col += 1;
|
||||
column++;
|
||||
buf++;
|
||||
|
||||
/* For invalid codepoints, skip extra bytes. */
|
||||
@@ -1925,10 +1933,17 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
buf += charlength + 7;
|
||||
}
|
||||
|
||||
/* If there is more text than can be shown, make room for the $. */
|
||||
if (*buf != '\0' && isdata && !ISSET(SOFTWRAP))
|
||||
/* If there is more text than can be shown, make room for the $ or >. */
|
||||
if (*buf != '\0' && (column > beyond || (isdata && !ISSET(SOFTWRAP)))) {
|
||||
index = move_mbleft(converted, index);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Display the left half of a two-column character as '>'. */
|
||||
if (mbwidth(converted + index) == 2)
|
||||
converted[index++] = '>';
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Null-terminate the converted string. */
|
||||
converted[index] = '\0';
|
||||
|
||||
@@ -1937,10 +1952,9 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
|
||||
/* If path is NULL, we're in normal editing mode, so display the current
|
||||
* version of nano, the current filename, and whether the current file
|
||||
* has been modified on the titlebar. If path isn't NULL, we're in the
|
||||
* file browser, and path contains the directory to start the file
|
||||
* browser in, so display the current version of nano and the contents
|
||||
* of path on the titlebar. */
|
||||
* has been modified on the titlebar. If path isn't NULL, we're either
|
||||
* in the file browser or the help viewer, so show either the current
|
||||
* directory or the title of help text, that is: whatever is in path. */
|
||||
void titlebar(const char *path)
|
||||
{
|
||||
size_t verlen, prefixlen, pathlen, statelen;
|
||||
@@ -1949,6 +1963,8 @@ void titlebar(const char *path)
|
||||
/* The width that "Modified" would take up. */
|
||||
size_t offset = 0;
|
||||
/* The position at which the center part of the titlebar starts. */
|
||||
const char *branding = BRANDING;
|
||||
/* What is shown in the top left corner. */
|
||||
const char *prefix = "";
|
||||
/* What is shown before the path -- "File:", "DIR:", or "". */
|
||||
const char *state = "";
|
||||
@@ -1972,12 +1988,13 @@ void titlebar(const char *path)
|
||||
* then sacrifice the prefix, and only then start dottifying. */
|
||||
|
||||
/* Figure out the path, prefix and state strings. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (path != NULL)
|
||||
if (inhelp)
|
||||
branding = "";
|
||||
#ifdef ENABLE_BROWSER
|
||||
else if (path != NULL)
|
||||
prefix = _("DIR:");
|
||||
else
|
||||
#endif
|
||||
{
|
||||
else {
|
||||
if (openfile->filename[0] == '\0')
|
||||
path = _("New Buffer");
|
||||
else {
|
||||
@@ -1994,11 +2011,11 @@ void titlebar(const char *path)
|
||||
}
|
||||
|
||||
/* Determine the widths of the four elements, including their padding. */
|
||||
verlen = strlenpt(BRANDING) + 3;
|
||||
verlen = strlenpt(branding) + 3;
|
||||
prefixlen = strlenpt(prefix);
|
||||
if (prefixlen > 0)
|
||||
prefixlen++;
|
||||
pathlen= strlenpt(path);
|
||||
pathlen = strlenpt(path);
|
||||
statelen = strlenpt(state) + 2;
|
||||
if (statelen > 2) {
|
||||
pathlen++;
|
||||
@@ -2007,7 +2024,7 @@ void titlebar(const char *path)
|
||||
|
||||
/* Only print the version message when there is room for it. */
|
||||
if (verlen + prefixlen + pathlen + pluglen + statelen <= COLS)
|
||||
mvwaddstr(topwin, 0, 2, BRANDING);
|
||||
mvwaddstr(topwin, 0, 2, branding);
|
||||
else {
|
||||
verlen = 2;
|
||||
/* If things don't fit yet, give up the placeholder. */
|
||||
@@ -2054,9 +2071,7 @@ void titlebar(const char *path)
|
||||
|
||||
wattroff(topwin, interface_color_pair[TITLE_BAR]);
|
||||
|
||||
wnoutrefresh(topwin);
|
||||
reset_cursor();
|
||||
wnoutrefresh(edit);
|
||||
wrefresh(topwin);
|
||||
}
|
||||
|
||||
/* Display a normal message on the statusbar, quietly. */
|
||||
@@ -2128,8 +2143,8 @@ void statusline(message_type importance, const char *msg, ...)
|
||||
blank_statusbar();
|
||||
|
||||
/* Construct the message out of all the arguments. */
|
||||
compound = charalloc(mb_cur_max() * (COLS + 1));
|
||||
vsnprintf(compound, mb_cur_max() * (COLS + 1), msg, ap);
|
||||
compound = charalloc(MAXCHARLEN * (COLS + 1));
|
||||
vsnprintf(compound, MAXCHARLEN * (COLS + 1), msg, ap);
|
||||
va_end(ap);
|
||||
message = display_string(compound, 0, COLS, FALSE);
|
||||
free(compound);
|
||||
@@ -2148,21 +2163,20 @@ void statusline(message_type importance, const char *msg, ...)
|
||||
wattroff(bottomwin, interface_color_pair[STATUS_BAR]);
|
||||
|
||||
/* Push the message to the screen straightaway. */
|
||||
wnoutrefresh(bottomwin);
|
||||
doupdate();
|
||||
wrefresh(bottomwin);
|
||||
|
||||
suppress_cursorpos = TRUE;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (old_whitespace)
|
||||
SET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
|
||||
/* If doing quick blanking, blank the statusbar after just one keystroke.
|
||||
* Otherwise, blank it after twenty-six keystrokes, as Pico does. */
|
||||
if (ISSET(QUICK_BLANK))
|
||||
statusblank = 1;
|
||||
else
|
||||
#endif
|
||||
statusblank = 26;
|
||||
}
|
||||
|
||||
@@ -2227,11 +2241,7 @@ void bottombars(int menu)
|
||||
|
||||
/* Defeat a VTE bug by moving the cursor and forcing a screen update. */
|
||||
wmove(bottomwin, 0, 0);
|
||||
wnoutrefresh(bottomwin);
|
||||
doupdate();
|
||||
|
||||
reset_cursor();
|
||||
wnoutrefresh(edit);
|
||||
wrefresh(bottomwin);
|
||||
}
|
||||
|
||||
/* Write a shortcut key to the help area at the bottom of the window.
|
||||
@@ -2259,7 +2269,7 @@ void onekey(const char *keystroke, const char *desc, int length)
|
||||
|
||||
/* Redetermine current_y from the position of current relative to edittop,
|
||||
* and put the cursor in the edit window at (current_y, "current_x"). */
|
||||
void reset_cursor(void)
|
||||
void place_the_cursor(bool forreal)
|
||||
{
|
||||
ssize_t row = 0;
|
||||
size_t col, xpt = xplustabs();
|
||||
@@ -2279,6 +2289,12 @@ void reset_cursor(void)
|
||||
/* Add the number of wraps in the current line before the cursor. */
|
||||
row += xpt / editwincols;
|
||||
col = xpt % editwincols;
|
||||
|
||||
/* If the cursor ought to be in column zero, nudge it there. */
|
||||
if (forreal && openfile->placewewant % editwincols == 0 && col != 0) {
|
||||
row++;
|
||||
col = 0;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -2289,7 +2305,8 @@ void reset_cursor(void)
|
||||
if (row < editwinrows)
|
||||
wmove(edit, row, margin + col);
|
||||
|
||||
openfile->current_y = row;
|
||||
if (forreal)
|
||||
openfile->current_y = row;
|
||||
}
|
||||
|
||||
/* edit_draw() takes care of the job of actually painting a line into
|
||||
@@ -2668,8 +2685,10 @@ int update_line(filestruct *fileptr, size_t index)
|
||||
|
||||
/* If the line is offscreen, don't even try to display it. */
|
||||
if (row < 0 || row >= editwinrows) {
|
||||
#ifndef NANO_TINY
|
||||
statusline(ALERT, "Badness: tried to display a line on row %i"
|
||||
" -- please report a bug", row);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2883,9 +2902,17 @@ void edit_scroll(scroll_dir direction, int nrows)
|
||||
nrows -= go_forward_chunks(nrows, &openfile->edittop, &openfile->firstcolumn);
|
||||
|
||||
/* Don't bother scrolling zero rows, nor more than the window can hold. */
|
||||
if (nrows == 0)
|
||||
if (nrows == 0) {
|
||||
#ifndef NANO_TINY
|
||||
statusline(ALERT, "Underscrolling -- please report a bug");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if (nrows >= editwinrows) {
|
||||
#ifndef NANO_TINY
|
||||
if (editwinrows > 1)
|
||||
statusline(ALERT, "Overscrolling -- please report a bug");
|
||||
#endif
|
||||
refresh_needed = TRUE;
|
||||
return;
|
||||
}
|
||||
@@ -2912,10 +2939,12 @@ void edit_scroll(scroll_dir direction, int nrows)
|
||||
go_forward_chunks(editwinrows - nrows, &line, &leftedge);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Compensate for the earlier onscreen chunks of a softwrapped line
|
||||
* when the first blank row happens to be in the middle of that line. */
|
||||
if (ISSET(SOFTWRAP) && line != openfile->edittop)
|
||||
nrows += leftedge / editwincols;
|
||||
/* Compensate for the earlier chunks of a softwrapped line. */
|
||||
nrows += leftedge / editwincols;
|
||||
|
||||
/* Don't compensate for the chunks that are offscreen. */
|
||||
if (line == openfile->edittop)
|
||||
nrows -= openfile->firstcolumn / editwincols;
|
||||
#endif
|
||||
|
||||
/* Draw new content on the blank rows inside the scrolled region
|
||||
@@ -2927,16 +2956,19 @@ void edit_scroll(scroll_dir direction, int nrows)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Ensure that firstcolumn is at the starting column of the softwrapped chunk
|
||||
* it's on. We need to do this when the number of columns of the edit window
|
||||
* has changed, because then the width of softwrapped chunks has changed. */
|
||||
void ensure_firstcolumn_is_aligned(void)
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->firstcolumn % editwincols != 0)
|
||||
openfile->firstcolumn -= (openfile->firstcolumn % editwincols);
|
||||
#endif
|
||||
|
||||
/* If smooth scrolling is on, make sure the viewport doesn't center. */
|
||||
focusing = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return TRUE if current[current_x] is above the top of the screen, and FALSE
|
||||
* otherwise. */
|
||||
@@ -3030,6 +3062,12 @@ void edit_refresh(void)
|
||||
filestruct *line;
|
||||
int row = 0;
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
/* When needed, initialize the colors for the current syntax. */
|
||||
if (!have_palette)
|
||||
color_init();
|
||||
#endif
|
||||
|
||||
/* If the current line is out of view, get it back on screen. */
|
||||
if (current_is_offscreen()) {
|
||||
#ifdef DEBUG
|
||||
@@ -3056,44 +3094,29 @@ void edit_refresh(void)
|
||||
while (row < editwinrows)
|
||||
blank_row(edit, row++, 0, COLS);
|
||||
|
||||
reset_cursor();
|
||||
place_the_cursor(TRUE);
|
||||
wnoutrefresh(edit);
|
||||
|
||||
refresh_needed = FALSE;
|
||||
}
|
||||
|
||||
/* Move edittop so that current is on the screen. manner says how it
|
||||
* should be moved: CENTERING means that current should end up in the
|
||||
* middle of the screen, STATIONARY means that it should stay at the
|
||||
* same vertical position, and FLOWING means that it should scroll no
|
||||
* more than needed to bring current into view. */
|
||||
/* Move edittop so that current is on the screen. manner says how:
|
||||
* STATIONARY means that the cursor should stay on the same screen row,
|
||||
* CENTERING means that current should end up in the middle of the screen,
|
||||
* and FLOWING means that it should scroll no more than needed to bring
|
||||
* current into view. */
|
||||
void adjust_viewport(update_type manner)
|
||||
{
|
||||
int goal = 0;
|
||||
|
||||
/* If manner is CENTERING, move edittop half the number of window rows
|
||||
* back from current. If manner is FLOWING, move edittop back 0 rows
|
||||
* or (editwinrows - 1) rows, depending on where current has moved.
|
||||
* This puts the cursor on the first or the last row. If manner is
|
||||
* STATIONARY, move edittop back current_y rows if current_y is in range
|
||||
* of the screen, 0 rows if current_y is below zero, or (editwinrows - 1)
|
||||
* rows if current_y is too big. This puts current at the same place on
|
||||
* the screen as before, or... at some undefined place. */
|
||||
if (manner == CENTERING)
|
||||
goal = editwinrows / 2;
|
||||
else if (manner == FLOWING) {
|
||||
if (!current_is_above_screen())
|
||||
goal = editwinrows - 1;
|
||||
} else {
|
||||
if (manner == STATIONARY)
|
||||
goal = openfile->current_y;
|
||||
|
||||
/* Limit goal to (editwinrows - 1) rows maximum. */
|
||||
if (goal > editwinrows - 1)
|
||||
goal = editwinrows - 1;
|
||||
}
|
||||
else if (manner == CENTERING)
|
||||
goal = editwinrows / 2;
|
||||
else if (!current_is_above_screen())
|
||||
goal = editwinrows - 1;
|
||||
|
||||
openfile->edittop = openfile->current;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SOFTWRAP))
|
||||
openfile->firstcolumn = (xplustabs() / editwincols) * editwincols;
|
||||
@@ -3120,13 +3143,20 @@ void total_redraw(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Unconditionally redraw the entire screen, and then refresh it using
|
||||
* the current file. */
|
||||
/* Redraw the entire screen, then refresh the title bar and the content of
|
||||
* the edit window (when not in the file browser), and the bottom bars. */
|
||||
void total_refresh(void)
|
||||
{
|
||||
total_redraw();
|
||||
titlebar(NULL);
|
||||
edit_refresh();
|
||||
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
|
||||
titlebar(title);
|
||||
#ifdef ENABLE_HELP
|
||||
if (inhelp)
|
||||
wrap_the_help_text(TRUE);
|
||||
else
|
||||
#endif
|
||||
if (currmenu != MBROWSER && currmenu != MWHEREISFILE && currmenu != MGOTODIR)
|
||||
edit_refresh();
|
||||
bottombars(currmenu);
|
||||
}
|
||||
|
||||
@@ -3155,7 +3185,14 @@ void do_cursorpos(bool force)
|
||||
size_t cur_lenpt = strlenpt(openfile->current->data) + 1;
|
||||
int linepct, colpct, charpct;
|
||||
|
||||
assert(openfile->fileage != NULL && openfile->current != NULL);
|
||||
/* If the showing needs to be suppressed, don't suppress it next time. */
|
||||
if (suppress_cursorpos && !force) {
|
||||
suppress_cursorpos = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Hide the cursor while we are calculating. */
|
||||
curs_set(0);
|
||||
|
||||
/* Determine the size of the file up to the cursor. */
|
||||
saved_byte = openfile->current->data[openfile->current_x];
|
||||
@@ -3169,12 +3206,6 @@ void do_cursorpos(bool force)
|
||||
if (openfile->current != openfile->filebot)
|
||||
sum--;
|
||||
|
||||
/* If the showing needs to be suppressed, don't suppress it next time. */
|
||||
if (suppress_cursorpos && !force) {
|
||||
suppress_cursorpos = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Display the current cursor position on the statusbar. */
|
||||
linepct = 100 * openfile->current->lineno / openfile->filebot->lineno;
|
||||
colpct = 100 * cur_xpt / cur_lenpt;
|
||||
@@ -3197,15 +3228,15 @@ void do_cursorpos_void(void)
|
||||
do_cursorpos(TRUE);
|
||||
}
|
||||
|
||||
void enable_nodelay(void)
|
||||
void disable_waiting(void)
|
||||
{
|
||||
nodelay_mode = TRUE;
|
||||
waiting_mode = FALSE;
|
||||
nodelay(edit, TRUE);
|
||||
}
|
||||
|
||||
void disable_nodelay(void)
|
||||
void enable_waiting(void)
|
||||
{
|
||||
nodelay_mode = FALSE;
|
||||
waiting_mode = TRUE;
|
||||
nodelay(edit, FALSE);
|
||||
}
|
||||
|
||||
@@ -3225,7 +3256,7 @@ void spotlight(bool active, const char *word)
|
||||
room--;
|
||||
}
|
||||
|
||||
reset_cursor();
|
||||
place_the_cursor(FALSE);
|
||||
|
||||
if (active)
|
||||
wattron(edit, hilite_attribute);
|
||||
@@ -3304,7 +3335,7 @@ void do_credits(void)
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"(C) 1999 - 2016",
|
||||
"(C) 2017",
|
||||
"Free Software Foundation, Inc.",
|
||||
"",
|
||||
"",
|
||||
@@ -3351,12 +3382,9 @@ void do_credits(void)
|
||||
const char *what;
|
||||
size_t start_col;
|
||||
|
||||
if (credits[crpos] == NULL) {
|
||||
assert(0 <= xlpos && xlpos < XLCREDIT_LEN);
|
||||
|
||||
what = _(xlcredits[xlpos]);
|
||||
xlpos++;
|
||||
} else
|
||||
if (credits[crpos] == NULL)
|
||||
what = _(xlcredits[xlpos++]);
|
||||
else
|
||||
what = credits[crpos];
|
||||
|
||||
start_col = COLS / 2 - strlenpt(what) / 2 - 1;
|
||||
|
||||
@@ -22,6 +22,7 @@ pkgdata_DATA = asm.nanorc \
|
||||
man.nanorc \
|
||||
mgp.nanorc \
|
||||
mutt.nanorc \
|
||||
nanohelp.nanorc \
|
||||
nanorc.nanorc \
|
||||
nftables.nanorc \
|
||||
objc.nanorc \
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
## A default syntax, which is used
|
||||
## for files that do not match any other syntax.
|
||||
## An example of a default syntax. The default syntax is used for
|
||||
## files that do not match any other syntax.
|
||||
|
||||
syntax "default"
|
||||
comment "#"
|
||||
|
||||
# Comments.
|
||||
color cyan "^[[:space:]]*#.*"
|
||||
|
||||
# Spaces in front of tabs.
|
||||
color ,red " + +"
|
||||
|
||||
# Nano's name, including version.
|
||||
color brightred "(GNU )?nano [1-9]\.[0-9]\.[^[:space:][:punct:]]+"
|
||||
|
||||
# Email addresses.
|
||||
color yellow "<[[:alnum:].%_+-]+@[[:alnum:].-]+\.[[:alpha:]]{2,}>"
|
||||
|
||||
@@ -7,7 +7,7 @@ color red "[:=]"
|
||||
color magenta "\<(if|ifeq|else|endif)\>"
|
||||
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
|
||||
color brightblue "^[^ ]+:"
|
||||
color green "#.*$"
|
||||
color green "(^|[[:space:]]+)#.*"
|
||||
|
||||
## Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
12
syntax/nanohelp.nanorc
Normal file
12
syntax/nanohelp.nanorc
Normal file
@@ -0,0 +1,12 @@
|
||||
## This is meant for highlighting key combos in a nano help text.
|
||||
|
||||
# It should not apply to any normal file, so no fileregex.
|
||||
syntax "nanohelp"
|
||||
|
||||
# Key combos:
|
||||
color cyan "\^([]4-8A-Z^\_←→↑↓]|Home|End)" "[←→↑↓]"
|
||||
color cyan "\<(Tab|Enter|Home|End|Ins|Del|Bsp|PgUp|PgDn)\>"
|
||||
color cyan "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
|
||||
|
||||
# Quoted indicators:
|
||||
color brightred "'(\^|M-)'"
|
||||
@@ -1,32 +1,35 @@
|
||||
## Here is an example for PHP.
|
||||
|
||||
syntax "php" "\.php[2345s~]?$"
|
||||
syntax "php" "\.ph(p[23457s~]?|tml)$"
|
||||
magic "PHP script text"
|
||||
comment "//"
|
||||
|
||||
# PHP markings.
|
||||
color brightgreen "(<\?(php)?|\?>)"
|
||||
|
||||
# Functions.
|
||||
# Function names.
|
||||
color white "\<[a-z_]*\("
|
||||
# Variable names.
|
||||
color cyan "\$[a-z_]+"
|
||||
|
||||
# Types.
|
||||
color green "\<(var|float|global|double|bool|char|int|enum|const)\>"
|
||||
color green "\<(array|bool|callable|const|float|global|int|object|string|var)\>"
|
||||
|
||||
# Structure.
|
||||
color brightyellow "\<(class|new|private|public|function|for|foreach|if|while|do|else|elseif|case|default|switch)\>"
|
||||
# Directives and structure.
|
||||
color brightyellow "\<(abstract|as|class|clone|(end)?declare|extends|function|implements|include(_once)?|inst(ance|ead)of|interface|namespace|new|private|protected|public|require(_once)?|static|trait|use|yield)\>"
|
||||
color brightyellow "\<(case|catch|default|do|echo|else(if)?|end(for(each)?|if|switch|while)|final(ly)?|for(each)?|if|print|switch|throw|try|while)\>"
|
||||
# Operators.
|
||||
color brightyellow "\<(and|or|xor)\>"
|
||||
|
||||
# Control flow.
|
||||
color magenta "\<(goto|continue|break|return)\>"
|
||||
color magenta "\<(break|continue|goto|return)\>"
|
||||
|
||||
# Strings.
|
||||
color brightyellow "<[^= ]*>" ""(\.|[^"])*""
|
||||
color brightyellow ""(\.|[^"])*"" "'(\.|[^'])*'"
|
||||
|
||||
# Comments.
|
||||
color brightblue "//.*"
|
||||
color brightblue "(^|[[:space:]]+)//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
##color blue start="<" end=">"
|
||||
##color red "&[^;[:space:]]*;"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
## Here is an example for XML files.
|
||||
|
||||
syntax "xml" "\.([jrsx]html?|jnlp|mml|pom|rng|sgml?|svg|w[as]dl|wsdd|xjb|xml|xs(d|lt?)|xul)$"
|
||||
header "<\?xml.*version=.*\?>"
|
||||
magic "(XML|SGML) (sub)?document text"
|
||||
comment "<!--|-->"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user