Benno Schulenberg
acd8809d71
tweaks: use hard-baked keycodes where possible
...
These keycodes have non-rebindable entries in the list of shortcuts, so
they will always be there -- no need for a function call to find them.
2016-09-02 12:04:29 +02:00
Benno Schulenberg
7b7d2bf7c9
tweaks: make tiny nano a teeny bit smaller
2016-09-02 12:01:03 +02:00
Benno Schulenberg
08b770d425
files: close a lockfile after reading it
2016-08-30 11:48:35 +02:00
Benno Schulenberg
2dffcf101f
tweaks: fix compilation with --disable-histories
2016-08-30 11:14:19 +02:00
Benno Schulenberg
96fbdfbc7d
input: unset a softmark whenever a character is typed
2016-08-30 10:41:28 +02:00
Benno Schulenberg
272a953889
tweaks: fix compilation when configured with --with-slang
2016-08-30 10:12:02 +02:00
Benno Schulenberg
db310ac9b6
input: ignore the resize "key", to prevent reporting an unbound key
...
In the tiny version it would beep and report an unbound key for every
window resize.
2016-08-30 09:40:51 +02:00
Benno Schulenberg
c11c688420
tweaks: fix compilation with --enable-tiny again
2016-08-30 09:36:49 +02:00
Benno Schulenberg
514cd9a099
update the license text to the preferred version
...
Mentioning "GNU nano" instead of "This program" and referring to the
website instead of to a postal address.
2016-08-29 21:27:16 +02:00
Benno Schulenberg
406e5242a3
update the copyright notices
2016-08-29 21:27:05 +02:00
Benno Schulenberg
5ad26f864a
tweaks: adjust indentation after previous change
2016-08-29 13:36:29 +02:00
Benno Schulenberg
e7f39bc248
tweaks: remove an unneeded check, reshuffle some things, add a comment
...
Resetting the cutbuffer is irrelevant when 'allow_funcs' is false or
when in view mode, so do_input() can just return in those cases.
2016-08-29 13:35:35 +02:00
Benno Schulenberg
0242d84218
tweaks: make a call in one place instead of in four different ones
...
And remove a superfluous call.
2016-08-28 21:27:52 +02:00
Benno Schulenberg
7275e11c4f
tweaks: adjust some comments and remove needless asserts
2016-08-28 18:17:10 +02:00
Benno Schulenberg
77d140728d
tweaks: don't bother trimming the prompt again
...
The prompt has already been trimmed in do_prompt() to fit into the
available space.
2016-08-28 17:53:44 +02:00
Benno Schulenberg
4d2ada60f5
tweaks: don't bother avoiding unneeded rewrites of the promptbar
...
Leave the optimization of actual screen writes to ncurses.
2016-08-28 17:37:25 +02:00
Benno Schulenberg
382c9d792d
new feature: allow text selection by holding Shift with the cursor keys
...
Add the keycodes and routines to allow the user to forego setting the
mark explicitly (with M-A / ^6) and instead quickly select a few words
or lines by holding down Shift together with the movement keys.
(Some combinations with Shift are swallowed by some terminal emulators.
To work around some of those, the combinations Shift+Alt+Left/Right work
as Shift+Home/End and Shift+Alt+Up/Down work as Shift+PageUp/PageDown.)
2016-08-28 11:29:28 +02:00
Benno Schulenberg
aeb49a8013
bottombar: only count help items that have a shortcut bound to them
...
This avoids showing a ghost item in, for example, the WriteOut menu
when not using --tempfile and the user does not bind 'discardbuffer'.
2016-08-27 12:22:59 +02:00
Benno Schulenberg
c05c914eee
tweaks: rename three variables
2016-08-27 12:10:18 +02:00
Benno Schulenberg
c19f0c732e
tweaks: simplify the determination of the number of shown help items
2016-08-27 12:06:08 +02:00
Benno Schulenberg
6ad3700a3d
prompt: mouse clicks that moved the cursor need no further processing
...
This fixes https://savannah.gnu.org/bugs/?48917 .
2016-08-27 12:00:08 +02:00
Benno Schulenberg
4f156aa6db
prompt: set up the prepared answer before allowing to change it
...
This fixes https://savannah.gnu.org/bugs/?48916 .
2016-08-27 11:59:57 +02:00
Benno Schulenberg
6142ef87b5
prompt: use angular brackets as continuation mark, as Pico does
...
The $ sign looks too much like an S, and it "obscures" the answer by
being so "massive". The < and > signs are lighter and work better.
2016-08-27 09:34:54 +02:00
Benno Schulenberg
da2fce90bd
tweaks: elide a variable and rename some others
2016-08-27 09:34:42 +02:00
Benno Schulenberg
1e3cffbbd6
prompt: show a trailing $ when the tail of the answer is offscreen
...
This fixes https://savannah.gnu.org/bugs/?48894 .
2016-08-26 21:42:23 +02:00
Benno Schulenberg
92c97c70d4
prompt: leave always at least the last character of the answer visible
...
This fixes https://savannah.gnu.org/bugs/?48912 .
2016-08-26 21:32:07 +02:00
Benno Schulenberg
b77b1391c3
tweaks: improve some indentation and reshuffle a few lines
2016-08-26 12:24:18 +02:00
Benno Schulenberg
7e0c4e5726
tweaks: rename a function and adjust indentation
2016-08-25 20:20:50 +02:00
Benno Schulenberg
50616148b0
prompt: recompose the statusbar text whenever the window size changes
...
This fixes https://savannah.gnu.org/bugs/?48796 .
2016-08-25 20:12:36 +02:00
Benno Schulenberg
2f9232a493
tweaks: adjust indentation after previous change
2016-08-25 11:45:38 +02:00
Benno Schulenberg
0d5fbfb91c
tweaks: reshuffle some things, and remove a misplaced comment
2016-08-25 11:45:34 +02:00
Benno Schulenberg
56147434f3
prompt: don't crash when the terminal is less than four columns wide
...
This fixes https://savannah.gnu.org/bugs/?48792 .
2016-08-25 11:45:13 +02:00
Benno Schulenberg
21cb01e543
tweaks: rename two variables, to make some sense
...
And move a statement to a better place.
2016-08-25 11:45:05 +02:00
Benno Schulenberg
ea9aaee8c7
statusbar: leave out the brackets when the message is very long
...
This also prevents the message from spilling into the help lines
when the terminal is less than four columns wide. (Not that one
can read anything then, but it looks better.)
2016-08-25 11:45:01 +02:00
Benno Schulenberg
c22cd03f18
prompt: work around a VTE bug by outdancing an ncurses optimization
...
This fixes https://savannah.gnu.org/bugs/?48852 .
2016-08-25 10:46:28 +02:00
Benno Schulenberg
bd1c5d7c63
moving: make PgUp and PgDown functional also in very flat terminals
...
Even when the edit window consists of just one or two lines, the PageUp
and PageDown functions (^Y and ^V) should continue to move the window.
This fixes https://savannah.gnu.org/bugs/?48805 .
2016-08-21 15:52:24 +02:00
Benno Schulenberg
00b293bf70
tweaks: adjust some braces and indentations
2016-08-21 15:39:00 +02:00
Benno Schulenberg
76a960d73d
screen: continue to function also in a terminal with very few lines
...
This fixes https://savannah.gnu.org/bugs/?48787 .
2016-08-17 10:13:22 +02:00
Benno Schulenberg
97eb0e515f
tweaks: reshuffle some stuff in a more logical order
2016-08-16 19:22:56 +02:00
Benno Schulenberg
68010d931a
startup: don't crash when dying early
...
That is: don't try to look at open files when none are open yet.
2016-08-16 16:59:37 +02:00
Benno Schulenberg
c661506681
tweaks: use a separate function to ask ncurses for keycodes
2016-08-16 12:01:59 +02:00
Benno Schulenberg
0dd2a55284
screen: don't die when the window is narrower than four columns
...
This fixes https://savannah.gnu.org/bugs/?48520 .
2016-08-15 17:25:33 +02:00
Benno Schulenberg
49fc528d88
restore the GNU marker in nano's name
2016-08-14 21:42:37 +02:00
Benno Schulenberg
928a24c204
input: look at the modifier keys only when compiled on Linux
...
This fixes https://savannah.gnu.org/bugs/?48751 reported by Andrew Ho.
This also fixes compilation when configured with --enable-tiny.
2016-08-14 21:42:08 +02:00
Benno Schulenberg
d8031af030
screen: retain the placewewant also when using an alternate speller
...
When using the default speller or the formatter, the placewewant is
remembered. So it should be remembered too when the user specifies
a different speller.
(This behavior was inadvertently lost last year, in commit 82d737e.)
2016-08-12 20:02:04 +02:00
Benno Schulenberg
290d278f68
input: make the Ctrl+Arrow keys work on a Linux console
...
If this breaks your build, please send report or instructions or patch.
2016-08-07 18:20:34 +02:00
Benno Schulenberg
8edb096821
input: after an Esc, don't discard starter byte of a multibyte sequence
...
This fixes https://savannah.gnu.org/bugs/?48711 .
2016-08-07 17:40:38 +02:00
Benno Schulenberg
0a387d9d08
usage: show that the option --wordchars needs an argument
2016-08-07 17:04:23 +02:00
Benno Schulenberg
6c16744292
files: avoid a warning about not being able to write a lockfile
...
Instead be more specific and say that the directory is not writable.
2016-08-07 13:00:35 +02:00
Benno Schulenberg
86a64b1bb5
tweaks: reduce two comparisons to a single one
2016-08-07 13:00:21 +02:00
Rishabh Dave
1fd2354ad4
shortcuts: zero the value of 'toggle' for keys that are not toggles
...
This fixes http://savannah.gnu.org/bugs/?48698 .
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-08-07 11:31:55 +02:00
Benno Schulenberg
c8bc05b10e
chars: make searching case-insensitively some ten percent faster
...
It is quicker to do a handful of superfluous compares at the end of
each line than it is to compute and keep track of and compare the
remaining line length the whole time.
The typical line is some sixty characters long, the typical search
string ten characters -- with a shorter search string the speedup is
even higher: some fifteen percent. Only when the string is longer
than half the average line length does searching become slower with
this new method.
All this for a UTF-8 locale. For a C locale it makes no difference.
2016-08-07 11:02:41 +02:00
Benno Schulenberg
ee57cbfa66
debug: add a timing instrument to the main search routine
2016-08-07 10:14:42 +02:00
Benno Schulenberg
bd1fcc5fe2
tweaks: correct one comment, and adjust another
2016-08-06 12:17:24 +02:00
Benno Schulenberg
370406bb41
tweaks: don't optimize for a special case -- it is far too seldom
2016-08-06 11:11:56 +02:00
Benno Schulenberg
85844ee6ef
chars: remove superfluous afterchecks
...
Now that mbstrncasecmp() does the right thing, there is no need any
more to verify that only a valid multibyte sequence was matched.
(See https://savannah.gnu.org/bugs/?45579 for a test case.)
Also, this will make it possible to search for invalid sequences.
(Currently it isn't possible to enter a search string with invalid
characters, but... a user might edit the search history file. And
if pasting at the prompt is implemented, it will be trivial to enter
invalid sequences if you have a file that contains them.)
2016-08-06 11:10:39 +02:00
Benno Schulenberg
e38e2c634b
chars: don't persist when only one of the compared sequences is invalid
...
Persisting might lead to count 'n' reaching zero, which would mean that
the needle has matched, which is wrong when one of the strings contains
an invalid or incomplete multibyte sequence.
2016-08-06 10:34:38 +02:00
Benno Schulenberg
d80109dd5e
chars: properly compare strings of different lengths
...
That is: don't run towlower() on the two differing bytes when having
reached the end of one of the strings.
This fixes https://savannah.gnu.org/bugs/?48700 .
In the bargain, don't do the conversion to lowercase twice.
Furthermore, persist when encountering invalid byte sequences --
until finding bytes that differ.
2016-08-05 16:07:55 +02:00
Benno Schulenberg
b305911cba
chars: straighten out the flow of a loop, so it is easier to follow
2016-08-04 13:40:55 +02:00
Benno Schulenberg
d60f95137e
chars: remove a special case that never occurs
...
The needle is never part of the hay -- it is always a separate string.
(And even if needle and haystack were identical, the routine works fine,
the case does not need special treatment.)
2016-08-04 13:40:19 +02:00
Benno Schulenberg
14ac47517b
spelling: don't abort when a misspelled word isn't found, just note it
...
This fixes https://savannah.gnu.org/bugs/?48660 doubly, in case there
are other ways in which 'spell' sees words differently from 'nano'.
2016-08-03 12:55:21 +02:00
Benno Schulenberg
20058a1b63
spelling: don't consider digits as word parts, because GNU spell doesn't
...
This fixes https://savannah.gnu.org/bugs/?48660 .
2016-08-03 12:43:57 +02:00
Benno Schulenberg
f6dd0ad18a
tweaks: compile a parameter unconditionally
...
Straightforward code is more important than the tiniest possible binary.
Also adjust some comments and rename a variable.
2016-08-02 17:30:58 +02:00
Benno Schulenberg
a7ae1766c0
locking: remove any lock files when dying
...
This fixes https://savannah.gnu.org/bugs/?48675 .
2016-08-02 17:30:40 +02:00
Benno Schulenberg
faa46a3c71
screen: remove redundant redrawings of the entire edit window
...
(It may have been necessary in the past; there is no need for it now.)
This fixes https://savannah.gnu.org/bugs/?48633 .
2016-08-01 19:41:13 +02:00
Benno Schulenberg
03b168d0e3
tweaks: restore earlier conditions to prevent superfluous redrawings
...
When doing an <Up> on the top line, or a <Down> on the bottom line of
the edit window, the affected lines have already been redrawn by the
scrolling code, so there is no need to do that again.
(However, that does not prevent the second line (or the last-but-one
line) from being redrawn unnecessarily when using the M-- (or M-+)
command elsewhere on the screen and /that/ line is horizontally
scrolled. But we'll let that pass for now.)
2016-08-01 19:41:13 +02:00
Benno Schulenberg
2f6647687a
tweaks: rename a function, and adjust some comments
2016-08-01 19:41:13 +02:00
Benno Schulenberg
c9e9964207
screen: don't look at placewewant but at where we actually were and are
...
For horizontal scrolling, it is not the /desired/ column position that
is relevant for determining whether a line needs to be redrawn after a
cursor movement, but the /actual/ column positions before and after.
This fixes https://savannah.gnu.org/bugs/?48627 ,
and fixes https://savannah.gnu.org/bugs/?48629 .
2016-08-01 19:41:13 +02:00
Benno Schulenberg
0a3a6441bc
tweaks: unconditionally compile a couple of parameters
...
Having two unneeded parameters in the tiny version is acceptable --
the code gets so much more readable.
2016-08-01 19:41:13 +02:00
Benno Schulenberg
2eafe7bf58
files: make allowances for 32-bit PIDs
...
This addresses https://bugs.debian.org/831636 reported by Christoph Biedl.
2016-08-01 16:24:05 +02:00
Benno Schulenberg
08c51cfd45
input: ingest as verbatim just one control code or one or two escapes
...
Leave the rest of any escape sequence to be processed normally, which
should be possible because those characters are all in ASCII range.
This fixes https://savannah.gnu.org/bugs/?48318 .
2016-08-01 14:47:02 +02:00
Benno Schulenberg
b472f5a633
tweaks: remove some unnecessary keycodes from a switch statement
...
These codes are the basic codes that get assigned for the movement keys
in the list of shortcuts -- they don't need any translation.
2016-08-01 14:07:21 +02:00
Benno Schulenberg
5806bf5249
tweaks: normalize some whitespace and adjust several comments
2016-08-01 14:05:42 +02:00
Benno Schulenberg
90a90365a8
tweaks: rename three constants, for clarity, and hardcode two others
2016-08-01 12:56:05 +02:00
Benno Schulenberg
9cd30d4917
tweaks: don't bother setting meta_key to false when a key is invalid
...
That is a task for the key-getting routine.
2016-07-31 18:32:18 +02:00
Benno Schulenberg
f33d8cae30
tweaks: don't use a function call when reference to the variable will do
2016-07-31 18:30:53 +02:00
Benno Schulenberg
e471e2d462
tweaks: move the modified editing keys again
2016-07-31 18:29:57 +02:00
Benno Schulenberg
fe38b78486
tweaks: adjust indentation after the previous changes
2016-07-31 18:22:07 +02:00
Benno Schulenberg
1af1f5c9f4
tweaks: return quicker from the key parsing routine
2016-07-31 18:19:17 +02:00
Benno Schulenberg
b9e83fe9f8
tweaks: move some debugging stuff, and move modified editing keys too
...
Again, just for preapring an easier return from the parsing routine.
2016-07-31 18:17:06 +02:00
Benno Schulenberg
cb10b2b908
tweaks: elide the global variable 'func_key'
...
There is no need to specially flag a function key or editing key --
the keycode is indication enough in itself: outside of byte range.
2016-07-31 18:13:05 +02:00
Benno Schulenberg
19dfd20a88
tweaks: add a variable, in preparation for making returning easier
2016-07-31 18:10:31 +02:00
Benno Schulenberg
d12fdda15b
tweaks: replace a three-case switch with an if and an else
2016-07-31 18:10:01 +02:00
Benno Schulenberg
3930a697e8
tweaks: consistently use a parameter instead of a struct element
2016-07-30 13:05:52 +02:00
Benno Schulenberg
9322e1e6a4
tweaks: reshuffle two ifs for a little more speed
...
Saving roughly twenty microseconds at startup.
2016-07-30 13:04:06 +02:00
Benno Schulenberg
b70fe38eab
tweaks: normalize some indentation
2016-07-30 12:24:35 +02:00
Benno Schulenberg
1c528db8da
tweaks: condense three asserts into a single one
...
Also, when a key string does not denote a Ctrl nor Meta nor Function key,
there is no point in assigning a keycode, because plain characters cannot
be used as a function shortcut.
2016-07-30 12:24:35 +02:00
Benno Schulenberg
1c9ab8bf16
tweaks: rename a struct element, to be more fitting
...
The keycode is not a sequence; it is a single integer value.
2016-07-30 12:24:35 +02:00
Benno Schulenberg
e295070193
shortcuts: group the setting of key string and keycode into one function
...
And instead of using two key types, just use a bool to indicate whether
a keystroke involves Meta.
2016-07-30 12:21:42 +02:00
Benno Schulenberg
91951ab22a
input: don't bother putting a keycode into byte range
...
A keycode is either already in byte range (so there is nothing to do)
or it is not and it shouldn't be (so there is nothing to do either).
2016-07-30 12:19:47 +02:00
Benno Schulenberg
5b0ab8be62
shortcuts: remove any unnecessary classifying of keys
...
After initialization, the type of a key is never used nor needed
(other than for meta keys).
2016-07-30 12:13:47 +02:00
Benno Schulenberg
ecef093def
tweaks: adjust indentation after previous changes
2016-07-29 09:33:28 +02:00
Benno Schulenberg
6d6f5bd4a7
tweaks: check earlier on for sufficient length of the sequence
2016-07-29 09:33:28 +02:00
Benno Schulenberg
e3dbffc9f7
input: be more strict in recognizing certain escape sequences
...
Accept the "Esc [ 1 n ~" and "Esc [ 2 n ~" sequences only when they
end with the "~" character, not with any character.
2016-07-29 09:33:28 +02:00
Benno Schulenberg
2225d54126
input: don't use a function call when a literal value will do
2016-07-29 09:33:28 +02:00
Benno Schulenberg
9115828e76
input: fix a pasto from eight years ago, from commit e347efb
2016-07-29 09:33:16 +02:00
Benno Schulenberg
992533b91e
moving: don't do an automatic smart home with Ctrl+Up and Ctrl+Down
...
It is nicer to have a predictable cursor position and not see it hop
left and right on differently indented lines.
2016-07-28 09:09:51 +02:00
Benno Schulenberg
f3e8991206
credits: don't bother blanking the second line nor the help lines
...
Those lines don't exist in that mode -- the relevant subwindows are
smaller, or have been made smaller just before.
2016-07-27 12:40:11 +02:00
Benno Schulenberg
df7353b312
tweaks: compute the sizes of the subwindows in a more direct manner
2016-07-27 12:27:04 +02:00
Benno Schulenberg
f311c0af87
tweaks: adjust a couple of comments
2016-07-27 09:23:49 +02:00
Benno Schulenberg
c88fae3310
search: match a beginning-of-line anchor just once per line
...
This fixes https://savannah.gnu.org/bugs/?48635 .
2016-07-27 09:04:06 +02:00
Benno Schulenberg
68cfb08888
tweaks: fix compilation with --enable-tiny
2016-07-25 17:29:24 +02:00
Benno Schulenberg
4cff67fdde
tweaks: adjust indentation after the previous change, and edit comments
2016-07-25 12:50:03 +02:00
Benno Schulenberg
aefe26d216
tweaks: factor out a common condition
2016-07-25 12:31:40 +02:00
Benno Schulenberg
8eb99e2a1d
tweaks: put similar things together
2016-07-25 12:18:40 +02:00
Benno Schulenberg
19b6f906cc
tweaks: rename another variable, for aptness
2016-07-25 10:57:33 +02:00
Benno Schulenberg
c38ffdc741
tweaks: rename two variables, to match others
2016-07-25 10:53:49 +02:00
Benno Schulenberg
a472f480a7
tweaks: trim some comments, and simplify a condition
2016-07-24 13:44:16 +02:00
Benno Schulenberg
4416d9c941
tweaks: shuffle the resetting of a counter to the tail of the routine
2016-07-24 13:15:45 +02:00
Benno Schulenberg
c073c5ae54
tweaks: don't bother resetting the Unicode code holder
...
It will be initialized when a new code is started.
2016-07-24 13:09:24 +02:00
David Lawrence Ramsey
fc0ddab349
input: provide feedback on the Unicode digits typed so far
...
This fulfills https://savannah.gnu.org/bugs/?48154 .
2016-07-24 12:19:42 +02:00
Benno Schulenberg
c6dbcf91c3
new feature: functions to jump to previous or following block of text
...
And hard-bind the keys Ctrl+Up and Ctrl+Down to these functions.
Unlike the paragraph-jumping code, these new functions disregard
any indentation, treating only blank lines as separators. They
also do an automatic smart home when that option is set.
This fulfills https://savannah.gnu.org/bugs/?48291 .
2016-07-24 12:00:00 +02:00
Benno Schulenberg
8c7a38596d
screen: include a workaround only when compiling against older ncurses
...
The bug with a leading wide character has been fixed since ncurses-5.9.
See https://savannah.gnu.org/bugs/?31743 for reference.
2016-07-24 10:38:31 +02:00
Benno Schulenberg
1c2d2a4027
tweaks: adjust a comment for removed definitions
2016-07-22 15:57:20 +02:00
Benno Schulenberg
1e5614b31b
tweaks: avoid two compiler warnings
2016-07-22 15:48:06 +02:00
Benno Schulenberg
04b9b9c78b
tweaks: avoid a runtime error when compiled with -fsanitize=undefined
...
This fixes https://savannah.gnu.org/bugs/?48540 .
2016-07-22 15:39:45 +02:00
Benno Schulenberg
41ad376b70
chars: plug a gushing memory leak
2016-07-22 15:30:09 +02:00
Rishabh Dave
4c566c7903
tweaks: reduce the number of wattron/wattrof calls
...
Also, compose the coloring attributes during initialization
instead of every time when painting something.
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-07-21 10:10:59 +02:00
Benno Schulenberg
73a07215cc
debug: remove duplicate information
2016-07-21 09:54:07 +02:00
Benno Schulenberg
bf091be778
chars: don't try to see a character in an empty line
...
This fixes https://savannah.gnu.org/bugs/?48578 .
2016-07-21 09:46:47 +02:00
Benno Schulenberg
103dd06347
input: don't crash when the window is resized during verbatim input
...
Instead of referring to a window that might have been deleted by a
resize, just turn the keypad back on for the two windows from which
input might have been requested.
Also: don't insert KEY_WINCH as the verbatim keystroke.
This fixes https://savannah.gnu.org/bugs/?48532 .
2016-07-17 12:18:12 +02:00
Benno Schulenberg
1d4c1e0bfc
input: plug a memory leak
...
This fixes https://savannah.gnu.org/bugs/?48538 .
2016-07-17 12:00:33 +02:00
Benno Schulenberg
b3fbb7c7ff
input: report keystroke M-[ as being unbindable instead of just unbound
2016-07-16 14:05:33 +02:00
Benno Schulenberg
225203d40d
tweaks: correct a comment
2016-07-16 13:29:50 +02:00
Benno Schulenberg
c2a0c78d9b
tweaks: rename a variable and a type, to be less confusing
2016-07-16 13:29:50 +02:00
Benno Schulenberg
ef071255e5
color: refresh the screen whenever the active syntax changes
...
This fixes https://savannah.gnu.org/bugs/?47296 .
2016-07-14 17:51:33 +02:00
Benno Schulenberg
afb6a5b86d
color: forget about aborting the precalculation for multiline regexes
...
This fixes https://savannah.gnu.org/bugs/?48389 .
2016-07-14 14:31:14 +02:00
Benno Schulenberg
a37cd9f0ef
tweaks: rename a variable, to clarify it refers to columns, not to bytes
2016-07-14 14:28:15 +02:00
Benno Schulenberg
6f12992cea
new feature: add the option --wordchars, to set extra word characters
...
This allows the user to specify which other characters, besides the
default alphanumeric ones, should be considered as part of a word, so
that word operations like Ctrl+Left and Ctrl+Right will pass them by.
Using this option overrides the option --wordbounds.
This fulfills https://savannah.gnu.org/bugs/?47283 .
2016-07-13 20:49:30 +02:00
Benno Schulenberg
d88423eaae
tweaks: move a debug statement to its proper place, and improve aspect
2016-07-13 20:48:03 +02:00
Benno Schulenberg
8b28de1313
tweaks: don't call a thing malloc... when it doesn't call malloc()
2016-07-13 15:04:40 +02:00
Rishabh Dave
8fa72fb7e7
browser: elide a variable by fusing the uses of 'newpath' and 'path'
...
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-07-13 14:30:18 +02:00
Benno Schulenberg
b4babc2036
input: accept only the four iTerm sequences that actually get handled
...
This fixes https://savannah.gnu.org/bugs/?48455 .
2016-07-13 13:01:46 +02:00
Benno Schulenberg
f2150d3f98
input: treat Ctrl+Alt+key different from Esc followed by Ctrl+key
...
When the user changes her mind after having pressed Esc, she cannot
unpress Esc, so do that for her by ignoring the escape code when
the subsequent keycode is outside of the normal printable range.
This restores the behavior from before nano-2.3.5 -- except that
Ctrl+Alt+key continues to report an unbound key.
This fixes https://savannah.gnu.org/bugs/?48459 .
2016-07-13 10:01:07 +02:00
Benno Schulenberg
033376aec0
input: consider only O, o and [ as starters of multi-character sequences
...
This prevents many keycode sequences from being misconstrued when a
command key plus other keystrokes accumulate in the input buffer.
This fixes https://savannah.gnu.org/bugs/?48395 .
2016-07-13 09:56:24 +02:00
Benno Schulenberg
e33a0b6dbe
screen: avoid converting each character twice from multibyte to wide
2016-07-12 19:41:13 +02:00
Benno Schulenberg
0894587305
screen: elide another intermediate buffer for every visible character
2016-07-12 19:30:50 +02:00
Benno Schulenberg
960e848cc7
tweaks: elide a typedef, as it now has just one element
2016-07-12 09:35:48 +02:00
Benno Schulenberg
b4737072a6
tweaks: delete an element that is always FALSE and never used
2016-07-12 09:24:32 +02:00
Benno Schulenberg
8507dd4bd0
color: integrate the hilite attribute into the pair number
...
Color-pair numbers and attributes can be OR'd together -- do so,
to save an attron() call whenever the hilite is on.
2016-07-12 09:20:09 +02:00
Benno Schulenberg
62eeda3e9f
tweaks: use mallocstrcpy() instead of strdup(), for a graceful death
...
To make nano save its modified buffers when it runs out of memory.
2016-07-11 20:45:26 +02:00
Benno Schulenberg
06c806215e
tweaks: improve two comments
2016-07-11 20:11:29 +02:00
Benno Schulenberg
d2b25120f0
tweaks: fuse two handlings of a delete key, and fix a comment
2016-07-10 21:36:25 +02:00
Benno Schulenberg
0c319f8b4b
tweaks: put the case labels (the keycodes) in a more sensible order
2016-07-10 20:49:52 +02:00
Benno Schulenberg
4fcc760158
tweaks: put some case labels closer to their statements
...
Also condense some comments, and group keys with the same result together.
2016-07-10 20:38:08 +02:00
Benno Schulenberg
0d5f918453
input: add some missing keycodes to the parsing routine
...
Add them so that <Esc> followed by <Home> will simply do "Home" instead of
reporting an unbound key. The same for <End>, <PageUp> and <PageDown>.
This restores the behavior from before nano-2.3.5.
2016-07-10 20:21:11 +02:00
Rishabh Dave
9c7940b599
utils: accept mistypings and common separators between line and column
...
It is easy to type beside the comma key and hit instead "m" or ".", so
accept also these as a separator between line and column number. And
when being generous anyway, also accept space, slash and semicolon.
This fulfills https://savannah.gnu.org/bugs/?48305 .
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-07-04 22:04:24 +02:00
Benno Schulenberg
ccfb1eb0f1
tweaks: rearrange a function in my style, and rename a variable
2016-07-04 21:50:12 +02:00
Benno Schulenberg
7e3a9c3aa6
utils: don't bother to check line and column for NULL
...
When parsing a line and a column number, of course the found values
need to be passed back, otherwise it would be pointless to parse them.
2016-07-04 21:42:04 +02:00
Benno Schulenberg
a730b25ef9
browser: elide another call of opendir()
...
And in the bargain show an error message when doing ^R unreadabledir ^T.
2016-07-04 21:18:09 +02:00
Benno Schulenberg
500fef8314
tweaks: rename a variable -- to match others and to be more concise
2016-07-04 13:43:19 +02:00
Benno Schulenberg
29986e95a0
input: don't drop the first byte when user starts typing during loading
...
Precalculation of the multiline color data can be cut short when the
user is impatient and starts typing. But this would drop the first
byte of whatever was typed -- not nice when it was just plain text,
but surprising and worse when the first keystroke was a command.
This fixes https://savannah.gnu.org/bugs/?48388 .
2016-07-04 09:27:35 +02:00
Benno Schulenberg
4af1da7d95
color: push the resets further when start and end match are equal
...
When for a multiline syntax-coloring rule the starting regex matches at
the exact same spot as the ending regex, do a second round of resets, so
that reevaluation starts further back and gets a few more things right.
This mildly fixes https://savannah.gnu.org/bugs/?47420 .
2016-07-03 16:23:54 +02:00
Benno Schulenberg
528b79b5f3
tweaks: rename a variable to be more accurate
...
When we get a ^J as verbatim input, it is not possible to include it
into the file buffer or the prompt answer, because this would mean
adding an encoded null to the buffer or answer, and that is not what
the user intended. One option would have been to simply ignore a ^J
in verbatim input. But the choice has been made to act the same way
as when the ^J (0x0A) is found in the file data: start a new line.
That is the same response as to the Enter key, yes -- but the code
for the Enter key is ^M (0x0D), not ^J. So, to be more precise,
rename the relevant variable from 'got_enter' to 'got_newline'.
2016-07-03 16:19:27 +02:00
Benno Schulenberg
03a81aa9c5
browser: trim all trailing slashes (just in case there are more)
2016-07-03 16:18:26 +02:00
Rishabh Dave
4957c1121d
browser: select an inaccessible directory also when tabbed
...
When the user tab-completed a name at the Go To Directory prompt, this
name will end in a slash. Remove this slash, so the name can be found
in the file list (where directory names don't include the final slash).
This fixes http://savannah.gnu.org/bugs/?48353 .
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-07-02 12:26:42 +02:00
Benno Schulenberg
d9d8eb2480
tweaks: straighten out the flow of a loop
2016-07-01 13:11:23 +02:00
Benno Schulenberg
d9aad9212f
tweaks: elide a bit of code duplication
2016-07-01 13:11:00 +02:00
Benno Schulenberg
8b636de1d3
tweaks: put all the movement functions together
...
And order them from smallest stride to biggest stride.
2016-07-01 12:42:58 +02:00
Benno Schulenberg
aeab800490
tweaks: improve a few comments
2016-07-01 12:34:33 +02:00
Benno Schulenberg
f8c33e8630
tweaks: reduce the scope of two variables
2016-07-01 12:22:44 +02:00
Benno Schulenberg
b6efea266e
chars: invalid sequences are not blank, nor text, nor punctuation
...
So, slightly speed up the functions that check for those.
2016-06-30 14:34:34 +02:00
Benno Schulenberg
8686cb3d3d
chars: measure invalid sequences and unassigned codepoints more quickly
...
Invalid multibyte sequences get depicted with the Replacement Character,
and unassigned codepoints are shown as if they were a space. Both have
a width of one.
2016-06-30 14:33:25 +02:00
Benno Schulenberg
91fff2a2c8
screen: avoid looking up the width of whitespace and control codes
...
Spaces and tabs and control codes never are multi-column glyphs, so
only look up the width for "normal", visible characters.
2016-06-30 14:32:10 +02:00
Benno Schulenberg
d6f43bd156
screen: elide the intermediate buffer for every single character
2016-06-30 14:29:14 +02:00
Benno Schulenberg
ebbe546033
screen: again, look at the bytes in their context
...
This avoids having to null-terminate every single-byte character.
2016-06-30 14:28:29 +02:00
Benno Schulenberg
cf0eed6c36
screen: don't check for every character whether there is still enough space
...
Just allocate ample space up front and thus discard the delaying 'if' for
each and every character. In most cases this will allocate far too much,
but that hardly matters: it is freed again as soon as the line is printed.
2016-06-30 14:27:00 +02:00
Benno Schulenberg
feacacc46d
chars: look at bytes in their context, so only valid sequences are accepted
...
This fixes https://savannah.gnu.org/bugs/?48125 .
(The fix is slightly wasteful; speeding things up will follow later.)
2016-06-29 20:56:50 +02:00
Benno Schulenberg
af53c56ec8
chars: speed up the determination whether something is a control character
...
Use knowledge of UTF-8 instead of converting to wide characters first.
2016-06-29 20:56:50 +02:00
Benno Schulenberg
019d7b34ca
chars: delete a now-unused function
2016-06-29 20:56:50 +02:00
Benno Schulenberg
622995fb12
chars: the representation of a control character is always two bytes
...
Any control character is represented by a ^ plus an ASCII character.
2016-06-29 20:56:50 +02:00
Benno Schulenberg
03586c60da
chars: represent the high-bit controls more intelligibly
...
Instead of showing the upper control codes like this:
^À ^Á ^Â ^Ã ^Ä ^Å ^Æ ^Ç ^È ^É ^Ê ^Ë ^Ì ^Í ^Î ^Ï
^Ð ^Ñ ^Ò ^Ó ^Ô ^Õ ^Ö ^× ^Ø ^Ù ^Ú ^Û ^Ü ^Ý ^Þ ^ß
show them like this:
^` ^a ^b ^c ^d ^e ^f ^g ^h ^i ^j ^k ^l ^m ^n ^o
^p ^q ^r ^s ^t ^u ^v ^w ^x ^y ^z ^{ ^| ^} ^~ ^=
The lower control codes continue to be shown like this:
^@ ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M ^N ^O
^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z ^[ ^\ ^] ^^ ^_
The representation of DEL (0x7F) continues as ^?.
Further, use knowledge of UTF-8 to avoid a roundtrip through
wide characters.
2016-06-29 20:56:50 +02:00
Benno Schulenberg
07a39e8e18
screen: don't simulate a sigwinch but directly reinitialize the screen
...
This fixes the second part of https://savannah.gnu.org/bugs/?48331 .
Reported-by: Mike Frysinger <vapier@gentoo.org>
2016-06-29 15:55:38 +02:00
Benno Schulenberg
1d7c177606
input: don't drop a keystroke on the floor when the terminal resizes
...
This fixes the first part of https://savannah.gnu.org/bugs/?48331 .
Reported-by: Mike Frysinger <vapier@gentoo.org>
2016-06-29 15:53:08 +02:00
Benno Schulenberg
2ae490cd8f
build: refresh the git description whenever something is recompiled
...
This fixes https://savannah.gnu.org/bugs/?47962 reported by Cody Taylor.
2016-06-27 19:45:21 +02:00
Benno Schulenberg
6fda7a7057
chars: speed up two reverse-searching routines a bit
...
By removing from their main loops a condition that occurs just once.
2016-06-27 19:22:28 +02:00
Benno Schulenberg
1e2833e07b
tweaks: elide two unneeded variables
2016-06-27 19:22:20 +02:00
Benno Schulenberg
067b0a3367
input: elide an extra buffer for inserting stuff into the text
...
Do the casting from integer to character rightaway in the first
intermediate buffer.
2016-06-27 19:18:40 +02:00
Benno Schulenberg
24b10179a1
files: beep whenever writing out a file fails
...
Just like when reading a file fails. It needs the user's attention.
2016-06-27 19:17:53 +02:00
Rishabh Dave
559858a3dd
browser: don't seem to enter a directory when it is inaccessible
...
This fixes https://savannah.gnu.org/bugs/?48286 .
Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-06-26 10:14:12 +02:00
Benno Schulenberg
ddd9c7a022
tweaks: try to distinguish between keystrokes and characters
...
Keystrokes are single integers (aided by the flags meta_key and
func_key) but in the input stream they can be encoded as escape
sequences (a series of bytes). Characters are values in byte
range, but in UTF-8 one character can consist of multiple bytes.
Also rename two variables, because the secondary input buffer
that they refer to contains only characters (mostly just one),
never any shortcuts; and there are too many "kbinput" already.
2016-06-25 20:34:09 +02:00
Benno Schulenberg
03c689c22c
tweaks: normalize a type, and rewrap a line
2016-06-25 20:33:11 +02:00
Benno Schulenberg
f33796bee1
tweaks: elide an impossible case
...
Typing a Unicode code is always finished after at most six characters:
either retval == uni or retval == kbinput, but it can't be ERR.
2016-06-25 16:52:36 +02:00
Benno Schulenberg
e679c518b1
tweaks: elide an unneeded variable
2016-06-25 16:52:36 +02:00
Benno Schulenberg
68acc1dfc5
tabs: compute the number of required spaces without iterating
2016-06-24 14:56:41 +02:00
Benno Schulenberg
1a4ec6c2d3
moving: allow specifying negative numbers in "Go To Line"
...
The negatives are taken to mean: from the end of the file,
and: from the end of the line.
This fulfills https://savannah.gnu.org/bugs/?48248 .
2016-06-24 14:47:02 +02:00
Benno Schulenberg
6bb30978fb
tweaks: add a translator hint
2016-06-24 09:40:31 +02:00
Benno Schulenberg
c0c30731c4
browser: don't use a term that is not explained in the documentation
...
Also, other messages that are about --operatingdir don't use the term
"confined" either.
Suggested-by: Mario Blättermann <mario.blaettermann@gmail.com>
2016-06-24 09:24:00 +02:00
Jordi Mallach
c2b199e926
docs: use https for nano-editor.org, and drop the www
...
Switch to https and drop the www. prefix for all occurrences of the
website URL.
2016-06-23 19:51:01 +02:00
Benno Schulenberg
80552aeab7
tweaks: elide an intermediate copy of some line data
2016-06-22 10:30:52 +02:00
Benno Schulenberg
59b9b222c8
moving: ignore any number when ^Y or ^V is given
...
This fixes https://savannah.gnu.org/bugs/?48282 .
2016-06-21 16:47:11 +02:00
Benno Schulenberg
79e3eaf73c
linter: refresh the edit window in order to actually place the cursor
...
This fixes https://savannah.gnu.org/bugs/?48283 .
2016-06-21 16:25:07 +02:00
Benno Schulenberg
9106cc8ecc
main: let the main loop restore the main menu, if needed
...
Don't make it the responsibility of the executed functions to restore
the list of shortcuts of the edit window. Just detect whether another
menu was displayed, and if so, redisplay the main menu.
2016-06-21 11:03:38 +02:00
Benno Schulenberg
17fb6dfdc0
tweaks: reshuffle two lines and improve two comments
2016-06-20 13:07:25 +02:00
Benno Schulenberg
95f417fa9a
tweaks: rewrap a bunch of lines and some comments
2016-06-20 13:05:45 +02:00
Benno Schulenberg
f26e88bb52
tweaks: a few last tiny adjustments before release
2016-06-17 15:04:44 +02:00
Benno Schulenberg
158388c5a6
justify: enable cursor display also for the first keystroke afterward
...
This fixes https://savannah.gnu.org/bugs/?48246 .
2016-06-16 20:40:09 +02:00
Benno Schulenberg
3e45c9c5cf
version: cover the copyrights that are not assigned to the FSF
2016-06-15 21:28:11 +02:00
Benno Schulenberg
7165bd5c33
input: don't allocate too much, and don't move too many
...
To add a character, one does not need to allocate twice its size.
And the amount to be moved does not depend on the size of the new
character; it just needs to include the terminating zero.
(This fixes in do_output() the same logical mistakes that were fixed
in do_statusbar_output() last February, in acf19bd
and 7c0e433.)
2016-06-14 17:00:22 +02:00
Benno Schulenberg
883373cd76
undo: start renumbering from the head of the paste, not from its tail
...
Because when undoing a paste at the end of the buffer, the tail line
probably does not exist any more.
This fixes https://savannah.gnu.org/bugs/?48222 .
(It would have been the proper fix for
https://savannah.gnu.org/bugs/?44488 .)
2016-06-14 16:34:29 +02:00