Commit Graph

486 Commits (1861052234fd542e845d679387359bf7ba4c458d)

Author SHA1 Message Date
Benno Schulenberg 408f15954e feedback: replace an assert with a check plus error message at startup 2019-04-06 10:03:52 +02:00
Benno Schulenberg 947ccbb597 rcfile: don't break a chain of 'else if' [scan-build]
The mistake was made when 'guidestripe' was added, in commit 66c6eb51.
2019-04-03 19:06:04 +02:00
Benno Schulenberg 671db5e1e3 tweaks: rename an overshort type to something that makes some sense 2019-04-03 17:34:05 +02:00
Benno Schulenberg acfee2538e tweaks: rename a cryptic type to something that makes a little sense 2019-04-03 17:11:24 +02:00
Benno Schulenberg b58418b32f tweaks: rename a variable, to be more distinct 2019-03-21 19:21:45 +01:00
Benno Schulenberg 23190aa60f tweaks: make an assignment only when the option is valid, like elsewhere 2019-03-21 19:17:03 +01:00
Benno Schulenberg 01e6d435fe tweaks: rename a function, to be simpler and more accurate 2019-03-21 17:42:34 +01:00
Benno Schulenberg 20514eca19 feedback: make two error messages better match the option
And keep them identical.
2019-03-11 09:07:08 +01:00
Benno Schulenberg 4205567bb1 tweaks: add deprecation comments to the four superseded options 2019-03-10 17:05:19 +01:00
Benno Schulenberg a20340b5a8 copyright: update the years for significantly changed files 2019-03-10 17:03:42 +01:00
Benno Schulenberg 916b4d81d0 rcfile: add 'stripecolor' for changing the color of the guiding stripe
The default is now simply reverse video, which works better than a
"loud" colored bar in an interface that for the rest is monochrome.
2019-03-09 09:27:08 +01:00
Benno Schulenberg 66c6eb5166 new feature: option --guidestripe that shows a vertical guiding bar
Option -J (--guidestripe) takes a column number as argument and then
shows a vertical, colored bar over the entire height of the buffer,
to aid the user in regulating the width of the text when the terminal
is wider than this desired width.

This fulfills https://bugs.debian.org/916392.
Requested-by: Arturo Borrero González <arturo@debian.org>
And fulfills https://savannah.gnu.org/bugs/?55315.
Requested-by: Bryan Christ <bryan.christ@gmail.com>
2019-03-09 09:27:08 +01:00
Benno Schulenberg 79ca3ceabf copyright: update the years for the FSF 2019-02-24 19:35:56 +01:00
Benno Schulenberg 894aff0816 options: let --fill no longer imply automatic hard-wrapping
Now --fill only sets the target width for hard-wrapping and justifying,
but automatic hard-wrapping itself is switched on with --breaklonglines.
2019-02-18 09:34:18 +01:00
Benno Schulenberg 4d40bea58a rcfile: add the options that correspond to -b, -f, -j, and -e 2019-02-18 09:34:18 +01:00
Benno Schulenberg 2482cfca56 build: eradicate the --disable-wrapping-as-root configure option
Hard-wrapping is disabled by default for any user, so this special
configure option is no longer needed.
2019-01-25 11:37:51 +01:00
Benno Schulenberg b596639f95 options: actually rename --rebindkeypad to --rawsequences (-K) 2018-12-31 18:35:46 +01:00
Benno Schulenberg 798695ff1e utils: retire the fixbounds() function -- it is no longer needed
All tested systems (FreeBSD, NetBSD, OpenBSD, Alpine, and Ubuntu)
support the GNU-style word boundaries (\< and \>), either natively
or through using the regex module from gnulib.

If this change breaks regexes containing \< or \> on your system,
please report a bug: https://savannah.gnu.org/bugs/?group=nano

This addresses https://savannah.gnu.org/bugs/?55207.
2018-12-31 13:49:07 +01:00
Benno Schulenberg 34b8d58871 rcfile: reject an attempt to bind ^[
Also, for <Esc> <Esc> [, report that it is unbindable.

This fixes https://savannah.gnu.org/bugs/?55336.
2018-12-30 19:47:43 +01:00
Benno Schulenberg 997826d794 tweaks: rename a symbol, to match its corresponding option 2018-12-28 17:47:03 +01:00
David Lawrence Ramsey 77bd8c2630 tweaks: swap the names of the variables 'wrap_at' and 'fill'
Now 'fill' contains the original specified value,
and 'wrap_at' the column that 'fill' translates to.
2018-12-18 19:50:59 +01:00
Benno Schulenberg 3121ee4b2e options: stop recognizing and mentioning --quiet and 'set quiet'
Those options have been a no-op and obsolete for over a year.

Just continue to accept and ignore -q, for some "compatibility"
with Pico.
2018-12-18 19:29:40 +01:00
Benno Schulenberg 762cee242a tweaks: reshuffle a bit of code, to have the exit point near the end 2018-12-18 19:27:17 +01:00
Benno Schulenberg 3a170d2c3e rcfile: when rebound, DO unbind a keystroke from its earlier function
When not unbinding it from its earlier function (in the same menu),
it would result in showing the keystroke twice in the help text.

This fixes https://savannah.gnu.org/bugs/?55239.

Bug was introduced a month ago, by commit f81d174f.
2018-12-18 19:25:33 +01:00
Benno Schulenberg 3a79766da6 rcfile, docs: remove deprecated forms of two options and five bindables
This addresses https://savannah.gnu.org/bugs/?53785.
2018-12-03 10:25:55 +01:00
Benno Schulenberg d3f0d32e16 rcfile: don't report an error when the globbing pattern matches nothing
Because a message like "Error expanding EMPTY/*.nanorc: Success"
looks silly.

Indirectly-reported-by: Ντέντος Σταύρος <stdedos@gmail.com>
(https://lists.gnu.org/archive/html/nano-devel/2018-11/msg00044.html)
2018-11-19 12:06:43 +01:00
Benno Schulenberg 3f309bc36a tweaks: rename three variables, and reshuffle two declarations 2018-11-19 11:47:02 +01:00
Benno Schulenberg 2516b64046 tweaks: adjust the indentation after the previous change
Also reshuffle two declarations and improve two comments.
2018-11-14 17:58:34 +01:00
Benno Schulenberg 0ad0dcc926 tweaks: reshuffle some code, to require two fewer ifs 2018-11-14 17:57:20 +01:00
Benno Schulenberg f81d174f11 rcfile: when a keystroke is rebound, don't bother unbinding it
The new binding will be put at the head of the list and thus will
be the one that is found -- the old binding will never be seen, so
rubbing it out is just a waste of time.
2018-11-14 17:41:32 +01:00
Benno Schulenberg ca6281e821 tweaks: condense a handful of comments, and drop an assert 2018-11-05 09:38:07 +01:00
Brand Huntsman ae3ec1784d options: add --zap, that makes <Bsp> and <Del> erase a marked region
Using --zap or -Z on the command line, or 'set zap' in a nanorc file,
makes the <Bsp> and <Del> keys erase selected text (a marked region)
as they do in some other editors, and without affecting the cutbuffer.

This fulfills https://savannah.gnu.org/bugs/?54837.
Requested-by: Liu Hao <lh_mouse@126.com>

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-11-04 11:46:57 +01:00
David Lawrence Ramsey 16a3dc90c7 wrapping: make relative fill values work again also for screen resizes
The 'wrap_at' variable, removed in commit e90b7cf4, is actually needed
to store the original value of the --fill option when it is negative.
Otherwise, changing the screen width will not update the wrapping point
properly.

This fixes https://savannah.gnu.org/bugs/?54861.
Reported-by: Brand Huntsman <alpha@qzx.com>
2018-10-18 20:35:49 +02:00
Benno Schulenberg 9c2b67231e tweaks: rename a flag, to match the name of the option 2018-10-02 19:18:55 +02:00
Benno Schulenberg 5ca444e5df startup: allow reading nanorc in restricted mode, to permit customization
Move the unsetting of some options further down, to prevent the user's
nanorc enabling things that are not permitted in restricted mode.

Also, in restricted mode, suppress error messages about functions not
being present in the requested menus, so that a nanorc that is valid in
normal mode does not cause unnecessary messages when using --restricted.

This fulfills https://savannah.gnu.org/bugs/?54732.
Requested-by: Mark Webb-Johnson <mark@webb-johnson.net>
2018-10-02 19:18:55 +02:00
Benno Schulenberg 9e71de12cd tweaks: improve a translator hint and some other comments 2018-09-09 08:17:22 +02:00
Brand Huntsman 6e80772311 tweaks: correct four spaces of indentation to a tab, in two places
Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-08-29 18:01:21 +02:00
Brand Huntsman b5ede4ff65 tweaks: remove the 'bright' field from the colortype struct
Put the corresponding value into the 'attributes' field sooner.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-08-25 10:54:20 +02:00
Benno Schulenberg e40e6bbf10 tweaks: rename a function to better match its counterpart
Also rename its parameter, to describe what it ought to be.
2018-08-11 09:55:22 +02:00
Benno Schulenberg 2147e161bf rcfile: when a vital function is not mapped, mention in which menu
Add the reverse of the name-to-menu function to accomplish this.

This fixes https://savannah.gnu.org/bugs/?54449.
2018-08-11 09:46:03 +02:00
Benno Schulenberg 52d851a1aa startup: don't overwrite rcfile error messages on a Linux console
On a Linux VT, refuse to start when there are errors in a nanorc file,
so that the messages no longer get overwritten -- which prevented the
user from seeing and reading them.

This fixes https://savannah.gnu.org/bugs/?54442.
2018-08-10 19:41:54 +02:00
Benno Schulenberg 975b491235 dropping a feature: remove the ability to use the 'formatter' command
Since the last version, the user can filter an entire buffer through
an external command.  This external command can also be a formatting
program, so there is no longer any need for this specific and special
formatter command.
2018-08-09 20:29:30 +02:00
Benno Schulenberg 4c66a6259c tweaks: slightly improve error message when vital function is unmapped
This fails to fix https://savannah.gnu.org/bugs/?54449, because
it would take far too much code for an exceptional case.
2018-08-06 19:35:47 +02:00
Benno Schulenberg ad79a4fcfb rcfile: ensure that in the yesno menu Cancel is bound to some keystroke
(In the Search and Replace menus Cancel is not essential.  And in the
Goto Line menu Cancel is not needed at all: a simple <Enter> after an
empty answer works fine.)

This fixes the second part of https://savannah.gnu.org/bugs/?54447.
2018-08-05 20:11:48 +02:00
Benno Schulenberg e90b7cf4aa tweaks: elide an unneeded/duplicate variable 2018-08-04 11:34:44 +02:00
Benno Schulenberg bb90de0eb4 tweaks: rename a constant, to match what it actually means
Wrapping is concerned with columns, not with number of characters.
2018-08-04 11:21:42 +02:00
Benno Schulenberg 157c7b1bc4 rcfile: explicitly check for disallowed keywords in included files
This fixes https://savannah.gnu.org/bugs/?54441.
2018-08-04 07:29:36 +02:00
Benno Schulenberg 9a47a9c4c0 rcfile, docs: no longer recognize nor mention 'set backwards'
The option has been a no-op since 2.9.0.  And now that the
^W/^Q/M-W/M-Q set is available, 'set backwards' is entirely
outdated.
2018-07-29 21:00:12 +02:00
Benno Schulenberg f2adefb158 tweaks: drop some old debugging code 2018-07-08 10:45:43 +02:00
Benno Schulenberg 7ae8f3bca4 tweaks: elide a function that is used just once 2018-07-08 10:40:22 +02:00
Benno Schulenberg 2e1e157967 copyright: update the years for significantly changed files 2018-06-01 10:18:32 +02:00
David Lawrence Ramsey fce54a724d tweaks: fix some grammar plus a typo in the comments 2018-05-27 20:19:46 +02:00
Benno Schulenberg 119a6f0de3 rcfile: don't crash when a bind to a string lacks the closing quote
This fixes https://savannah.gnu.org/bugs/?53972.
Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-05-25 13:15:52 +02:00
Benno Schulenberg c07586d9f3 tweaks: condense some repetitious comments, and check before assigning
Check that the option argument is okay (contains no blank characters),
before assigning it to the relevant variable.
2018-05-24 20:49:29 +02:00
Benno Schulenberg f5eeb92f40 tweaks: sort an option better, and reschedule a removal 2018-05-13 09:47:40 +02:00
Mark-Weston 858663444e new feature: an option to make the 'nextword' function stop at word ends
When 'afterends' is set and Ctrl+Right or Shift+Ctrl+Right is pressed,
nano will stop at the ends of words instead of their beginnings.

Signed-off-by: Mark-Weston <markweston@cock.li>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-10 11:32:01 +02:00
Benno Schulenberg bf8bd02558 build: do not prefix an alternative rcfilename with a dot
When the user configures nano with --enable-altrcname=name,
the specified name should not be prefixed with a dot.

This fixes https://savannah.gnu.org/bugs/?53694.
Reported-by: Cody A. Taylor <codemister99@yahoo.com>
2018-04-21 10:03:30 +02:00
Benno Schulenberg 0b30835dd0 tweaks: use meaningful names instead of puzzling values
Suggested-by: Brand Huntsman <alpha@qzx.com>
2018-04-01 09:49:58 +02:00
Benno Schulenberg 0cd833e64b tweaks: move a function to its proper location
Put it after the function that it calls, and before the functions
it is called from.
2018-03-30 10:34:40 +02:00
Benno Schulenberg cbf226476d rcfile: skip color commands where some color name is invalid
That is, do not fall back to the default background color when the
name for the background color is invalid, but reject the entire
color command, just like for an invalid foreground color.
2018-03-30 10:30:55 +02:00
Benno Schulenberg 570fb6c606 small addition: understand color name "normal" to mean the default color
This allows a syntax to remove the color from things that were colored
overeagerly by earlier regexes.
2018-03-28 14:03:22 +02:00
David Lawrence Ramsey 7b1f3f4fe7 tweaks: correct several parameter types
This avoids a bunch of warnings when compiled with -pedantic:

	ISO C forbids comparison of ‘void *’ with function pointer
2018-03-18 20:01:25 +01:00
Benno Schulenberg a1be8b6a19 tweaks: condense a comment and elide an 'if' 2018-03-01 11:18:56 +01:00
Benno Schulenberg de4fbadf20 tweaks: reshuffle some code, to be slightly less ugly 2018-03-01 11:08:13 +01:00
Benno Schulenberg bdd8920081 bindings: make a key defined as string work also in browser and viewer 2018-03-01 10:55:04 +01:00
Benno Schulenberg 5eccaa7633 tweaks: refactor the implanting of a key expansion 2018-02-27 13:34:32 +01:00
Benno Schulenberg c757aee235 tweaks: correct a typo that broke binding a key to a string
Commit 0cf455bc introduced the typo.
2018-02-27 10:28:52 +01:00
Benno Schulenberg ffebd31cbb tweaks: shorten the name of two record elements
Exclude the confusing, pleonastic 'sc' abbreviation from their names.
2018-02-24 19:31:11 +01:00
Benno Schulenberg b027263a37 small addition: allow customizing the color of an error message
The new option 'set errorcolor' allows the user to specify the color
combination for the status bar when an error message is displayed.
2018-02-23 12:35:17 +01:00
Benno Schulenberg 0cf455bc48 build: fix compilation when configured with --enable-tiny
And when configured with --enable-tiny --enable-nanorc.
2018-02-14 19:29:29 +01:00
Benno Schulenberg 3e1fc6385b syntaxes: remove quotes from each syntax name, and color it differently
The different color will make the name stand out, as it should, instead
of looking the same as all the regex strings.
2018-02-14 17:36:50 +01:00
Benno Schulenberg 544cda6a62 rcfile: allow a syntax name to be unquoted 2018-02-14 17:35:37 +01:00
Benno Schulenberg 467cc8edf3 tweaks: remove two deprecated options and six rebindable function names
This addresses https://savannah.gnu.org/bugs/?48992.
2018-02-04 13:51:13 +01:00
Benno Schulenberg 6d111c9343 new feature: allow binding a key to a string (in a nanorc file)
In this way a single keystroke can produce a fragment of text or a
series of commands, or a mix of the two.  It is like a prerecorded
macro.

This fulfills https://savannah.gnu.org/bugs/?52931.
2018-02-04 12:44:12 +01:00
Benno Schulenberg 7b9bd65362 tweaks: drop a useless assert, and don't abort over an unhandled option 2018-01-24 10:29:50 +01:00
Benno Schulenberg f72fecee9b copyright: update the years for the FSF
And one for me, for the much changed keyboard stuff.
2018-01-24 10:14:43 +01:00
Benno Schulenberg d85098abda tweaks: reshuffle a couple of lines, to make a bit more sense 2018-01-19 20:27:53 +01:00
Benno Schulenberg 13f8ddcaf2 tweaks: remove a handful of redundant (because always true) asserts
And rewrap some lines, three of them to make them equal to another.
2018-01-19 20:09:06 +01:00
Benno Schulenberg 37e9ada964 tweaks: change a 'do' to a 'while', and return early to elide an 'if' 2018-01-19 18:05:24 +01:00
Benno Schulenberg a99158c7c0 tweaks: remove a fragment of dead code
At that point, ptr will necessarily point at EOL -- *ptr == '\0'.
2018-01-19 17:56:17 +01:00
Benno Schulenberg 704a7d7b4f tweaks: rename two variables, for preciseness and shortness
Also remove an unneeded nulling.
2018-01-15 16:38:13 +01:00
Benno Schulenberg 64366d9992 startup: make an error message succinct and to the point
The verbosity "hid" the really relevant information:
filename, line number, and the error message.

Valid values and other details can be found in the manual pages.
2018-01-15 13:24:14 +01:00
Benno Schulenberg bd97ae7255 tweaks: set a modifier in a single place, for conciseness 2018-01-15 13:15:23 +01:00
Benno Schulenberg 2ff398c685 tweaks: reshuffle some stuff, and avoid a memory leak 2018-01-15 13:07:42 +01:00
Brand Huntsman 4b24ce1c11 startup: parse interface colors when they are read, not when initialized
When the palette is getting initialized, it is too late to send any
error messages about the rcfile options to standard error.

This fixes https://savannah.gnu.org/bugs/?52871.
Reported-by: Brand Huntsman <alpha@qzx.com>

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2018-01-15 13:04:55 +01:00
Benno Schulenberg 87206c0607 tweaks: convert the indentation to use only tabs
Each leading tab is converted to two tabs, and any leading four spaces
is converted to one tab.  The intended tab size (for keeping most lines
within 80 columns) is now four.
2017-12-29 20:06:50 +01:00
David Lawrence Ramsey 62ebd93579 tweaks: use printf's z modifier for (s)size_t, instead of casting 2017-12-26 14:11:18 +01:00
Benno Schulenberg 66fd6a5ab1 options: rename 'justifytrim' to 'trimblanks', because it has morphed
The option now causes nano to trim trailing whitespace also when
hardwrapping occurs while the user is typing.
2017-12-06 20:38:13 +01:00
Benno Schulenberg 5239e7c52b copyright: update some years, and standardize on the dashed format 2017-11-12 10:46:20 +01:00
Benno Schulenberg 2122a1a2b5 tweaks: constify the result strings of getenv(), as a reminder
Also, remove an unneeded pair of braces.
2017-11-10 20:03:07 +01:00
Marco Diego Aurélio Mesquita e2d3bba86c general: do not free strings gotten from getenv(), to avoid a crash
Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2017-11-10 19:55:44 +01:00
Simon Ochsenreither c16e79b612 startup: look for nanorc and history files also in the XDG directories
When not finding a .nanorc file in the user's home directory, nano will
look for a nanorc file in $XDG_CONFIG_HOME and in the ~/.config/nano/
fallback directory.  And when not finding a .nano/ subdir in the user's
home directory, nano will look for (or create) the history files in
$XDG_DATA_HOME or in the ~/.local/share/nano/ fallback directory.

This is a partial implementation of the XDG Base Directory Specification:
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html,
for the purpose of reducing the clutter in a user's home directory, and
to make it easier to back up just the configuration files.

Signed-off-by: Simon Ochsenreither <simon@ochsenreither.de>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-11-04 20:11:57 +01:00
Benno Schulenberg 1463781247 startup: when an rcfile contains errors, report this on the status bar
Suggested-by: Brand Huntsman <alpha@qzx.com>
2017-11-02 17:30:14 +01:00
Benno Schulenberg c3a11fb7ed options: remove '--quiet' and 'set quiet', because they hide problems
If the user uses a single version of nano, they have no need for
--quiet.  If they do sometimes use an older version and don't want
to see the warnings, they can use 2>/dev/null (they could make an
alias for that and put it before the call of nano).
2017-11-02 17:27:53 +01:00
Benno Schulenberg 953c2b8e79 startup: don't ask the user to press Enter upon an rcfile error
The user told nano to start, thus nano should *start* -- without
halting and without nagging the user.
2017-11-02 17:22:21 +01:00
Benno Schulenberg d5ac1ed395 tweaks: transform the token DISABLE_COLOR to ENABLE_COLOR 2017-11-01 19:45:50 +01:00
Benno Schulenberg 2a4fc9591f tweaks: transform the token DISABLE_SPELLER to ENABLE_SPELLER 2017-10-31 19:32:42 +01:00
Benno Schulenberg f034992ed6 tweaks: transform the token DISABLE_WRAPJUSTIFY to ENABLED_WRAPORJUSTIFY 2017-10-31 17:40:54 +01:00
Benno Schulenberg db0b849f9b tweaks: transform the token DISABLE_JUSTIFY to ENABLE_JUSTIFY 2017-10-31 17:40:44 +01:00
Benno Schulenberg 4e03a245ac tweaks: adjust two comments, and correct and a few cosmetic mistakes 2017-10-30 19:12:22 +01:00