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
Benno Schulenberg
30fc197b66
tweaks: adjust a couple of types, to reduce the number of warnings
...
This avoids eleven warnings of the kind "comparison between signed
and unsigned integer expressions [-Wsign-compare]".
2018-03-22 19:33:22 +01:00
Benno Schulenberg
d3012be095
tweaks: don't call strcmp() to determine whether a string is empty
2018-03-06 11:59:03 +01:00
Benno Schulenberg
899bf0ae3a
tweaks: exclude an unlikely error message from the tiny version
2018-03-05 12:45:19 +01:00
Benno Schulenberg
204e1b8353
memory: squeal when there is something wrong, instead of stumbling on
...
When copying a string, source and destination may not be equal --
complain loudly when they are, instead of failing to free memory.
Also, instead of freeing the destination string and then allocating
it afresh, just reallocate it -- that should be slightly quicker.
2018-02-07 19:34:43 +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
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
Benno Schulenberg
440a128d25
indenting: keep affecting last line of marked region if it was at first
...
When unindenting/uncommenting affected the bottom line of the marked
region, keep affecting this line also during subsequent consecutive
indenting/commenting.
This fixes https://savannah.gnu.org/bugs/?52718 .
2017-12-29 16:52:17 +01:00
Benno Schulenberg
23d66949e1
tweaks: frob four comments, and rewrap two lines
2017-12-24 11:53:38 +01:00
Benno Schulenberg
c22fef18e4
tweaks: reshuffle a bit of common code, moving it to an existing function
2017-12-23 21:50:18 +01:00
Benno Schulenberg
ee5b250b66
indenting: don't exclude last line of region when region is empty
...
This fixes https://savannah.gnu.org/bugs/?52717 .
2017-12-23 11:42:25 +01:00