Commit Graph

8050 Commits

Author SHA1 Message Date
Benno Schulenberg
d83a8eb359 justify: correctly compute the number of lines to take, to avoid a crash
When the file starts with one or more blank lines, the first paragraph
doesn't start on line 1.

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

Bug existed since version 4.0, commit ac8bd2a2.
2019-04-11 16:11:49 +02:00
Benno Schulenberg
98cc39e8e5 tweaks: reshuffle some lines, to elide an 'if' 2019-04-11 15:12:04 +02:00
Benno Schulenberg
b20fadd604 tweaks: free the copy of a linter message in all cases [valgrind] 2019-04-11 14:17:32 +02:00
Benno Schulenberg
cdf0f8e68a tweaks: drop two 'const' qualifiers, to silence the compiler 2019-04-11 12:31:50 +02:00
Benno Schulenberg
f645009a5e tweaks: free the result string from an invocation error [coverity] 2019-04-11 10:05:39 +02:00
Benno Schulenberg
2b2736d41a tweaks: free some memory before a possible error exit [coverity] 2019-04-11 09:55:18 +02:00
Benno Schulenberg
5a6029a938 tweaks: rename some variables, for more contrast and to match others 2019-04-11 09:38:06 +02:00
Benno Schulenberg
8d272db4e6 tweaks: rename two variables, for more contrast 2019-04-11 09:14:30 +02:00
Benno Schulenberg
70885d0f9a tweaks: use a signed type for a result that could be negative [coverity] 2019-04-11 09:11:53 +02:00
Benno Schulenberg
f1e5da6cdd help: don't doubly list toggles that have two keys assigned to them 2019-04-09 19:48:41 +02:00
Benno Schulenberg
d79b9823ae bindings: add easier keystrokes for the linenumber and softwrap toggles
For most people, M-N and M-S are simpler to type than M-# and M-$,
and more mnemonic.
2019-04-09 17:48:26 +02:00
Benno Schulenberg
82f1ce8ebf bindings: remove the jumpy-scrolling toggle entirely
It is still possible to use --jumpyscrolling on the command line or
'set jumpyscrolling' in a nanorc file, but a user will have to restart
nano when they decide they want chunky instead of smooth scrolling,
a decision that should be rather rare.

This frees up the M-S keystroke to be reused for toggling softwrap.
2019-04-09 17:46:21 +02:00
Benno Schulenberg
50ee655f9d gnulib: update to its current upstream state 2019-04-09 14:44:51 +02:00
Benno Schulenberg
5459f56f6d build: add gnulib modules to the list of files with translatable strings
The error messages from gnulib need to be included into nano's POT file
so that those messages get translated when nano is built on a platform
where the modules that contain the messages get used.

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

Bug existed since gnulib support was added in version 2.8.0.
The relevant modules were added by commits 3deec435 and 272345cc.
2019-04-09 13:49:36 +02:00
Benno Schulenberg
209531a761 docs: remove all mention of --finalnewline, and undefault --nonewlines 2019-04-07 10:02:22 +02:00
Benno Schulenberg
2552307064 options: remove -f (--finalnewline); go back to auto-adding this newline
For relatively inexperienced users (as most users of nano probably are)
it is far better that nano produces POSIX text files by default, where
each line ends with a newline character.  This means that these files
will "print" properly (not gluing the next prompt at the end of the
last line), tools will see and process each line of them, and, while
editing, adding text at the end is easier.

This addresses https://savannah.gnu.org/bugs/?55997.
Reported-by: Ralph Corderoy <ralph@inputplus.co.uk>
2019-04-07 10:02:05 +02:00
Benno Schulenberg
5601b9a66b tweaks: switch back from checking FINAL_NEWLINE to checking NO_NEWLINES
This effectively reverts commit b6a76223 from a good two months ago.
2019-04-07 08:50:35 +02:00
Benno Schulenberg
81dcb13783 tweaks: remove an unpaired closing parenthesis from the NEWS file 2019-04-06 21:21:38 +02:00
Benno Schulenberg
580fd13424 tweaks: do a check up front instead of every time round the loop
Instead of doing a check every time round the loop when it is useful
only the first time, duplicate a bit a code and do the check and its
related action beforehand.

Also, improve some comments.
2019-04-06 21:07:20 +02:00
Benno Schulenberg
790ce3791a tweaks: reshuffle some lines, condense a comment and drop another
Also, find_bracket_match() is only called when there is a bracket under
the cursor, so stepping forward will never go beyond the end-of-line,
so the central loop does not need to check for that.
2019-04-06 20:37:22 +02:00
Benno Schulenberg
97cd62a8fb tweaks: rename two variables, to make more sense 2019-04-06 20:29:04 +02:00
Benno Schulenberg
2f68bbb5e8 tweaks: reword a comment, and drop an unneeded assert 2019-04-06 20:08:39 +02:00
Benno Schulenberg
55952c0984 tweaks: adjust the indentation after the previous change
Also, improve a comment and shorten another, change a 'for' to a 'while'
(as the end point is not known), and rename a parameter from a single
letter to a word.
2019-04-06 19:45:45 +02:00
Benno Schulenberg
d9cfdd364b tweaks: don't bother special-casing non-UTF8 when seeking a character
This code is seldom used (only when searching for a matching bracket),
so speed is not a priority.
2019-04-06 19:34:09 +02:00
Liu Hao
c9605e7308 syntax: c: change the highlighting of preprocessor directives
Some of these directives are now colored in their entirety, while for
a few others it's still just the keyword itself that is colored.

Signed-off-by: Liu Hao <lh_mouse@126.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-04-06 17:51:07 +02:00
Benno Schulenberg
c3f97bc9b7 rcfile: read the syntax files in alphabetical order when globbing
The reading order must be predictable, otherwise things might get
colored differently from system to system.

This fixes https://savannah.gnu.org/bugs/?56012.
2019-04-06 17:50:55 +02:00
Benno Schulenberg
4399b734db bindings: disallow executing an external command when in view mode
Otherwise the user could do something like

  ^R^X  sed -i 's/a/surprise!/g' name-of-current-file  <Enter>

and the file being viewed would be modified anyway.
2019-04-06 17:41:44 +02:00
Benno Schulenberg
b9581bd50a tweaks: rename two variables, to match others
Also, initialize them straightaway.
2019-04-06 11:54:32 +02:00
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
f585403b36 build: add src/cut.c to the list of files with translatable strings
(Also, adjust the style of one of the messages.)

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

Bug existed since version 4.0, commit 50e8f8aa.
2019-04-06 09:40:53 +02:00
Benno Schulenberg
601973ddc2 tweaks: rename another variable, to be more descriptive 2019-04-05 11:01:07 +02:00
Benno Schulenberg
25a5fb8231 tweaks: rename a variable, to get out of the way for another rename 2019-04-05 10:50:15 +02:00
Benno Schulenberg
897e557ce3 tweaks: rename a variable, to be more distinct and more descriptive 2019-04-05 10:45:22 +02:00
Benno Schulenberg
81bee1f5fd tweaks: shorten and improve some comments, and reshuffle a few lines 2019-04-05 10:35:48 +02:00
Benno Schulenberg
691eb1145c tweaks: remove a function that is now unused 2019-04-04 14:53:53 +02:00
Benno Schulenberg
fb04dff6d7 tweaks: don't bother reallocating the data when a line gets hard-wrapped
This will waste some memory, but... if the user keeps editing, she is
likely to revisit the line and the data will get reallocated soon enough.
2019-04-04 14:44:44 +02:00
Benno Schulenberg
c224ea3ce7 tweaks: reshuffle two lines, and reword a comment 2019-04-04 14:23:07 +02:00
Benno Schulenberg
2a2fe7208a tweaks: condense a bit of copying code 2019-04-04 14:11:52 +02:00
Benno Schulenberg
3f9d8011b9 tweaks: don't bother copying the NUL byte -- it is set nine lines down 2019-04-04 13:59:00 +02:00
Benno Schulenberg
4788c5f97d tweaks: don't bother reallocating the squeezed string, just terminate it
The string will be rewrapped right after, within microseconds.
2019-04-04 13:56:41 +02:00
Benno Schulenberg
a5869ba450 tweaks: rename another variable, to be more fitting 2019-04-04 13:52:27 +02:00
Benno Schulenberg
7bc324f276 tweaks: rename two variables, to be more distinct and more fitting 2019-04-04 13:48:34 +02:00
Benno Schulenberg
8d40b568fa tweaks: rename a variable, to be more distinct and more apt 2019-04-04 13:39:11 +02:00
Benno Schulenberg
0c0afb0039 tweaks: simplify a message, and normalize the spelling of another one
The word "buffer" in relation to undo has been confusing to translators.

Also, drop the exclamation mark, as there is nothing important or urgent
about these messages.
2019-04-04 12:55:58 +02:00
Benno Schulenberg
2281ec9a31 tweaks: remove an unneeded check for NULL [coverity] 2019-04-04 12:47:20 +02:00
Benno Schulenberg
cd0917fe10 tweaks: remove an unneeded check for NULL and its associated message
The message (or its equivalent) has been there for years
and no one ever reported seeing it.
2019-04-04 12:40:03 +02:00
Benno Schulenberg
1a1519b6cd tweaks: drop an assignment whose value is never used [scan-build]
This useless assignment has been there for ages, since before 2.0.0.
2019-04-03 19:10:21 +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