Benno Schulenberg
c8a87b4d2a
softwrap: initialize the 'extrarows' value for the magic line correctly
...
The make_new_node() function initializes 'extrarows' to a bad value
on purpose, to catch cases like this one where it doesn't get updated
properly.
This fixes https://savannah.gnu.org/bugs/?58890 .
Reported-by: Jerry Kindall <kindall@gmail.com >
Bug existed since version 5.0, since the indicator was introduced.
2020-08-04 09:40:25 +02:00
Michalis Kokologiannakis
4940b02ae0
build: avoid compilation warnings by using memcpy() instead of strncpy()
...
When compiling with GCC 10.1.0 and -O2 -Wall, the strncpy() call
in measured_copy() produced two stringop-truncation warnings.
This addresses https://savannah.gnu.org/bugs/?58861 .
Signed-off-by: Michalis Kokologiannakis <michalis@mpi-sws.org >
2020-08-02 16:47:05 +02:00
Benno Schulenberg
90f6342fd1
tweaks: rename two header files, to be distinct and not an abbreviation
2020-06-20 12:09:31 +02:00
Benno Schulenberg
248d392c4d
tweaks: rename a symbol, and actually use it where it is needed
2020-05-29 17:19:38 +02:00
Benno Schulenberg
079a679431
tweaks: rename two functions, to better indicate what they do
2020-04-15 17:20:03 +02:00
Benno Schulenberg
654d694e39
tweaks: simplify the counting of characters in a section
...
The line after the given section is always NULL (or when it is not,
it is intended to be NULL), so always subtract 1 at the end.
2020-04-09 12:58:41 +02:00
Benno Schulenberg
19a6120dc8
tweaks: rename a function, to be more general and clearer
2020-04-09 12:27:07 +02:00
Benno Schulenberg
59040169ed
tweaks: get rid of a bunch of annoying casts, and thus condense the code
2020-03-29 20:17:32 +02:00
Benno Schulenberg
0cc2104257
tweaks: elide a parameter, by calling the relevant function beforehand
...
This means that in most cases mark_is_before_cursor() is called twice:
once before get_region() is called, and once by get_region() itself.
This small duplication of effort is acceptable: the affected functions
are not time critical, and it makes the code shorter.
2020-03-29 13:22:17 +02:00
Benno Schulenberg
ae139021eb
tweaks: rename four more functions, to get rid of an abbreviation
...
Also, improve their comments.
2020-03-12 15:54:19 +01:00
Benno Schulenberg
2bc5c1987c
tweaks: factor out a three-line condition into a separate function
...
For clarity.
2020-03-05 16:09:56 +01:00
Benno Schulenberg
be7e000389
tweaks: pull the NUL-terminating of a string into a function
...
Also, avoid copying one byte too many that afterward gets
overwritten with '\0'.
2020-02-20 17:08:32 +01:00
Benno Schulenberg
2148e857e5
copyright: update the years for significantly changed files
2020-01-15 12:11:56 +01:00
Benno Schulenberg
afa4c6b9fc
copyright: update the years for the FSF
2020-01-15 11:42:38 +01:00
Benno Schulenberg
fa88fcc8f2
tweaks: rename a function, and elide a parameter that is always NULL
...
After the previous change, all remaining calls of parse_mbchar() have
NULL as their third parameter. So, drop that parameter and remove the
chunk of code that handles it. Also rename the function, as there are
already too many functions that start with "parse".
2019-10-21 12:35:14 +02:00
Benno Schulenberg
c2d8641f01
chars: add a faster version of the character-parsing function
...
It elides a parameter that is always NULL, and elides two ifs
that always take the same path.
2019-10-21 12:24:23 +02:00
Benno Schulenberg
054559dc93
tweaks: rename three variables, to be more descriptive
2019-10-20 09:45:58 +02:00
Benno Schulenberg
fdeab9b4c9
tweaks: order two functions more sensibly
2019-10-20 09:45:58 +02:00
Benno Schulenberg
f26c121ca9
tweaks: adjust two comments, to better fit the actual functions
2019-10-20 09:45:58 +02:00
Benno Schulenberg
17c16a4bf5
tweaks: rename a function and elide its first parameter
2019-10-20 09:45:58 +02:00
Benno Schulenberg
46566572d6
utils: don't accept NULL for the string to be copied
...
This should not occur, so crash when it does happen.
2019-10-20 09:45:58 +02:00
Benno Schulenberg
ba79602281
tweaks: condense two comments, and rename two parameters
...
Also use 'while' instead of 'for'.
2019-10-13 16:45:02 +02:00
Benno Schulenberg
d256d0cbc0
tweaks: add a helper function without the ubiquitous NULL argument
...
For conciseness and clarity.
2019-10-13 12:24:27 +02:00
Benno Schulenberg
1075de1222
tweaks: rename two functions, to get rid of the "mb" abbreviation
...
Also, for me "move" is about moving the cursor. But these functions
are about moving an index in a text, which is more general.
2019-06-09 19:37:56 +02:00
Benno Schulenberg
4e637cd1c7
tweaks: delete a now-unused function
2019-05-28 17:41:28 +02:00
Benno Schulenberg
65560a583c
tweaks: rename a parameter and a variable, to be more distinct
2019-05-24 19:27:04 +02:00
Benno Schulenberg
35a791dee5
tweaks: remove two unneeded checks for NULL
...
If the rest of nano is correct, then these checks are superfluous and
only slow the loops down. But if there is some incorrect code, then
let nano crash on dereferencing NULL so we can find and fix the bug.
2019-05-24 19:17:01 +02:00
Benno Schulenberg
98ffb19746
tweaks: stop checking for a NULL result from line_from_number()
...
No one ever reported seeing the message that was removed in commit
c039aaad one month ago, so most likely the code is correct and nano
never calls line_from_number() with a non-existent line number.
2019-05-24 19:08:29 +02:00
Benno Schulenberg
93edd12099
tweaks: rename a function, to be clearer and to stop using an old abbrev
2019-05-24 18:56:34 +02:00
Benno Schulenberg
8fe19e344f
tweaks: use a more direct call when a single linestruct is deleted
2019-04-28 17:20:08 +02:00
Benno Schulenberg
896cfcef95
tweaks: when OR'ing, put the most likely condition first
...
Also, slightly reword a comment, adjust some whitespace, and use
a more direct comparison for equality.
2019-04-28 15:53:33 +02:00
Benno Schulenberg
37eccd3117
tweaks: rename a function, to be more fitting
...
Also, adjust some whitespace, for esthetics.
2019-04-28 11:01:51 +02:00
Benno Schulenberg
0b6889cbd8
tweaks: rename another function, to be distinct and fitting
2019-04-24 10:52:49 +02:00
Benno Schulenberg
00410d83fc
tweaks: rename a function, to be distinct and fitting
...
It was hard to remember that the "pt" stood for "plus tabs", and the
"len" seemed to say it was about number of bytes instead of columns.
2019-04-24 10:52:35 +02:00
Benno Schulenberg
c039aaad9d
tweaks: remove several unneeded bad-state checks and their messages
...
No one ever reported seeing any of them, and each of these checks
has been there for at least a year.
2019-04-14 19:38:04 +02:00
Benno Schulenberg
691eb1145c
tweaks: remove a function that is now unused
2019-04-04 14:53:53 +02:00
Benno Schulenberg
cddfcb1b9d
tweaks: rename a struct element, to make sense
2019-03-21 17:23:49 +01:00
Benno Schulenberg
6755b7c0a0
tweaks: rename four functions, to make more sense
2019-03-21 17:18:50 +01:00
Benno Schulenberg
aac4fc46e9
tweaks: rename a type, to make more sense
2019-03-21 17:08:52 +01:00
Benno Schulenberg
85e895508b
display: scroll horizontally one column earlier
...
In this way, for single-width characters, one can see what character is
ahead of the cursor before actually moving the cursor to that position,
and, for double-width characters, the cursor never sits on a placeholder
but always shows the character that is actually there.
This addresses https://savannah.gnu.org/bugs/?55716 .
2019-03-07 20:34:31 +01:00
Benno Schulenberg
79ca3ceabf
copyright: update the years for the FSF
2019-02-24 19:35:56 +01:00
Benno Schulenberg
f74a120803
tweaks: refer to the magic line as "magic line", not as "magicline"
2019-01-06 15:35:31 +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
a57c6a6763
tweaks: elide a one-line function that is used just twice
2018-12-27 21:19:47 +01:00
Benno Schulenberg
eaa0f1a122
tweaks: remove an unneeded check for NULL, and rename a parameter
...
(And if it were NULL, it should crash instead of passing over the bug.)
2018-11-05 13:05:17 +01:00
Benno Schulenberg
9e2a12b62a
tweaks: drop a check for the needle (the search string) being empty
...
No one ever reported seeing this. And even if the needle were empty,
this is not a problem: it will simply match right away.
2018-10-30 19:18:37 +01:00
Benno Schulenberg
e901387b72
tweaks: capitalize the word "nano" when at the start of a sentence
...
As is done in two other messages.
2018-10-23 19:42:07 +02:00
Brand Huntsman
d342cbbff8
display: make all dying messages end in a newline
...
So that the following shell prompt will not be glued onto the message
but will be on a line by itself.
Signed-off-by: Brand Huntsman <alpha@qzx.com >
2018-10-21 17:27:58 +02:00
Benno Schulenberg
c46696d40c
tweaks: delete some old debugging code that no longer seems useful
2018-07-18 19:53:44 +02:00
Benno Schulenberg
0353a24400
tweaks: rearrange a few if statements more symmetrically
2018-04-13 20:43:08 +02:00