Commit Graph

9266 Commits (73cd96838e5ea7cb2f72d335ff31eaeb796d7764)

Author SHA1 Message Date
Benno Schulenberg 73cd96838e help: do not leave the cursor on the status bar after a search
(This effectively reverts commit ba47abb4 from two days ago, but it
groups things better.  It makes an unnecessary call to bottombars()
for M-Q and M-W, but this hardly matters: searching in a help text
does not need to be efficient.)

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

Bug existed since commit ba47abb4 from two days ago.
2020-09-13 10:24:22 +02:00
Benno Schulenberg 82080b044b docs: mention that syntax definitions are available in /usr/share/nano/
Inspired-by: Hussam al-Homsi <sawuare@gmail.com>
2020-09-12 12:48:37 +02:00
Benno Schulenberg 93b25ce014 tweaks: adjust some whitespace in the docs, and improve a comment 2020-09-12 12:21:24 +02:00
Benno Schulenberg f883465263 build: exclude reading a file from standard input from the tiny version
The tiny version is about being small, not about convenience features
that hardly anyone uses anyway.

Also exclude the description of the "+line[,column]" feature -- it is
unneeded verbosity.

This addresses https://savannah.gnu.org/bugs/?59101.
2020-09-12 11:44:22 +02:00
Benno Schulenberg ba049fcaf8 tweaks: avoid a compiler warning when compiling with more than -O1 2020-09-11 18:59:04 +02:00
Benno Schulenberg ba47abb473 help: ensure the help lines are always drawn, also when using Slang
This is needed when --enable-tiny and --with-slang are used together
with --enable-help.
2020-09-11 18:55:21 +02:00
Benno Schulenberg b9a1a586c0 display: force the cursor to reappear in a better way (when using Slang)
The cursor would disappear after any message on the status bar --
for example, also when M-W is typed and nothing is found -- so the
mitigation trick needs to be performed in statusline() itself.

This addresses https://savannah.gnu.org/bugs/?59091.
2020-09-11 18:54:49 +02:00
Benno Schulenberg 7b19b4114c docs: improve two wordings in the sample nanorc 2020-09-11 10:45:19 +02:00
Benno Schulenberg 3e9c2ecc85 help: in the tiny version, show Prev/Next Word before Backward/Forward
In the tiny version (built with Slang and running on Debian's bterm)
the Ctrl+Left/Ctrl+Right keystrokes do not work.  When the terminal
is wide enough, instead of showing ^B + ^F for Backward and Forward
(which are unneeded because the unmodified arrow keys work fine),
show M-B + M-N for Prev Word and Next Word.

(Listing ^Space and M-Space instead would cause "Prev Word" and
"Next Word" to be truncated.  They are weird keystrokes anyway.)

Also, list M-Q + M-W for "Previous" and "Next" next to "Where Is"
and "Replace", so that it is slightly clearer what they refer to.
2020-09-11 10:00:21 +02:00
Benno Schulenberg 3940032cd3 syntax: po: do not leave the occasional tab with a red background color 2020-09-10 19:48:31 +02:00
Benno Schulenberg d2d0c665b1 display: force the cursor to reappear after a message (when using Slang)
For some reason, when running a tiny nano built with Slang on the bterm
of a Debian installer image, the cursor disappears when certain things
are written to the status bar.  Make the cursor reappear by rewriting
the two help lines with dummy items (and then rewriting it again with
the normal menu in the central loop).  Of course, this does not help
when the user uses -x or --nohelp to suppress the help lines, but at
least in the default setup the cursor doesn't get hidden now and then.

This mitigates https://savannah.gnu.org/bugs/?59091.

Bug existed since before version 2.2.4.
2020-09-10 18:46:48 +02:00
Benno Schulenberg 50aa3587d4 build: abort the update script if a PO file contains a control character
This is to prevent the ^Q from creeping back into the Romanian PO file.
2020-09-09 16:38:39 +02:00
Benno Schulenberg 0bc834e6f3 syntax: po: highlight embedded control codes that shouldn't be there
For some reason the Romanian PO file contains a literal ^Q in one
of its translated messages -- currently at line 1984.  This stray
^Q causes 'file' to classify po/ro.po as data.

Make such mistaken control codes easier to spot when using nano.
2020-09-08 19:38:55 +02:00
Benno Schulenberg dd24f6a18d suspension: resume properly from an external SIGSTOP (when using Slang)
Slang apparently needs a call to SLsmg_refresh() to restore the screen
content and put the cursor in the right place.  But call this function
only when the suspension was actually caused by an external SIGSTOP,
because otherwise the original screen (from which nano was invoked)
gets plastered with nano's interface and content -- upon exit, this
is annoying and confusing.

Do not stuff a dummy keystroke into the input stream, as it seems to
get placed *after* the first byte of the next keystroke from the user.
That would cause an "Unknown sequence" for some keystrokes.

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

Bug existed since version 2.8.5, commit 84ff9ebb.
2020-09-08 16:54:06 +02:00
Benno Schulenberg 462e9d4822 suspension: switch off flow control at the right moment (for Slang)
This fixes https://savannah.gnu.org/bugs/?59078.

Bug existed since version 4.8, commit c09e96f2.
2020-09-08 09:15:12 +02:00
Benno Schulenberg 48ac0a64c6 tweaks: dummy commit, to add some info about the previous one
The previous commit fixed https://savannah.gnu.org/bugs/?59071.

That bug existed since version 5.1, commit cc6d1d59.

But before that, a capital Ñ could not be typed (when built with Slang)
and would enter an invalid byte upon the next keystroke.

That bug existed since version 2.8.6, commit 43a5c876.
2020-09-08 09:05:01 +02:00
Benno Schulenberg cf4901da2d suspension: do not enter an invalid byte upon resume (when using Slang)
Instead of stuffing 0x91 into the input stream, use 0xFF when built
with Slang -- the same code that Slang itself produces when resuming
from an externally induced suspension.  This byte is ignored.

In a UTF-8 locale, it should be safe to ignore the byte 0xFF coming
from the keyboard, as no valid UTF-8 sequence can contain 0xFF.

In an ISO8859 locale, this change prevents ÿ from being typed on the
keyboard -- it can still be entered with <Esc> <Esc> 255, though.
My apologies to the people of Pierre Louÿs and L'Haÿ-les-Roses.
2020-09-07 17:09:57 +02:00
Benno Schulenberg 9f20fadee1 tweaks: normalize the indentation after the previous change 2020-09-07 11:44:29 +02:00
Benno Schulenberg 0f7a309adc suspension: properly resume from an external SIGSTOP
Trying to ignore an external SIGSTOP/SIGTSTP with SIG_IGN does not work,
so always install the SIGCONT handler so that it is possible to continue
from a SIGSTOP.

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

Bug existed since before version 2.0.6.
2020-09-07 11:26:04 +02:00
Benno Schulenberg c771167b6a tweaks: add some comments to the C syntax, and sort some keywords
Also, fold three regexes into one, eliding some redundant parentheses.
2020-09-06 11:14:16 +02:00
Hussam al-Homsi e1cf93640c syntax: c: colorize also the keywords that start with an underscore
Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
2020-09-06 10:48:07 +02:00
Hussam al-Homsi 1716f140b7 syntax: c: colorize also the 'restrict' keyword, and the #line directive
Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
2020-09-06 10:44:43 +02:00
Benno Schulenberg 586a7d22e7 docs: add the customary (1) after the name of command-line programs
Also, don't format the wrapping quotes of strings,
and normalize the formatting of default values.

This addresses https://savannah.gnu.org/bugs/?59064.
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
2020-09-05 19:43:51 +02:00
Hussam al-Homsi cab9294f62 syntax: c: colorize also one-character constants, and the null directive
Constants that consist of a single character are valid too.
And a lone hash character on a line by itself also.

Signed-off-by: Hussam al-Homsi <sawuare@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2020-09-05 13:25:54 +02:00
Benno Schulenberg 98a24fc8f9 build: to verify wide curses, probe for a function that cannot be a macro
This probing has been changed four times in the past:

    git log --grep get_wch

In March 2005, commit 2161fa62 changed the probe from get_wch() to
wget_wch(), reasoning that "get_wch() might be a macro instead of
a function".  (Four months earlier, commit 3ba9c351 changed it
from addwstr() to wget_wch(), probably for the same reason.)  But
three months later, in commit 25799f68, the probe gets changed to
get_wch() again, because "it's a more generic function"...

It seems clear that the non-macro argument is the stronger one.
See the NOTES section in 'man get_wch' for its possible macroness.

This addresses https://savannah.gnu.org/bugs/?58997.
Reported-by: Randall S. Becker <rsbecker@nexbridge.com>
2020-09-03 19:47:09 +02:00
Benno Schulenberg bbc7c59563 browser: sort names that differ only in case with uppercase first
This is the opposite of what 'ls' does in a UTF-8 locale, but nano
has never followed the collating rules of Unicode (uppercase after
lowercase, ignoring punctuation, and so on) -- it would be strange
to change that now.

Until now, nano left such equivalent names unsorted, in a seemingly
random order.

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

Bug existed since before version 2.0.6.
2020-09-03 16:28:47 +02:00
Benno Schulenberg b122d3b8e5 docs: explain the 'set scrollercolor' option, for coloring the indicator
And mention that a background color does not work on libvte before 0.55.

To find out the version of libvte on your system:

  ls -R1 /usr/lib | grep libvte | grep 00 | grep -o "0\..."
2020-09-02 19:55:24 +02:00
Benno Schulenberg 46e769a113 rcfile: add 'set scrollercolor', for changing the color of the indicator
This fulfills https://savannah.gnu.org/bugs/?59041.
2020-09-02 19:55:24 +02:00
Benno Schulenberg 79545187b8 tweaks: move two more functions, to before the ones that call them 2020-09-02 10:19:04 +02:00
Benno Schulenberg 413a83c2e2 tweaks: move two more functions, to before the one that calls them 2020-09-02 10:09:20 +02:00
Benno Schulenberg ab08eebfc1 tweaks: move three functions, to before the ones that call them 2020-09-02 10:02:55 +02:00
Benno Schulenberg ac4c56f636 tweaks: fold one function into another, to elide an unneeded return value 2020-09-02 09:55:08 +02:00
Benno Schulenberg 1db7d57a24 browser: make M-W/M-Q functional right after startup, if there is history
Do the same what the normal "research" code does: if nothing was
searched for yet during this session, and there is a history of
search items, then search for the last item in that history.
2020-09-02 09:22:50 +02:00
Benno Schulenberg e32ca98ccf tweaks: condense a bit of code
Make it equal to what the normal search code does.
2020-09-02 09:15:23 +02:00
Benno Schulenberg 5a635db262 chars: reduce searching time with roughly 85 percent for plain ASCII
Make case-insensitive searching in a UTF-8 locale eight times faster
when the actual characters involved are plain ASCII.

This makes us faster than 'less', and as fast as Vim and Emacs.

The disadvantage of this change is that searching for a string that
begins with a multibyte character is nearly ten times slower than
searching for one that begins with an ASCII character.  This may be
unsettling when searching a huge file first for a simple ASCII string
and later for a UTF-8 one.  Doing this second search, the user might
get impatient: "Why is it taking so long?"

(This patch fell through the cracks four years ago, when I worked on
the searching code.  It sat in a branch on top of other changes that
I never applied because I made different improvements.  The speedup
at the time, on that machine, was only around sixty percent, though.
But measuring it now again on the same machine, it clocks in at an
82 percent reduction with -O0 and an 87 percent reduction with -O2.)
2020-09-01 19:35:34 +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
Benno Schulenberg 5c63975097 tweaks: rename four variables, reshuffle them, and correct one type
Also, drop three unneeded comments.
2020-08-25 12:13:55 +02:00
Benno Schulenberg fee905a34a tweaks: drop the unneeded saving and restoring of a global variable
The two functions findnextstr() and do_replace_loop() do not change
or even touch 'last_search', so there is no need to save and then
restore its value when doing corrections of misspelled words.
2020-08-25 11:58:04 +02:00
Benno Schulenberg 070c9c60ec po: update translations and regenerate POT file and PO files 2020-08-24 11:08:23 +02:00
Benno Schulenberg 63ac050733 bump version numbers and add a news item for the 5.2 release 2020-08-24 09:53:07 +02:00
Benno Schulenberg 3ade8b29cc build: stop distributing the README.GIT file
There is no need for normal users to build from git.  Do not give
the impression that that procedure is in any way recommended.
2020-08-24 09:29:05 +02:00
Benno Schulenberg 51a6d5897e gnulib: back away from a commit that causes trouble when using clang
The issue has been reported here:
  https://lists.gnu.org/archive/html/bug-gnulib/2020-08/msg00202.html
2020-08-23 10:52:20 +02:00
Benno Schulenberg 785d28d5d1 gnulib: update to its current upstream state 2020-08-23 09:10:35 +02:00
Benno Schulenberg 4873cc26f2 build: stop mentioning Slang in two ./configure messages
Nobody ought to be using Slang, so don't give people the wrong
impression by mentioning it (and even mentioning it *first*).
2020-08-23 09:05:47 +02:00
Benno Schulenberg 0f8423eb4c tweaks: elide an unneeded variable
Storing the orientation of the marked region beforehand is not needed,
as this orientation is readily available also after the justification.

(By the way, cursor and mark need to be swapped after justifying
a backward-marked region because the rule is that the cursor gets
placed *after* the justified paragraph.  Maybe that should change?)
2020-08-22 19:35:48 +02:00
Benno Schulenberg b60fec5db3 history: do not interpret a failing stat() as an error
The most likely reason for stat() returning -1 is that the file
does not exist.  And an absent positionlog file is not an error.
(In some cases it is, like immediately after writing the file,
but even then we don't want to complain, because it may have
been some other process that deleted the file straightaway.)

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

Bug existed since version 5.0, commit fcb9e58b.
2020-08-22 10:27:02 +02:00
Benno Schulenberg 7ffbf01607 tweaks: improve three comments and an indentation 2020-08-21 16:06:38 +02:00
Benno Schulenberg f6b4c243d8 tweaks: reshuffle four declarations, and rename two variables 2020-08-21 16:03:59 +02:00
Benno Schulenberg 0287be7660 tweaks: move the keyboard-checking code to the end of the search loop 2020-08-20 10:51:19 +02:00
Benno Schulenberg e6709d684b tweaks: condense two fragments of code, for compactness 2020-08-20 10:44:06 +02:00