Commit Graph

6796 Commits (2122a1a2b5d95f621c3c3d1b9df6aa428c25a3ca)

Author SHA1 Message Date
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
Benno Schulenberg 4567360d01 gnulib: update to its current upstream state 2017-11-10 19:40:23 +01:00
Benno Schulenberg 478e34a80c ouch: set the positions-file name also when using the legacy state dir
One should test a change before pushing, also when it worked last time.
2017-11-08 21:15:28 +01:00
Benno Schulenberg ea47879911 tweaks: don't construct the positions-history filename time and again 2017-11-08 20:38:34 +01:00
Brand Huntsman bfc53f308c history: prevent overwriting of positions between multiple instances
Whenever a buffer is closed, check whether the positions file on disk
was modified, and if so, reload it.  Then update the position for the
closed buffer and write out the positions file to disk.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-11-08 20:38:34 +01:00
Lion Yang f0d3685591 input: ensure that standard input uses blocking mode
The function get_key_buffer() assumes waiting_mode = TRUE, but stdin
can be in non-blocking mode when a program (before nano) turned stdin
to non-blocking mode and did not change it back (possibly because it
crashed).  So, explicitly set stdin to blocking mode at startup.

Signed-off-by: Lion Yang <lion@aosc.io>
2017-11-08 20:28:26 +01:00
Benno Schulenberg 7e6bb91593 tweaks: add a translator hint, and adjust two others 2017-11-07 19:39:00 +01:00
Benno Schulenberg 7b133aa6f9 tweaks: change some mayday messages, to urge the user to report a bug
Also, diversify them, and no longer mark them for translation.
2017-11-07 19:14:33 +01:00
David Lawrence Ramsey 477b246771 tweaks: use printf's z modifier for most of the size_t/ssize_t types
Also, properly refer to numreplaced as signed, since it's ssize_t
(even though it's only shown when positive).
2017-11-07 17:55:21 +01:00
David Lawrence Ramsey 7d653e5a17 history: fix the check for an existing $HOME/.nano/ directory
This fixes https://savannah.gnu.org/bugs/?52339.
2017-11-05 20:35:52 +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 d054044d30 tweaks: transform the token DISABLE_EXTRA to ENABLE_EXTRA 2017-11-01 20:33:14 +01:00
Benno Schulenberg 9dc72cf3ba tweaks: avoid an unused-variable warning with --disable-nanorc 2017-11-01 20:08:55 +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 c4d2a92d4c tweaks: reshuffle some code in order to elide a variable
Initialize 'breaking_col' to what it needs to be when the current chunk
consists of only a tab -- a tab that spreads across both start and end
of the chunk -- so that the last 'if' can move into the preceding one,
which allows the elision of 'char_len'.
2017-10-30 21:02:23 +01:00
Benno Schulenberg 4e03a245ac tweaks: adjust two comments, and correct and a few cosmetic mistakes 2017-10-30 19:12:22 +01:00
Benno Schulenberg 028d12f4fb tweaks: transform the token DISABLE_OPERATINGDIR to ENABLE_OPERATINGDIR 2017-10-29 21:08:07 +01:00
Benno Schulenberg a5974bd1ec tweaks: transform the token DISABLE_WRAPPING to ENABLE_WRAPPING 2017-10-29 21:00:09 +01:00
Benno Schulenberg 87da3ecbe0 tweaks: remove another bit of conditional compilation 2017-10-29 20:42:20 +01:00
Benno Schulenberg ff35a61355 tweaks: transform the token DISABLE_HISTORIES to ENABLE_HISTORIES 2017-10-29 19:43:05 +01:00
Benno Schulenberg 3f27c312c4 tweaks: get rid of some cluttering conditional compilation
In the tiny version, do_prompt() will now have an extra NULL
parameter, which will cost maybe twenty extra bytes of code.
That is acceptable when it saves thirty lines in the source.
2017-10-29 11:39:27 +01:00
Benno Schulenberg ab6e4e36e2 tweaks: fix compilation with --enable-tiny --enable-histories 2017-10-29 10:49:08 +01:00
Benno Schulenberg 84c650b80a files: avoid an abortion when excuting a command in a new buffer
The key sequence ^R ^X M-F <Enter> would cause nano to abort, because
it would try to add an empty string to a history list.  (Furthermore,
simply don't execute an empty command, because it is pointless.)

Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2017-10-28 12:33:03 +02:00
Benno Schulenberg 42497f77e2 tweaks: rename some constants, to follow the same underscoreless scheme 2017-10-28 12:32:54 +02:00
Benno Schulenberg 86ef9db363 tweaks: remove a useless prefix from a hundred constants
And use a better word to describe the concise descriptions that
these constants refer to -- they are not messages.
2017-10-28 12:32:47 +02:00
Benno Schulenberg 160ababa55 tweaks: rename a macro, to make a little more sense 2017-10-28 12:32:36 +02:00
Benno Schulenberg d84fb8d209 tweaks: remove a superfluous no-op function call
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-10-28 12:32:27 +02:00
Benno Schulenberg 14bf53ddfc syntax: default: use colors that are readable also on dark backgrounds 2017-10-26 21:07:11 +02:00
Benno Schulenberg ded02d858f search: suppress the "Search Wrapped" message when doing replacements
This completes the fix for https://savannah.gnu.org/bugs/?52282.
Reported-by: Chime Hart <chime@hubert-humphrey.com>
2017-10-26 21:07:06 +02:00
Benno Schulenberg d4945c67a4 search: suppress the "not found" message when replacements were made
After any replacements were made, the "not found" message is pointless
because it will be overwritten rightaway by "Replaced xx occurrences".
The message is confusing and annoying when using speech output.

This partially fixes https://savannah.gnu.org/bugs/?52282.
Reported-by: Chime Hart <chime@hubert-humphrey.com>
2017-10-26 21:06:54 +02:00
David Lawrence Ramsey ddd300af5f help: allow firstline and lastline to work at the search prompt
This addresses https://savannah.gnu.org/bugs/?52257.
2017-10-25 19:35:41 +02:00
David Lawrence Ramsey d344c3d042 display: don't cut off zero-width characters at the end of a chunk
This fixes https://savannah.gnu.org/bugs/?52258.
Reported-by: Peter Passchier <peter@passchier.net>
2017-10-25 19:07:38 +02:00
Benno Schulenberg 3018ab4706 moving: don't slither and slide over tabs when they are overlong
This fixes https://savannah.gnu.org/bugs/?52183.

Tested-by: David Lawrence Ramsey <pooka109@gmail.com>
Improved-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-10-25 17:46:39 +02:00
David Lawrence Ramsey 2356693b81 docs: document the more everyday names of three bindable functions
List "browser", "pageup" and "pagedown" in the manuals; the first
because it matches "speller", and the latter two because they are
what these functions are commonly known by.  The names "tofiles",
"prevpage" and "nextpage" are now undocumented, but they are still
recognized by the code, as they match the tags for these functions.
2017-10-25 17:44:13 +02:00
David Lawrence Ramsey 4d35835189 docs: decribe the bindable functions 'recordmacro' and 'runmacro' 2017-10-19 21:37:41 +02:00
David Lawrence Ramsey f8c75c43ed search: don't bother saving and restoring the search direction
Most people who make use of 'do_findprevious' and 'do_findnext'
will not make use of 'do_search' (the default binding of M-W),
so for them it is superfluous to remember the state of the
Backwards toggle in the Search menu.  For the people that do
mix the usage of Alt+Up/Down with M-W, it means that M-W will
always search in the same direction as the last search.  It is
a small change in behavior.
2017-10-19 21:21:31 +02:00
Benno Schulenberg af20d45bc1 bindings: don't allow calling help when searching in the help viewer
This fixes https://savannah.gnu.org/bugs/?52246.
2017-10-18 21:46:34 +02:00
Brand Huntsman 08b49534d5 bindings: allow exiting from the help viewer with F1, like with ^G
Signed-off-by: Brand Huntsman <alpha@qzx.com>
2017-10-18 21:10:06 +02:00
Benno Schulenberg 57899550aa tweaks: change the arrows to triangles also for searching in file browser 2017-10-18 20:55:43 +02:00
Benno Schulenberg e1e6c5f612 bindings: make the search function rebindable again in help and browser
Adjust to the changed meaning of 'whereis': it is no longer do_search()
but do_search_forward().

Hinted-at-by: Brand Huntsman <alpha@qzx.com>
2017-10-18 20:55:09 +02:00
Benno Schulenberg 58ecc034d0 tweaks: change the help-text arrows to triangles, to be more visible
Requested-by: Brand Huntsman <alpha@qzx.com>
2017-10-15 21:23:33 +02:00
Marco Diego Aurélio Mesquita 501d05c5d1 new feature: the ability to record and play back a series of keystrokes
Allow the user to record and run a single macro.  The default binding
for starting and stopping the recording is M-: (Alt + colon) and for
running the macro M-; (Alt + semicolon).

This fulfills https://savannah.gnu.org/bugs/?50314.
Requested-by: Peter Passchier <peter@passchier.net>

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2017-10-15 20:40:40 +02:00
Benno Schulenberg fc36ff7275 options: retire 'set backwards' -- it's still recognized but a no-op 2017-10-15 10:45:22 +02:00