Commit Graph

1192 Commits (a43ee17ad02149cf1113f76804c4d85ea579fa8d)

Author SHA1 Message Date
Benno Schulenberg 8e7738e22e tweaks: adjust two values -- help lines need at least 6 rows to be shown
Commit 931bf96c from four days ago incremented the minimum height.
2021-11-21 16:52:13 +01:00
Benno Schulenberg d3c7e9d2f6 tweaks: rename two functions, to get rid of another senseless suffix 2021-11-08 16:41:44 +01:00
Benno Schulenberg 308d6e73e3 tweaks: normalize whitespace, drop unneeded prototype, condense comment 2021-11-07 15:51:32 +01:00
Benno Schulenberg 167c93b85c justify: correctly determine whether top-of-buffer has been reached
The text to be justified has been excised from the buffer and is now
in the cutbuffer, so we cannot compare any of its lines to 'filetop'.

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

Bug existed since version 4.0, commit 14c08589.
2021-11-07 15:20:18 +01:00
Benno Schulenberg ba093b0b48 tweaks: elide two parameters, as they are now always the same 2021-10-27 16:30:23 +02:00
Benno Schulenberg 33041d0ad5 statusbar: count words in the way that matches how Ctrl+Right moves
When --wordbounds (-W) is active, nano considers punctuation as
word-forming characters and will thus count words the same way
as 'wc -w' does.  This is how nano counted words until now.

But when --wordbounds is not active (the default), only letters
and digits will be considered word-forming and thus lone groups
of lines and dashes and other punctuation will not be counted
as words, which is more like how a human would count words.

This addresses https://savannah.gnu.org/bugs/?61367.
2021-10-27 16:23:29 +02:00
Benno Schulenberg 9b419d0bff tweaks: rename a function, to describe better what it does nowadays 2021-10-22 11:50:04 +02:00
Benno Schulenberg 918ce1afa3 tweaks: just let do_wrap() set 'refresh_needed' instead of returning TRUE
This gets rid of performing an action in the condition of an 'if'.
2021-10-21 11:58:43 +02:00
Hussam al-Homsi bb8f40989f tweaks: change 'return ++var;' to 'return var + 1;'
This avoids an unused and misleading assignment that might make
someone think the incremented variable will be used again.

Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
2021-10-02 17:41:03 +02:00
Benno Schulenberg fde86518ae tweaks: rename a function, to be more fitting
The file wasn't marked; a piece of text was marked, resulting in
a region, and it is this region that gets written out to a file.
2021-09-29 15:37:06 +02:00
Benno Schulenberg 61b3aa6626 tweaks: use five symbolic names, to make eight function calls clearer 2021-09-29 15:35:18 +02:00
Benno Schulenberg 6799bc69a6 tweaks: adjust three parameters -- two were mistaken, one superfluous
The calls of write_file() in do_spell() and do_formatter() write out
a temporary file -- such a file does not have an 'openfile' record,
so setting 'annotate' to TRUE was pointless.  Using the correct value
for this parameter allows dropping two conditions in write_file().

And when 'exiting' is TRUE and --save-on-exit is in effect, it is
slightly wasteful to stat() the written file and store the info in
its 'openfile' record as the buffer will be closed directly after.

So, now the only place where 'annotate' is TRUE is when writing out
the full buffer to a normally named file.
2021-09-29 15:04:22 +02:00
Benno Schulenberg c74fd81302 tweaks: rename a parameter and invert its logic
This makes more sense (an emergency file is not a temp file) and
avoids the constant negating.
2021-09-29 12:20:21 +02:00
Benno Schulenberg 2087c20a83 tweaks: in comments, say "buffer" instead of "file" where appropriate 2021-09-27 16:37:03 +02:00
Benno Schulenberg 5512c63bdd copyright: update to the current year for significantly changed files 2021-09-24 11:01:41 +02:00
Benno Schulenberg fdc0b0ac24 tweaks: rename three variables, to follow the general scheme
Also rewrap a line, reshuffle two others, and remove two redundant
comments.
2021-09-20 10:08:56 +02:00
Benno Schulenberg 189960c467 cutting: copy anchors into the cutbuffer, so that undo can restore them
When a segment of text is extracted, copy any anchors that it has
into the cutbuffer, so that they get saved in the undo item, so that
an undo will put these anchors back on the lines where they were,
instead of leaving an inherited anchor at the top of the segment.

And when text is pasted, clear any anchors in it, so that they will
not travel nor multiply.

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

Bug existed since version 5.0, since anchors were introduced.
2021-09-19 11:29:39 +02:00
Benno Schulenberg 04f8aa83ef tweaks: reshuffle a few lines, for esthetics and to elide an #ifdef 2021-09-17 10:06:21 +02:00
Benno Schulenberg 650dc14e0f tweaks: rename a defined type, to fit within the general pattern
So that it can be colorized as a type by a general syntax rule.

(The name is now uglier than it was, but... alas.)
2021-09-11 18:05:03 +02:00
Benno Schulenberg 3c35538e8b tweaks: add Schiermonnikoog to the list of friendly islands
(The commit message is a joke, of course.  Instead, this commit just
removes some unneeded comments and corrects one bit of whitespace.)
2021-06-16 11:19:23 +02:00
Benno Schulenberg bf7954bdb7 tweaks: rename a variable, for contrast with the function name 2021-06-13 16:57:54 +02:00
Benno Schulenberg 0371dd1bde tweaks: rename two functions, to get rid of an ugly _void suffix
Also drop an unneeded prototype.
2021-06-13 12:17:33 +02:00
Benno Schulenberg 7c53b133a1 tweaks: use two symbolic names instead of TRUE and FALSE, for clarity 2021-06-13 12:06:24 +02:00
Benno Schulenberg 97dd505647 linter: strip filename and line plus column number from the message
Nano already opens the relevant file (when needed) and puts the cursor
at the relevant spot -- including this information in the message shown
on the bottom bar is just clutter and makes the message harder to read.
2021-05-30 11:30:32 +02:00
Benno Schulenberg 6ab70c2b0a tweaks: improve a comment, remove unneeded braces, reshuffle some lines 2021-05-28 16:42:56 +02:00
Benno Schulenberg 3a86b24a3e tweaks: remove a check that is not needed
The die() has been there for more than a year and no one reported a
problem.  And anyway, indenting does not create more than one group
-- this check was just to be certain.
2021-05-28 16:20:59 +02:00
Benno Schulenberg 51adf02d34 wrapping: when copying the quoting part, adjust the file size accordingly
Simply adding the number of bytes in the quoting part is not entirely
correct, but... currently the indenting and commenting routines also
assume that the whitespace and commenting characters that are added or
removed are single-byte characters...  It will require another patch
to make this all fully correct, but for the default configuration
(and probably most other cases) the current fix will work fine.

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

Bug existed since version 4.4, commit 8fce33af from two years ago,
since this automatic copying of the quoting part was introduced.
2021-05-14 10:24:07 +02:00
Benno Schulenberg f23e98dd3a memory: prevent a leak when copying the leading quoting to the next line
This fixes https://savannah.gnu.org/bugs/?60596.

Bug existed since version 4.4, commit 8fce33af from two years ago,
since this automatic copying of the quoting part was introduced.
2021-05-14 09:56:45 +02:00
Benno Schulenberg 5f87ed5644 statusbar: ensure that "No further matches" does not get overwritten
Redraw the content of the edit window (for the undone final completion)
before pushing out the "No further matches" message, so that the latter
will not get overwritten by the buffer content -- in case the terminal
has just one row.

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

Bug existed since commit 2cf28f9d from yesterday.
2021-05-11 15:58:21 +02:00
Benno Schulenberg 07fd4c4598 tweaks: condense and correct a comment, and move another
Since commit 5dcf375f from four years ago, a linter message must
contain a colon followed by a space for it to be recognized as a
linter message.
2021-05-07 12:40:25 +02:00
Benno Schulenberg 4712d46462 linter: block the resizing signal while reading output from the linter
This prevents read() from returning unexpectedly and causing a crash.

This fixes https://savannah.gnu.org/bugs/?60537.
Reported-by: Filips Romāns <frfilips@gmail.com>

Bug existed since version 2.4.2, since the handling of SIGWINCH changed.
2021-05-06 13:30:41 +02:00
Benno Schulenberg 49d8b99e4f softwrap: avoid time-consuming computations, to burden large files less
Whenever softwrap was toggled on or line numbers were toggled on/off or
the window was resized, the extra rows per line needed to be recomputed
for ALL the lines.  For large files with many long lines this was too
costly.

(This change causes the indicator to have an incorrect size when there
are many softwrapped chunks onscreen, but that will be addressed later.)

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

Problem existed since version 5.0, since the indicator was introduced.
2021-04-21 16:40:20 +02:00
Benno Schulenberg 0dcac9188f tweaks: simplify two fragments of code, eliding useless character copying 2021-03-29 20:06:05 +02:00
Benno Schulenberg f6357a73f0 memory: fix an off-by-one error to free also the last line in a group
The number of lines in a group is the difference in line numbers
between the last line and the first line *plus one*.

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

Bug existed since version 2.9.0, since indenting and unindenting
became undoable, and commit f722c532 formed a part of that.
2021-03-05 18:50:34 +01:00
Benno Schulenberg b9328d0eac feedback: make Full Justify show a message also when using --minibar
Full justification (like justification of a selection) is probably
a rather rare action -- and possibly even an unintended action --
so it's good to give feedback about what happened also when using
the minibar.
2021-02-20 12:11:43 +01:00
Benno Schulenberg bc36813349 memory: avoid leaking the speller or linter command string, when invoked
This fixes https://savannah.gnu.org/bugs/?59854.
Reported-by: Mike Frysinger <vapier@gentoo.org>

Bug existed probably since version 2.9.6, commit 94347f08.
2021-01-11 19:36:34 +01:00
Benno Schulenberg 9266fa6657 speller: do an internal spell check when --speller is an empty string
This fixes https://savannah.gnu.org/bugs/?59855.
Indirectly-reported-by: Mike Frysinger <vapier@gentoo.org>

Bug existed since version 2.9.6, commit 94347f08.
2021-01-11 16:05:54 +01:00
Benno Schulenberg 6360e4170a copyright: update the years for the FSF 2021-01-11 14:22:51 +01:00
Benno Schulenberg 6a88fe8807 tweaks: fold two similar and three identical cases together 2021-01-01 20:27:30 +01:00
Benno Schulenberg 90f6f25e31 oops: use the correct condition for checking the last line will change
Only when the replacement string (in 'answer') is non-empty will the
last line be changed and thus possibly a magic lined added.
2021-01-01 20:09:42 +01:00
Benno Schulenberg 0f4bb64eaf undo: remove the added magic line when a replacement caused one
This fixes https://savannah.gnu.org/bugs/?59796.

Bug existed since before version 2.2.4.
2021-01-01 19:48:03 +01:00
Benno Schulenberg b86f7868d1 feedback: differentiate between remarks, mistakes, and information
Remarks are about unsurprising things but it's good to give feedback
on them; "mistakes" are unexpected things, and get colored like an
error; and information is something that the user requested and thus
needs to stay on the status bar until the next keystroke.
2020-12-23 12:17:06 +01:00
Benno Schulenberg b89bc2cce6 minibar: show the info bar again some 0.8 seconds after a message
Instead of redisplaying the minibar only upon the next keystroke
(when some feedback message is shown on the status bar), time the
waiting for the keystroke out after four fifths of a second, then
redisplay the minibar and continue the wait.
2020-12-23 12:17:06 +01:00
Benno Schulenberg 96e4fec31c tweaks: use a boolean instead of an enumeration of two values 2020-12-19 16:40:21 +01:00
Benno Schulenberg a3a1391a51 tweaks: rename two variables, one for contrast, another for visibility
Also normalize two bits of whitespace.
2020-11-30 13:32:22 +01:00
Benno Schulenberg d3d2d324d2 statusbar: properly pluralize the line+word+character count report
This avoids poor wordings such as "Words: 1  Lines: 1  Chars: 1".

Also, display the numbers in a more logical, ascending order: lines
first, words second, characters third.  This is what 'wc' uses, too.
2020-11-21 15:25:23 +01:00
Benno Schulenberg 7f184ee2ba linting: avoid putting the cursor beyond the end of the line
Some linters report a column position (assuming a TAB to be 8 spaces)
instead of a byte index, so make sure that the cursor is not placed
out of bounds when interpreting such a column number as an index.

This fixes https://savannah.gnu.org/bugs/?59419.
Reported-by: Ava McWhorter <qwerty0s.e.m@gmail.com>

Bug existed since version 2.8.1, commit 2439e1e4.
2020-11-06 10:36:08 +01:00
Benno Schulenberg e1601d2eb5 tweaks: use the standard symbols for the three standard file descriptors
Also, take into account (as elsewhere) that dup2() could fail,
and harmonize their error checks.
2020-10-10 12:32:02 +02:00
Benno Schulenberg 620496f5cd build: avoid two compiler warnings when gnulib has been ripped out 2020-09-14 11:02:31 +02:00
Hussam al-Homsi c87bc1d55f tweaks: stop casting the return of malloc() and friends
Those casts are redundant, and sometimes ugly.  And as the types of
variables are extremely unlikely to change any more at this point,
the protection they offer against miscompilations is moot.

Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
2020-08-31 12:17:27 +02:00