Commit Graph

10031 Commits

Author SHA1 Message Date
Benno Schulenberg
1d10ee71bf syntax: python: mention an alternative linter in a comment 2022-07-26 12:28:49 +02:00
Benno Schulenberg
0520cbdccb syntax: perl: add missing keywords, and reduce the length of some lines
Also, compact the keywords less, so that things are easier to read.
2022-07-25 15:53:03 +02:00
Benno Schulenberg
3d3270c1b2 tweaks: put each regex on separate line, to better show many keywords
(The long list of keywords was divided over five separate regexes to
avoid exceeding the possible limit of 256 bytes/characters per regex.)
2022-07-25 14:48:40 +02:00
Benno Schulenberg
b60a26d40b tweaks: reshuffle a description and rewrap another
The reshuffling places the detailed descriptions of some commands
in the same section.
2022-07-25 10:45:02 +02:00
Benno Schulenberg
36fcdce886 docs: concisely describe how the linter behaves 2022-07-25 10:27:15 +02:00
Benno Schulenberg
b760388bbf help: reshuffle two shortcuts so that more help-line items are paired
Since version 6.0, Suspend is no longer bound by default, which meant
that it dropped out of the help lines, leaving the items after it in an
unpaired arrangement.  Move the Suspend item and its intended partner
to near the end of the list, to reestablish pairing for several items.
2022-07-25 09:08:02 +02:00
Benno Schulenberg
bb18524cce formatter: instead of leaving curses, use full_refresh() to wipe messages
This makes invoking the formatter cleaner, by giving feedback and *not*
leaving curses mode.  Leaving curses mode had the small advantage that
any messages from the formatter would be on the terminal after closing
nano.  But it had the disadvantage that invoking the formatter flashed
the screen.

This basically reverts commit 2b9f0619 from three years ago and then
solves the issue of intruding formatter messages in a different way.

This fulfills https://savannah.gnu.org/bugs/?62789.
Requested-by: Gert Cuykens <gert.cuykens@gmail.com>
2022-07-25 08:25:15 +02:00
Benno Schulenberg
05eaa0f0d7 tweaks: improve a comment, and reshuffle two functions plus some lines 2022-07-24 16:51:39 +02:00
Benno Schulenberg
d4a1dbd4a9 tweaks: rename two variables, to not contain the name of another
Also, elide an unneeded condition: when not softwrapping, left_x will
be zero, which is always smaller than or equal to the indentation.

Furthermore, reshuffle a few lines, improve three comments, and adjust
one to mention the parameter that was added in the previous commit.
2022-07-22 15:27:41 +02:00
Benno Schulenberg
0e9bef3429 display: remember text and column positions when softwrapping a line
This adjusts the main softwrapping routine so that it remembers the
reached point in a line's text and the corresponding column.  This
avoids having to scan the line from the beginning for each iterative
call, and thus saves a substantial amount of time when softwrapping
very long lines.

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

Original-patch-by: Devin Hussey <husseydevin@gmail.com>
2022-07-20 14:06:24 +02:00
Benno Schulenberg
34238dc119 files: designate the root directory with a simple "/", not with "//"
The double slash would derail the file browser, causing a crash.

This fixes https://savannah.gnu.org/bugs/?62760.
Reported-by: Frank Wolff

Bug existed since version 6.3, commit fdd946c0.
2022-07-13 19:28:53 +02:00
Benno Schulenberg
18a40caa48 docs: remove the two notices about the changed defaults
It has been more than three years since version 4.0 was released,
the moment that the defaults for line wrapping, smooth scrolling,
and the size of the editing window were changed.

Keep the note in the texi manual, though, as it is less in the way,
and the manual generally contains more info than the man pages.
2022-06-19 10:30:44 +02:00
Benno Schulenberg
1980f1b2ba docs: stop mentioning the obsoleted keywords that were removed
But keep the note about --suspendable, as it has been obsoleted rather
recentl.  Move it to the NOTES section.
2022-06-19 10:29:46 +02:00
LIU Hao
ec0c13afda build: ignore errors from git describe
Due to CVE-2022-24765, Git refuses to operate on local repositories if
it runs as a different user from its owner.  Since version 2.35.2:

  $ sudo git describe --tags
  fatal: unsafe repository ('/home/lh_mouse/GitHub/nano-win' is owned by someone else)
  To add an exception for this directory, call:

    git config --global --add safe.directory /home/lh_mouse/GitHub/nano-win

Conventionally, a user, who wishes to build and install nano from Git,
does this:

  $ ./configure
  $ make
  $ sudo make install

The first `make` command builds the program as the current user.
The `make install` then installs the built files.

However, we have a recipe for 'revision.h' that is always executed,
even in the case of `make install`.  As here it is run as root, Git
actually fails and produces an empty string.  This causes `make install`
to rebuild nano.o and winio.o and results in an empty version string in
the upper left corner.

The solution is simple: First we attempt a dryrun of `git describe`.
If it fails, 'revision.h', which should have been updated by the first
`make` command, will be left intact.

Reference: https://nvd.nist.gov/vuln/detail/CVE-2022-24765

Signed-off-by: LIU Hao <lh_mouse@126.com>
2022-06-14 11:54:47 +02:00
Benno Schulenberg
ed41b3cefa version: condense the copyright message, to not dominate the output
It is enough to mention the year of the current release in the copyright
statement -- no need to specify the historical range of years.
2022-06-12 17:31:08 +02:00
Benno Schulenberg
80a924edfa docs: rename README.GIT to README.hacking, so it's clearer what is meant 2022-06-12 17:29:32 +02:00
Benno Schulenberg
98f9518bf2 rcfile: remove five obsolete or deprecated keywords 2022-06-12 17:03:15 +02:00
Benno Schulenberg
1de47610f4 syntax: default: do not colorize a square or angle bracket after a URL
Sometimes a URL is wrapped in [] or <> brackets -- the closing ] or >
is not part of the URL and should not be colored.
2022-06-07 17:24:23 +02:00
Benno Schulenberg
25ba7712f7 po: update translations and regenerate POT file and PO files 2022-04-28 10:36:42 +02:00
Benno Schulenberg
a6b534d760 bump version numbers and add a news item for the 6.3 release 2022-04-28 10:08:34 +02:00
Benno Schulenberg
494b191d55 gnulib: pull in the workaround for a build problem on NetBSD 2022-04-27 11:23:09 +02:00
Benno Schulenberg
450bfa7a75 build: fix compilation for --enable-{tiny,nanorc,color} 2022-04-22 11:47:21 +02:00
Benno Schulenberg
a52ac1375a formatting: change cursor position only after saving it in the undo item
When one wants an Undo to restore the cursor to where it was before an
operation, one shouldn't fiddle with the position before it is stored
in the relevant undo item.

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

Bug existed since version 4.9, commit 38af812a.

(This effectively reverts commit 38af812a from two years ago.)
2022-04-21 12:31:19 +02:00
Benno Schulenberg
4990713e9e tweaks: change the indentation of a list, to match other indentations 2022-04-19 11:15:18 +02:00
Benno Schulenberg
c022c4cc6d docs: add an example binding for copying text to the system clipboard 2022-04-12 11:18:25 +02:00
Benno Schulenberg
6257dec0a7 filtering: close all output descriptors, so that 'xsel' will terminate
For some reason, when copying something to the system clipboard
with 'xsel', it wants to see all output descriptors closed before
it will exit without requiring ^C.

This fixes https://savannah.gnu.org/bugs/?62276.
Reported-by: Shi Yanling <sylphenix@126.com>

Bug existed since version 2.9.8, since piping text through an
external command was introduced.
2022-04-12 11:09:09 +02:00
Benno Schulenberg
ea9d49b9d8 tweaks: remove some stray spaces before a comma 2022-04-11 10:31:39 +02:00
Benno Schulenberg
42c7bfcf8a verbatim: with --zero, keep cursor in viewport when it was on bottom row
This fixes https://savannah.gnu.org/bugs/?62285.

Bug existed since version 6.0, since --zero was introduced.
2022-04-11 10:28:09 +02:00
Benno Schulenberg
e67d1bfeb8 build: fix compilation when configured with --disable-color 2022-04-08 11:35:44 +02:00
Benno Schulenberg
e2f444cfdf gnulib: update to its current upstream state 2022-04-08 10:52:55 +02:00
Benno Schulenberg
03b85df4eb tweaks: remove redundant braces, and add two translator hints 2022-04-08 09:38:42 +02:00
Benno Schulenberg
7db5c2f225 files: when the working directory exists, still check its accessibility
This fixes https://savannah.gnu.org/bugs/?62258.

Bug existed since commit 940b5eaa from yesterday.
2022-04-06 16:41:45 +02:00
Benno Schulenberg
603ce231d0 tweaks: simplify a fragment of code, and fold two lines together 2022-04-05 12:40:45 +02:00
Benno Schulenberg
940b5eaad1 files: show a warning when the working directory is gone (when used)
Instead of silently opening an empty buffer when the user tries to
open a file in the current but disappeared directory, give a clear
warning about the absence of this directory.

This improves the fix for https://savannah.gnu.org/bugs/?62244.
2022-04-05 12:34:04 +02:00
Benno Schulenberg
fdd946c02c files: do not change to a higher directory when the working one is gone
When the working directory has been deleted from under nano's feet,
get_full_path() would move up in the directory tree until getcwd()
would succeed.  This meant that a filename that was specified on the
command line without any path (or with a relative path) would refer
to a different file than what the user intended.  Not good.

So, stop changing directories in get_full_path().  Use the realpath()
function with NULL as second parameter instead -- it has been part of
the POSIX standard since 2008, time enough for operating systems to
have caught up.

In the bargain, this saves seventy lines of complicated logic.

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

Bug existed since version 2.0.0, commit 85e35e67.
2022-04-04 12:52:35 +02:00
Benno Schulenberg
81e5b57d74 syntax: xml: colorize user-defined entities differently
Also improve two comments.
2022-04-04 12:08:23 +02:00
Benno Schulenberg
b568705eec syntax: xml: colorize /> properly, and colorize prolog tags differently
Use lightgrey for the prolog tags, as they normally are unimportant
boiler-plate stuff.  Comments are likely to be more relevant.

Any /> is part of the tag itself, not of the attributes.
2022-04-04 10:01:49 +02:00
Benno Schulenberg
fe42eb7a1a painting: stop coloring an extremely long line after 2000 bytes
Especially when softwrapping and when multiline regexes are involved,
colorizing takes roughly exponential time relative to the line length.
To avoid bogging down, stop colorizing a line beyond a certain point.

This mitigates https://savannah.gnu.org/bugs/?61799.
Reported-by: Devin Hussey <husseydevin@gmail.com>
2022-04-03 12:28:22 +02:00
Benno Schulenberg
df7b0a6d97 execute: clear an anchor only when the whole buffer gets filtered
Although an anchor at the top line is rather pointless, it shouldn't
get cleared when the user pipes just a part of the buffer through an
external command.
2022-03-28 11:38:22 +02:00
Benno Schulenberg
fcf598e797 execute: stay on the same line number when filtering the whole buffer
When the filter command makes just small, per-line changes, keeping the
cursor at the same line number allows the user to observe the effect of
the changes -- which is not possible when the cursor gets moved to the
end of the buffer.

This partially fulfills https://savannah.gnu.org/bugs/?57248.
2022-03-28 11:15:04 +02:00
Benno Schulenberg
d9cb12f6e3 tweaks: move the saving and restoring of flags to where it is needed 2022-03-27 18:44:48 +02:00
Benno Schulenberg
0f23729253 tweaks: prevent the adding of an unwanted newline in a different way
The prevention is needed only for temporary files, not for normal files.
2022-03-27 18:20:17 +02:00
Benno Schulenberg
3def429290 tweaks: don't leave an orphaned temporary file behind when writing fails 2022-03-27 12:37:01 +02:00
Benno Schulenberg
803ea0d7a0 justify: stay at the same line number when doing a full justification
The same line number may not be the same position in the text, but
it will be approximately -- and it is certainly better than leaving
the cursor at the end of the buffer.

This fulfills https://savannah.gnu.org/bugs/?61175.
2022-03-24 17:05:55 +01:00
Benno Schulenberg
9b014876cd tweaks: trim a few comments, rename a function, and reshuffle some code 2022-03-20 13:20:31 +01:00
Benno Schulenberg
9ccf85eaa8 tweaks: avoid a function call when two plain assignments will do 2022-03-18 11:40:03 +01:00
Benno Schulenberg
93fa53c3e8 tweaks: elide an unneeded call of strlen() 2022-03-18 11:36:10 +01:00
Benno Schulenberg
eea3e1f0b2 tweaks: make the triggering of the recalculation of multidata less eager
Also, trigger recalculation when an undo or redo causes a large enough
forward jump.
2022-03-18 11:29:18 +01:00
Benno Schulenberg
e6e22ea976 tweaks: normalize the indentation after the previous change 2022-03-17 14:09:09 +01:00
Benno Schulenberg
80c2000f87 tweaks: simplify a bit of code, eliding two labels and three gotos 2022-03-17 14:09:09 +01:00