Commit Graph

9081 Commits (60d31d2ea6e800e3d29d8b10c0040da56e3ded72)

Author SHA1 Message Date
Benno Schulenberg 78f54523d9 tweaks: elide a variable and be more direct, and rename another 2020-06-18 19:02:02 +02:00
Benno Schulenberg 9faa95450b tweaks: rename two functions, and rename and reshuffle a parameter
Also, drop an unneeded nulling: the function copy_of() already
NUL-terminates the copied string.
2020-06-18 17:24:18 +02:00
Benno Schulenberg 26d7a7494e tweaks: improve several comments, and rewrap two lines 2020-06-18 17:10:05 +02:00
Benno Schulenberg d8249917c3 bindings: allow toggling the help lines at several prompts and in browser
Now the help lines can be toggled not only while editing, but also at
the Read (^R), Write (^O), Execute (^T), Search (^W), Replace (M-R),
Goto (^/), and Yesno prompts, and also in the file browser and when
searching for a file name.  The help lines cannot be toggled in the
help viewer, nor when searching in a help text, nor in the linter,
as these three things force the help lines to be on.

Furthermore, the 'nohelp' function can be rebound in all relevant
menus (default binding: M-X).

This fulfills https://savannah.gnu.org/bugs/?58471.
2020-06-18 15:36:10 +02:00
Benno Schulenberg 054cafa138 docs: mention the nine new color names, and "bold" plus "italic" 2020-06-18 15:31:06 +02:00
Benno Schulenberg bafcc19b7a tweaks: rename a symbol, from a phrase to a noun 2020-06-18 15:31:06 +02:00
Benno Schulenberg 61c94c2f81 rcfile: report the first bad color element, not a later one that is okay
This fixes https://savannah.gnu.org/bugs/?58605.

Bug existed since commit c275c515 from several days ago.
2020-06-18 15:31:06 +02:00
Benno Schulenberg 69a90dd7af tweaks: elide two redundant calls of strchr() 2020-06-18 15:31:06 +02:00
Benno Schulenberg fae2eeadce rcfile: introduce the modifier 'italic', for slanted text
The modifier has to come before the foreground color name, separated
by a comma, and after 'bold,' (when present).  This has no effect on
terminals that are incapable of cursive text, like the Linux console.

This fulfills https://savannah.gnu.org/bugs/?56525.
2020-06-18 15:31:06 +02:00
Benno Schulenberg 3ff524821c tweaks: move a copyright notice to a better place, and improve it
The username_tab_completion() function taken from busybox-0.46 was
just a stub, it contained basically nothing.  Chris himself wrote
the function in November 2000 (commit be77c611), and rewrote it in
January 2001 (commit 2c2c5f21).

The version of username_tab_completion() in that latter commit looks
somewhat like the version of Vladimir N. Oleynik <dzo@simtreas.ru>
(busybox commit 4e338757).  That commit comes three days after Chris'
commit, but Vladimir's original email is from a week earlier:
http://lists.busybox.net/pipermail/busybox/2001-January/035687.html.
So... it is quite possible that Rocco saw that email and suggested
to Chris to rewrite username_tab_completion() using getpwent().

Anyway, the version that was taken from busybox-0.46 was just four
lines and thus not worthy of copyright.  The two other functions
that were copied were heavily modified in 2000, so it's better to
add that year in the copyright notice.  It is fine to tweak the
notice: it just says that the original authors must be attributed,
not that the exact text must remain unchanged.
2020-06-18 12:50:24 +02:00
Benno Schulenberg 290b250141 tweaks: elide an unneeded variable, as there is nothing beyond '*place' 2020-06-18 12:12:43 +02:00
Benno Schulenberg b61d97eb9a tweaks: elide a variable, and shortcircuit a return
Instead of first trying to match things, and then discarding these
matches when the cursor is not at the end of the offered fragment
('buf'), simply don't bother to do any matching in that case.
2020-06-18 12:12:33 +02:00
Benno Schulenberg 0bced0a5e9 tweaks: condense and improve some comments 2020-06-18 11:44:25 +02:00
Benno Schulenberg 23c62c5032 tweaks: drop two unneeded assignments
The variable is set to zero at its declaration, and the second function
is called only when the first is either not called or found nothing --
thus '*num_matches' will still be zero.
2020-06-18 11:20:25 +02:00
Benno Schulenberg 2770ec81e2 build: make a deeper clone of gnulib (when building from git)
This increases the chances that the wanted hash will be present in
the checkout when we haven't changed the hash for a few months.

Reported-by: Félix Piédallu <felix@piedallu.me>
2020-06-17 12:25:23 +02:00
Benno Schulenberg c35c5af5d8 syntax: nanorc: colorize the new named colors too, from "mint" to "mauve" 2020-06-17 11:29:05 +02:00
Benno Schulenberg f6e7b7fbc5 rcfile: introduce nine new named colors, from "pink" to "latte"
Names give a rough idea of what the color will look like, whereas
numerical indexes would not do this at all.

Nine extra colors seems enough.  If there were more, no one would be
able to say for sure which is which when two similar colors are used
several rows apart.

This partially fulfills https://savannah.gnu.org/bugs/?56445.
2020-06-17 11:18:22 +02:00
Benno Schulenberg 96a5aa9e90 syntax: nanorc: colorize 'bright' anyway, so existing syntaxes look okay
After a year or so, when people have had time to convert their syntaxes
to use 'bold' and/or 'light' instead of 'bright', we can drop this
colorizing, and still later stop recognizing 'bright' altogether.
2020-06-16 17:33:49 +02:00
Benno Schulenberg e998c35c53 syntax: sql: rename the file to match the name of the syntax 2020-06-16 14:44:57 +02:00
Benno Schulenberg 4d7e7e28fd tweaks: drop obsolete 'nano.spec' from .gitignore file, and reshuffle 2020-06-15 19:11:45 +02:00
Marco Diego Aurélio Mesquita 648eac936e files: make the M-F (New Buffer) toggle non-persistent
Having the M-F toggle non-persistent, makes the behavior of ^R
predictable.  This allows string binds that load a file to work
correctly independently of when M-F was last pressed.

The -F/--multibuffer command-line option and "set multibuffer"
in a nanorc file determine the default behavior of ^R.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2020-06-15 16:05:31 +02:00
Benno Schulenberg 26fb83c61f docs: use 'bold' and 'light' instead of 'bright' in the sample nanorc 2020-06-15 15:30:52 +02:00
Benno Schulenberg 2fd9974e0e syntax: nanorc: stop colorizing 'bright', even though it's still accepted
The name 'bright' does not fit its effect (often bolding the typeface),
so better discourage its use.

Furthermore, colorize 'bold' and 'light' also for interface colors.
2020-06-15 15:15:06 +02:00
Benno Schulenberg 7ff82aa5e2 rcfile: add bindable function 'execute', for access to "Execute Command"
(This should have been added three weeks ago when ^T was rebound.)
2020-06-15 14:27:49 +02:00
Benno Schulenberg fd28e5f36c build: fix compilation when configured with --enable-tiny 2020-06-15 12:38:16 +02:00
Benno Schulenberg 7f40eeab0a tweaks: call the spotlighting routines only for the relevant line
Otherwise the affected piece of text gets drawn and spotlighted as
many times as there are rows in the edit window.
2020-06-15 09:45:01 +02:00
Benno Schulenberg d67faa2bb5 tweaks: remove a superfluous global variable
There were no calls of statusbar() or statusline() before curses mode
was entered.  But since the previous commit curses mode is entered
even earlier, so...
2020-06-14 13:09:23 +02:00
Benno Schulenberg 24cdf78a93 startup: enter curses mode before reading the nanorc files
This way the COLORS variable will be set when the nanorc files specify
interface colors, so that "light" will work for them.
2020-06-14 12:57:46 +02:00
Benno Schulenberg d01dbbb284 rcfile: do not complain when "bright" is used with a background color
A background color *can* be bright (in the sense of lighter, shinier).
It's just that the background cannot be bold.  Only the typeface used
on the foreground can be bold (if the terminal supports it).  So, let
"bright", when used with a background color, simply mean "light".
2020-06-14 12:05:18 +02:00
Benno Schulenberg c275c5158e rcfile: introduce the modifier "bold", for specifying bolding separately
This makes it possible to avoid the misnamed prefix "bright".  It is
misnamed because (on current terminal emulators, when the brightening
of bold is switched off) it just makes the typeface bold, not the color
brighter.  The prefix "light" will now only make the color brigther,
and the modifier "bold" will just make the typeface bold (on terminal
emulators, when the brightening of bold is switched off).

On a Linux console, which is not capable of bolding the typeface,
"bold" will brighten the color.

This fully fulfills https://savannah.gnu.org/bugs/?58503.
2020-06-14 11:54:18 +02:00
Benno Schulenberg adf7f33ea8 rcfile: allow specifying a bright background color (with prefix "light")
If the terminal is capable of more than eight colors, specifying
indexes 8 to 15 works fine for getting a light background color.
2020-06-14 11:51:00 +02:00
Benno Schulenberg 4d10f583e4 rcfile: accept prefix "light" to make a color brighter without bolding it
The prefix "bright" will continue to make the color brighter AND/OR
make the typeface bold (depending on how the terminal is configured
and on its capabilities), but the prefix "light" will just make the
color brighter (if the terminal can do that).

The prefix "bright" continues to do the same as what it did before,
to not change the appearance of user-defined syntaxes.  And having
an option to change the meaning of "bright"... would be confusing.

This partially fulfills https://savannah.gnu.org/bugs/?58503.
2020-06-14 11:45:45 +02:00
Benno Schulenberg 926bc6751e startup: check stdout instead of stdin when probing for a Linux console
This way we don't have to probe twice, and the result is accurate also
when nano is reading data from standard input.  Standard output should
always be connected to a terminal, as nano is not meant to operate
without a screen.
2020-06-14 10:52:42 +02:00
Benno Schulenberg 1c8c02f63b tweaks: move a function, to be in the order in which they are called
In addition, rename two variables and adjust the type of one of them.
2020-06-13 17:16:33 +02:00
Benno Schulenberg 43a1756783 tweaks: call init_pair() just once for each pair number 2020-06-13 14:17:45 +02:00
Benno Schulenberg 34528db096 tweaks: remove unneeded variables after the previous change 2020-06-13 14:17:45 +02:00
Benno Schulenberg c79b52da1d tweaks: do the conversion of -1 to a specific color just once
Do the conversion (when needed) when the syntax is loaded,
not for each buffer switch.
2020-06-13 14:17:45 +02:00
Benno Schulenberg 454dc6e1ec tweaks: elide two ifs for the most likely case, when defaults are allowed 2020-06-13 14:17:45 +02:00
Benno Schulenberg 23460bc6a8 tweaks: rename a variable, for more contrast with the function name 2020-06-13 14:17:45 +02:00
Benno Schulenberg ba2807c6f7 tweaks: call use_default_colors() just once for each run 2020-06-13 14:17:45 +02:00
Benno Schulenberg 3899a09dea tweaks: rename a variable, improve a comment, and reshuffle a few things 2020-06-11 19:23:37 +02:00
Benno Schulenberg b535714671 tweaks: reshuffle a statement, to have major initialization in nano.c 2020-06-11 16:48:52 +02:00
Benno Schulenberg 8535b3db4c tweaks: rename a variable, to not refer to a row as a "line" 2020-06-11 16:45:47 +02:00
Benno Schulenberg 77bce9f1c4 tweaks: remove a redundant cursor movement, remove a redundant condition
Each listing of a name is preceeded by a call to wmove(), so there
is no need for an initial wmove().  And after writing "more" on the
bottom row of the edit window, the loop is terminated, so there is
no need to check that this is the first item on the bottom row.
2020-06-11 16:29:38 +02:00
Benno Schulenberg a2b85e0c12 indicator: recompute the extra rows also when justifying and resizing
And when the margin changes (when line numbers are switched on or off,
or when the buffer grows or shrinks), and when a piece of text from a
different buffer with a different margin is pasted.

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

Bug existed since commit 9a9f36fc from yesterday.
2020-06-07 12:16:15 +02:00
Benno Schulenberg 786d2221e1 indicator: recompute the extra rows also for cut/paste/split/join
This fixes https://savannah.gnu.org/bugs/?58511.

Bug existed since commit 9a9f36fc from yesterday.
2020-06-07 11:05:14 +02:00
Benno Schulenberg 9a9f36fca7 indicator: rework how the "scrollbar" is computed when softwrapping
Instead of storing for each line the ordinal number of the first chunk
in that line, simply store the number of extra chunks in the line.

It now takes some more computation to actually draw the scrollbar, but
it saves a lot of computation when just inserting or deleting characters
(when using --softwrap and causing a change in chunk count).

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

Bug existed since commit 6bccedb3 from two days ago.
2020-06-06 19:21:23 +02:00
Benno Schulenberg 00d4a06cc7 tweaks: group the exiting routines together, and condense the comments 2020-06-05 19:10:36 +02:00
Benno Schulenberg 2aec478ea6 tweaks: elide an unneeded parameter, and rename the other 2020-06-05 17:23:52 +02:00
Benno Schulenberg ae7f5ebdeb tweaks: move a function to before the one that calls it 2020-06-05 17:14:38 +02:00