Commit Graph

7784 Commits

Author SHA1 Message Date
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
Brand Huntsman
32431cddf8 files: block the resizing signal while reading from an external command
A SIGWINCH somehow causes the input stream to see EOT, with the result
that any remaining output of an external program would be lost.

This fixes https://savannah.gnu.org/bugs/?56038,
and fixes https://savannah.gnu.org/bugs/?56033.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-04-03 15:14:33 +02:00
Benno Schulenberg
8e302738e8 bindings: recognize the ^W^Y and ^W^V legacy keystrokes again
The keystrokes are recognized and acted upon, but they are not visible
in the menu nor in the help text, and they cannot be rebound.  They are
there just to avoid frustrating the muscle memory of long-time users.

This fixes https://savannah.gnu.org/bugs/?56002.
Reported-by: Peter Zwegat <peterzwegat@yopmail.com>
2019-04-03 15:13:47 +02:00
Benno Schulenberg
aa2568858e tweaks: remove a superfluous check for NULL plus the associated message
The message has been there for a year and no one ever reported seeing it.
2019-04-03 15:11:18 +02:00
Benno Schulenberg
5375403b9d syntax: nanorc: colorize also strings preceded by 'start=' or 'end=' 2019-04-02 12:01:56 +02:00
Benno Schulenberg
b0c9809a2e speller: block the resizing signal also during an integrated spell check
Because somehow something goes wrong when SIGWINCHes are handled while
reading from a pipe.

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

Bug existed since version 2.4.2, commit 75d64e67.
2019-04-01 20:21:23 +02:00
Benno Schulenberg
19c82e6a43 feedback: spare the user a superfluous scaring when trying to exit
Also, a simple question is easier to answer than an annotated one.
2019-04-01 19:56:10 +02:00
Benno Schulenberg
84d21b0972 tweaks: consistently use .sp instead of .PP to insert a blank line
And use plain .P to start a new paragraph.
2019-04-01 17:31:35 +02:00
Benno Schulenberg
f8e0320722 syntax: nanorc: require whitespace both before and after a quoted string
This ensures that the keyname M-" is not miscolored.
2019-04-01 17:24:19 +02:00
Benno Schulenberg
e5a8c35104 feedback: show a message while executing an external command
Some commands can take a little while to execute; showing just the prompt
during that time could give the impression that nothing is happening.

This addresses https://savannah.gnu.org/bugs/?56041.
2019-03-31 18:04:52 +02:00
Devin Hussey
7ad232d714 files: initialize a variable before referencing it
The lack of initialization caused a nasty bug on some targets (such as
ARMv7) which would make it so that ^S would just say "Cancelled".

While x86 (both 64 and 32 bits) seems to initialize 'response' to zero or
a positive number, ARM does not, and there is usually a negative value in
its place, which triggers the 'if (response < 0)' check and, as a result,
the code says "Cancelled".

This fixes https://savannah.gnu.org/bugs/?56023.
Reported-by: Devin Hussey <husseydevin@gmail.com>

Bug existed since version 4.0, commit 0f9d60a3.

Signed-off-by: Devin Hussey <husseydevin@gmail.com>
2019-03-31 12:57:27 +02:00
Benno Schulenberg
85804ec70d syntax: man: require the dot to be at start of line, not the comment 2019-03-31 12:42:53 +02:00
Benno Schulenberg
e473ba5e6c syntax: man: anchor macros at start of line, as only then they are valid 2019-03-30 20:54:31 +01:00
Benno Schulenberg
9120a62cdd syntax: man: add comments, and color all the safe lowercase macros 2019-03-30 20:47:45 +01:00
Benno Schulenberg
53ecb3225f syntax: default: color in red also versions 4.x of nano 2019-03-30 19:54:58 +01:00
Benno Schulenberg
3f695b8fb7 speller: resizing can happen also when configured with --enable-tiny
When nano was configured with --enable-tiny --enable-speller, the
block_sigwinch() function should be available, to mask SIGWINCHes
during a spell check.
2019-03-30 19:23:15 +01:00
Benno Schulenberg
55699dc171 tweaks: rename some variables, to be less repititious
The repeated 'read_buff_' made everything look the same.
2019-03-30 19:10:44 +01:00