Commit Graph

10071 Commits

Author SHA1 Message Date
Benno Schulenberg
aba4f4e0e2 tweaks: avoid sometimes calling a function three times in a row 2022-08-21 09:59:55 +02:00
Benno Schulenberg
210c94d82f prompt: allow rebinding also ^N, ^Q, and ^Y at the yes-no prompt
Checking for the literal ^N, ^Q, and ^Y before checking for do_toggle
and full_refresh made it impossible to rebind any of those keystrokes
to these two functions.  (Not that anyone would want this, but...)

Problem existed since version 4.3, commits 341601e1 and 82aea04c.
2022-08-21 09:42:21 +02:00
Benno Schulenberg
c410ba4d42 tweaks: reshuffle two lines, for conciseness and in preparation 2022-08-21 09:28:07 +02:00
Benno Schulenberg
f3738fe164 tweaks: don't use a pointer when the value itself is all that is needed 2022-08-21 09:12:35 +02:00
Benno Schulenberg
04a08fe6a5 tweaks: rename a variable, away from an abbreviation 2022-08-21 09:02:32 +02:00
Benno Schulenberg
69d33ec170 tweaks: rewrap line, improve wording, and correct typo in old news item 2022-08-19 16:58:09 +02:00
Benno Schulenberg
40a4225ed8 tweaks: reshuffle some code, to not determine a shortcut twice
This addresses https://savannah.gnu.org/bugs/?62913.

Problem has existed since version 2.1.0, commit eb64314f.
2022-08-19 16:38:55 +02:00
Benno Schulenberg
801622ce19 tweaks: normalize the indentation after the previous change 2022-08-19 12:48:15 +02:00
Benno Schulenberg
67750a30ba tweaks: reshuffle some code and drop some comments, for conciseness 2022-08-19 12:47:49 +02:00
Benno Schulenberg
2f25b6a650 tweaks: elide a parameter by moving the general case one level up 2022-08-19 11:56:01 +02:00
Benno Schulenberg
5a3bd329d6 prompt: prevent execution of inadmissible functions in view mode
This fixes https://savannah.gnu.org/bugs/?62912.

Bug existed since commit 958ec294 from earlier today,
but was enabled by commit 433dd921 from three days ago.
2022-08-18 16:01:31 +02:00
Benno Schulenberg
8b4bf2bb8d docs: mention that string binds may contain function names between braces 2022-08-18 09:11:49 +02:00
Benno Schulenberg
2a515058be docs: replace control codes in the examples with {command} cartouches
This avoids https://savannah.gnu.org/bugs/?61720.

Problem existed since version 5.8, commit 74c6bdac.
2022-08-18 09:11:49 +02:00
Benno Schulenberg
3785f762fc syntax: nanorc: colorize valid function names plus surrounding braces 2022-08-18 09:11:49 +02:00
Benno Schulenberg
5cee9f183b build: exclude some pieces that are not needed with --disable-nanorc 2022-08-18 09:11:49 +02:00
Benno Schulenberg
958ec294b2 input: interpret commands of the form {functionname} inside string binds
This allows specifying bindable functions in a string bind by name
instead of by the literal control code or escape sequence to which
they are bound, which makes for a much more readable string bind,
and also allows specifying functions that are not bound to any key.

The opening brace, {, is made into a special symbol inside a string
bind, and each literal occurrence there needs to be escaped as {{}.

This fulfills https://savannah.gnu.org/bugs/?61692.
Requested-by: Tasos Papastylianou <tpapastylianou@hotmail.com>

Original-idea-by: Brand Huntsman <alpha@qzx.com>
  https://lists.gnu.org/archive/html/nano-devel/2018-02/msg00006.html
2022-08-18 09:07:05 +02:00
Benno Schulenberg
3a781fd719 help: move the M-Del item up, so that M-PgUp and M-PgDn are paired
(It needs a huge terminal and a tiny font for these to come into view,
but... it's possible.)
2022-08-17 15:11:03 +02:00
Benno Schulenberg
f4a2e7efe2 tweaks: move the --magic option up, so that --zero comes last
This makes that the three options that change the default layout
of the interface (--stateflags, --minibar, --zero) come last.

Also, sort the option letters into a consistent order in the code.
2022-08-17 14:31:44 +02:00
Benno Schulenberg
027365503f tweaks: add parentheses for consistency, and reshuffle for conciseness
(That 'also_the_last' now gets reset to FALSE whenever the cursor moves
to a different line is fine -- it is redundant when the mark is off, but
it does no harm.)
2022-08-17 09:34:08 +02:00
Benno Schulenberg
e31d59ebc8 tweaks: move two checks plus corresponding calls to a better place
It was silly to check again specifically for <Del> and <Bsp> after
any possible keystroke had been handled.  It was an anomaly.

This makes the tail of do_deletion() similar to the tail of inject().

(That sometimes the current line is redrawn twice is acceptable -- how
often does one type <Backspace> while having Shift-selected something?
Normally one wouldn't, because it would cancel the selection, so it's
fine to accept some inefficiency for this case.)
2022-08-17 09:01:55 +02:00
Benno Schulenberg
11178e14ab tweaks: rename a macro for clarity, and normalize some indentation
(Continuation lines should be indented by at least two extra tabs.)
2022-08-17 08:41:14 +02:00
Benno Schulenberg
0bcbd0015f tweaks: check the multiline regexes only for Delete and Backspace
The checking for all functions that are marked as not-okay-for-view-mode
was excessive and unneeded.  It had been inherited from commit d47d8cd4
from thirteen years ago, and was never verified for correctness.

This addresses the main part of https://savannah.gnu.org/bugs/?62903.
2022-08-16 16:23:44 +02:00
Benno Schulenberg
271bd5d3ba tweaks: allow the linter to be used in view mode, as it makes no changes
The linter has been marked as NOVIEW since it was introduced in 2.3.3.
But that was a mistake, as the tool does not change the buffer contents.

This addresses a minor part of https://savannah.gnu.org/bugs/?62903.
2022-08-16 16:06:18 +02:00
Benno Schulenberg
74d252a68f tweaks: drop a parameter that is no longer used
The previous commit made the 'viewok' parameter redundant.
2022-08-16 15:12:52 +02:00
Benno Schulenberg
4b928b466a tweaks: determine in another way whether a shortcut is okay in view mode
This addresses the other part of https://savannah.gnu.org/bugs/?62899.
2022-08-16 15:03:02 +02:00
Benno Schulenberg
10b4d0c8ad tweaks: use an auxiliary variable to avoid dereferences of 'shortcut'
This is especially meant to avoid dereferences of 'shortcut' after its
linked function has been executed, because in an upcoming commit this
execution may have freed the shortcut's structure.

(For symmetry, make the same change also in do_statusbar_input(), even
though it is not needed there.)

This addresses one part of https://savannah.gnu.org/bugs/?62899.
2022-08-16 15:03:02 +02:00
Benno Schulenberg
433dd92196 tweaks: drop an unneeded check for permissibility of prompt shortcuts
The only menus that are accessible in view mode are WhereIs, Insert,
WhereIsFile, GoToDirectory, and Help.  In the WhereIs menu, the only
keystroke that is not allowed in view mode (^R) is caught explicitly.
In the other four menus, all available shortcuts are permissible in
view mode, so... there is no need to check them at execution time.

(The ^R keystroke in the WhereIs menu is still shown in view mode
so as not to upset the pairing of the subsequent shortcuts.)
2022-08-15 14:49:03 +02:00
Benno Schulenberg
78d284881c help: don't show the New-Buffer toggle when in view mode
Since commit 63f2be7a from four years ago, view mode always sets
multibuffer mode, allowing ^R (Insert) to be invoked.  But the
user is then not allowed to switch multibuffer mode off, so...
don't show the toggle.
2022-08-15 11:53:54 +02:00
Benno Schulenberg
a36b726bde completion: search through all open buffers for possible completions
This allows one to complete also words that are present in other files
(when these are open in other buffers).

This fulfills https://savannah.gnu.org/bugs/?61691.
Requested-by: Tasos Papastylianou <tpapastylianou@hotmail.com>

Original-patch-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2022-08-12 10:20:27 +02:00
Benno Schulenberg
83629b9991 startup: ensure that +/string centers the match also with --linenumbers
When confirm_margin() first sets the margin needed for the requested
line numbers, also then it needs to keep 'focusing' TRUE.  Only when
actually toggling --linenumbers ON (from a zero margin to something)
should focusing be suppressed, in order to obtain smooth scrolling
when the cursor is pushed off-screen.

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

Bug existed since version 4.4, since the search-at-startup feature
was introduced.
2022-08-11 09:32:01 +02:00
Benno Schulenberg
405c66e864 tweaks: delete a flag that is no longer used
Suspension is always enabled since version 6.0.

(Also, swap two conditions, to match identical pairs elsewhere.)
2022-08-09 12:01:09 +02:00
Benno Schulenberg
e5df84a9ed help: prioritize the unshifted Meta keystrokes for buffer switching
In many keyboard layouts M-< and M-> are awkward to type (in a Spanish
layout, for example: Alt+Shift+AltGr+Z and Alt+Shift+AltGr+X when there
is no LSGT key), whereas M-, and M-. are simple two-key keystrokes in
most Latin-script layouts.  So, show M-,/M-. before showing M-</M->.

Also, make a condition more precise, to not show M-Left and M-Right in
the tiny version, when those shortcuts are not understood.
2022-08-05 16:29:21 +02:00
Benno Schulenberg
614a977259 po: update translations and regenerate POT file and PO files 2022-08-02 09:23:26 +02:00
Benno Schulenberg
f1651abdac bump version numbers and add a news item for the 6.4 release 2022-08-02 08:44:50 +02:00
Benno Schulenberg
05a06048fc tweaks: add a missing word to a news item 2022-08-01 09:21:55 +02:00
Benno Schulenberg
c599bc9bff tweaks: rename a variable, to not be the same as a function name 2022-08-01 09:17:35 +02:00
Benno Schulenberg
54ded4527a options: stop accepting -z, as --suspendable has been dropped too
This should have been part of commit 98f9518b from seven weeks ago.
2022-07-31 19:47:11 +02:00
Benno Schulenberg
4f433cd601 tweaks: add a translator hint 2022-07-27 11:24:08 +02:00
Benno Schulenberg
accecb9863 tweaks: reshuffle a few lines, to group things better 2022-07-26 12:28:49 +02:00
Benno Schulenberg
079588cac5 gnulib: update to its current upstream state 2022-07-26 12:28:49 +02:00
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