Commit Graph

980 Commits (c118397a14763c538403ca8bd77649eab6ee7f9e)

Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 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 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 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 68cfb08888 tweaks: fix compilation with --enable-tiny 2016-07-25 17:29:24 +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
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 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 a37cd9f0ef tweaks: rename a variable, to clarify it refers to columns, not to bytes 2016-07-14 14:28:15 +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 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 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
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 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 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 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
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 95f417fa9a tweaks: rewrap a bunch of lines and some comments 2016-06-20 13:05:45 +02:00
Benno Schulenberg 21d9bd1107 tweaks: rename some variables to be more readable 2016-06-01 13:04:32 +02:00
Benno Schulenberg 5864d97590 tweaks: harmonize the routine for tabs with the one for spaces 2016-06-01 13:04:22 +02:00
Benno Schulenberg 3ac37642c8 screen: check for the most frequent character first: a space 2016-06-01 13:04:08 +02:00
Benno Schulenberg a9f79a6130 tweaks: reindent and rewrap a few lines, and shorten a comment 2016-06-01 13:03:26 +02:00
Benno Schulenberg 17cf833b9c tweaks: normalize some whitespace 2016-05-30 09:09:36 +02:00
Benno Schulenberg e0e788e218 tweaks: reshuffle a few things 2016-05-23 21:34:02 +02:00
Benno Schulenberg c8f530af93 statusbar: add a non-beeping message type that does not get overwritten
Error messages about lock files should not get overwritten by purely
informational messages, only by alerting ones.

This fixes https://savannah.gnu.org/bugs/?47963.
2016-05-21 13:58:09 +02:00
Benno Schulenberg a878f5f183 screen: catch a window resize also when the keyboard is in nodelay mode
This fixes https://savannah.gnu.org/bugs/?47954.
2016-05-18 11:14:17 +02:00
Benno Schulenberg 5cbaf5903b tweaks: rearrange some key reading stuff in a clearer way 2016-05-18 10:36:37 +02:00
Benno Schulenberg cdcd365d34 tweaks: normalize some whitespace 2016-05-17 11:33:21 +02:00
Benno Schulenberg 2535f51e01 statusbar: prevent error messages from overwriting each other
If during startup there are multiple error messages, currently only the
last one remains and can be read.  To improve on that, introduce a short
pause between error messages -- even if it's not enough to read them all,
at least the user will be aware that there are multiple ones.

This also causes a few error messages to beep that currently don't beep,
such as when a file is unwritable.
2016-05-16 18:03:07 +02:00
Benno Schulenberg 2503503a2a tweaks: make the conditions for statusbar blanking more transparent 2016-05-15 11:36:51 +02:00
Benno Schulenberg 2cd21da4f0 tweaks: remove the fiddling with an unrelated setting
CONST_UPDATE is only relevant when in the main menu, not when in the
browser.  So, check for that condition, instead of saving, changing,
and then restoring the setting.
2016-05-15 11:22:44 +02:00
Benno Schulenberg 681f042326 tweaks: remove a superfluous condition
CONST_UPDATE does not need to influence the delay for blanking the
statusbar; it is enough when it simply prevents it.
2016-05-15 11:17:27 +02:00
Benno Schulenberg 73aa48b772 input: after an unknown sequence, reenable cursor only when in main menu
When in the browser, typing keys that produce an unknown escape sequence
should not switch on the cursor.
2016-05-14 22:14:37 +02:00
Benno Schulenberg 6698659149 screen: displaying the cursor position should not suppress it next time
Take the side effect of a 'statusbar' call -- setting suppress_cursorpos
to TRUE -- into account.  This effect was overlooked by commit 9d6d5b6.
2016-05-14 21:49:19 +02:00
Benno Schulenberg c918c6563b input: properly restore waiting mode, or retain non-waiting mode
Cancelling a search should restore waiting mode for the keyboard,
just like at the other exit points of the search routine.

And when the input routine has read in multiple keystrokes, it
should not blindly switch back to waiting mode, but only when
that mode was on before.

This fixes the second half of https://savannah.gnu.org/bugs/?47438.
2016-05-06 09:30:55 +02:00
Benno Schulenberg 577f7fafa9 screen: make better use of the available space in the titlebar
When the terminal is very narrow, there is little point in showing only
part of the version string -- and chewing off one or two digits from the
version number might even give someone a wrong idea.  The user is better
served with always showing the full filename, as long as it fits in the
available screen width.

This fixes https://savannah.gnu.org/bugs/?47703.
2016-05-05 20:09:10 +02:00
Benno Schulenberg a7c158d07d input: simplify a bit of code, reducing a four-case switch to a single if 2016-05-05 13:21:19 +02:00
Benno Schulenberg 9d6d5b679a screen: rename a variable, because 'disable' sounds too permanent 2016-05-04 12:18:21 +02:00
Benno Schulenberg 402cf718c4 input: trim some oververbose comments 2016-05-04 09:56:28 +02:00
Benno Schulenberg 7b3649abc9 input: don't take multiple keystrokes to be a single sequence
For some reason the keyboard code seems to assume that all integers
waiting in the keybuffer form a single sequence.  But this isn't the
case: when there is an escape (0x1b) among them, then that is where
a new sequence starts.  So, prevent the input code from considering
an escape after a non-escape as part of the current sequence.

This fixes https://savannah.gnu.org/bugs/?47839.
2016-05-04 09:56:15 +02:00
Benno Schulenberg e666f8c50d input: write a few ifs more compactly 2016-05-02 21:58:43 +02:00
Benno Schulenberg eb871e72f5 input: distinguish an unknown escape sequence from an unbound key
It is misleading to say "Unknown Command" when there is no way to rebind
the relevant key stroke do anything useful.
2016-05-01 22:04:17 +02:00
Benno Schulenberg b26aaa7e42 screen: fix compilation when configured with --enable-tiny 2016-04-27 17:45:36 +02:00
Benno Schulenberg 53f4a9f5a8 screen: rename 'edit_refresh_needed' to 'refresh_needed'
For a little contrast with the function edit_refresh() -- it's
annoying that when you search for the latter you get to see all
the settings of the flag too.
2016-04-25 21:14:18 +02:00
Benno Schulenberg b97c36c218 screen: don't always set 'edit_refresh_needed' when adjusting edittop
The function edit_update() is called by edit_refresh() itself, so it is
silly that the first sets 'edit_refresh_needed' to TRUE.  This setting
is needed only in a few cases -- in the others it's not needed because
the screen does not need to be refreshed (it was just about positioning
the cursor), or 'edit_refresh_needed' has already been set by a call to
goto_line_posx().  So, just set the flag in the five places that need it
and spare the other four calls.
2016-04-25 20:17:40 +02:00
Benno Schulenberg a101b30fa8 keyboard: reshuffle some lines to avoid an empty while 2016-04-16 11:57:05 +02:00
Benno Schulenberg 0bffd99dcb scrolling: elide a variable, to make clearer that edittop is being moved 2016-04-16 11:38:39 +02:00
Benno Schulenberg 6414f9f000 titlebar: snip two superfluous tests for having enough space
If nano has less than four columns available, it will die,
so there will always be room for at least four characters.
2016-04-13 17:54:06 +02:00
Benno Schulenberg 2246029447 screen: elide a variable and serialize some logic for clarity
Also, don't force a full refresh of the edit window simply because the
current line needs to be horizontally scrolled.  And further, when the
adjustment of edittop has determined that a full refresh is needed,
get out and don't bother scrolling some lines first.
2016-04-13 13:19:24 +02:00
Benno Schulenberg ec295f5e68 build-sys: detect a build from git and show its short commit hash 2016-04-12 10:28:45 +02:00
Benno Schulenberg 4b5b66a806 screen: avoid redrawing a line twice
The old_current line needs to be redrawn only if it differs from current,
and if it wasn't drawn already by the iteration for when the mark is on.

Also make the conditions involving horizontal scrolling more precise.
2016-04-11 20:40:21 +02:00
Benno Schulenberg aa1ae0a144 screen: concentrate the setting of placewewant
Instead of saving the current value of placewewant, then setting the
new value, and then passing the old value to edit_redraw() in seven
different places, just let edit_redraw() do this saving and setting.

In the bargain placewewant is now only recalculated when it matters
-- when allow_update is TRUE -- and not when it's superfluous.
2016-04-11 20:38:05 +02:00
Benno Schulenberg cb17732ac2 scrolling: don't scroll too much when having to bridge blank lines
Add a third mode of scrolling, FLOWING, besides CENTERING and STATIONARY.
This is used for word and paragraph jumping (and for bracket matching,
but that worked correctly already), and only when focusing is FALSE.

The new mode prevents the screen from scrolling too many lines when
there are several blank lines at the bottom of the edit window and
the next word or paragraph is out of view.

This fixes https://savannah.gnu.org/bugs/?47194.
2016-04-07 14:28:25 +02:00
Mike Scalora d851ccdd41 keyboard: recognize four escape sequences produced by iTerm2
On iTerm2 on OS X, the Option+Arrow keys produce special sequences
that start with two escapes.  Catch these sequences and interpret
them appropriately as WordLeft / WordRight / Home / End.

Signed-off-by: Mike Scalora <mike@scalora.org>
Signed-off-by: Thomas Rosenau <thomasr@fantasymail.de>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-04-05 21:00:54 +02:00
Benno Schulenberg d92eb4fee3 all: eradicate SVN's $Id$ tags 2016-04-05 14:59:12 +02:00
Benno Schulenberg 29cac04afc Renaming a variable for clarity.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5778 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-30 12:18:22 +00:00
Benno Schulenberg c98afde096 Renaming 'do_replace_highlight()' to 'spotlight()', for clarity,
for aptness, for contrast.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5777 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-30 12:09:39 +00:00
Benno Schulenberg f45a2938e3 Placing the cursor in the edit window again also after a Justify, after an
invalid escape sequence, and when entering a verbatim keystroke.
But leaving the cursor off during Unicode input, for extra feedback.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5771 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-29 14:09:17 +00:00
Benno Schulenberg 5fe838b072 Deleting a no-op.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5769 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-28 19:30:27 +00:00
Benno Schulenberg 38b74e6993 Not bothering to put back the cursor in the edit window, as it is off
anyway, and it will be placed back when it's needed: in the main loop.

This prevents a segfault laid bare by r5763: when trying, at startup,
to open a directory, there really is no open buffer yet.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5766 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-28 18:53:49 +00:00
Benno Schulenberg 7f3dc2de46 Eliding an unneeded 'if' and unneeded variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5765 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 20:21:36 +00:00
Benno Schulenberg 344fe558b6 Tidying up and renaming a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5764 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 20:04:33 +00:00
Benno Schulenberg 6fc70cc474 Removing a pointless condition, and making use of an existing intermediary
variable for a little optimization.

Openfile can never be NULL -- it should have been called openbuffer, and
before we start fiddling with the cursor, we will always have an open buffer.
Edittop might be NULL, but that's okay.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5763 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-23 19:48:44 +00:00
Benno Schulenberg 8fea3472a9 Giving a central variable a ringing name --
tmp* is something for 5 lines, not for 300.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5734 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-13 20:13:16 +00:00
Benno Schulenberg f5eb316603 Rewrapping and reshuffling some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5673 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-23 12:37:10 +00:00
Benno Schulenberg e085ebb872 Making the cursor visible again after a justification and after an
unrecognized escape sequence.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5667 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 17:15:28 +00:00
Benno Schulenberg 9d8c72951f The amount to scroll is never zero, so there is no need to check.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5660 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-22 09:55:59 +00:00
Benno Schulenberg 56cfab3df6 Fixing Savannah bug #47127 the proper way,
eliding two silly calls of edit_redraw().


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5650 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-18 16:31:02 +00:00
Benno Schulenberg 568d2a389c Switching the cursor on and off at the appropriate moments (that is: when
needed), so that it no longer shows in the help screen nor in the file list.
This fixes Savannah bug #47126.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5640 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-13 19:41:12 +00:00
Benno Schulenberg b8e0e22d64 Switching the cursor on in the right place: in the central input routine.
This makes the cursor visible again during linting.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5628 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-10 20:16:50 +00:00
Benno Schulenberg 97dcd377e7 Turning the cursor off when writing in the status bar,
and ensuring it is on when waiting for input.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5610 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:18:27 +00:00
Benno Schulenberg cc2d37053c Updating the screen immediately when a message is posted on the status bar.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5609 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-06 11:05:58 +00:00
Benno Schulenberg 65c7c810bc Adjusting some indentation and some line wrapping.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5593 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-26 09:16:09 +00:00
Benno Schulenberg b8d32d8b7b Condensing the code by removing a triplication.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5583 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-24 15:32:13 +00:00
Benno Schulenberg 38acacb461 Moving set_modified() to the file that has to do with files.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5566 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 14:42:07 +00:00
Benno Schulenberg dfeb0f938f Plugging another memory leak.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5564 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-15 13:27:12 +00:00
Benno Schulenberg 8a9f71639f Eliding an unneeded variable and adjusting some wrappings and whitespace.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5559 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 13:41:45 +00:00
Benno Schulenberg 8f463778d1 Deleting an 'if' that is always FALSE.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5558 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-14 13:27:22 +00:00
Benno Schulenberg 1b293ff34c Adjusting dates and version number.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5542 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-10 16:18:43 +00:00
Benno Schulenberg ec4ee1c489 Not going beyond the number of available rows in the edit window.
This fixes Savannah bug #42188.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5539 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-09 20:21:29 +00:00
Benno Schulenberg ebbb5b5d1e Making sure to keep advancing also when regex matches are zero-length.
This fixes Savannah bug #26977 -- a hang on start="^" end="$".


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5538 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-09 18:41:56 +00:00
Benno Schulenberg c916ca87bf Correctly restoring the settings of NO_HELP and MORE_SPACE.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5522 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-02 16:33:03 +00:00
Benno Schulenberg bd91785d73 Using 'return' instead of an intermediate variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5504 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-22 20:24:50 +00:00
Benno Schulenberg 46082bd00c Renaming three keyboard functions -- 'get' is not a good name when the
routine isn't getting something from somewhere but just converting it.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5503 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-22 19:00:25 +00:00
Benno Schulenberg 5d27910d6d Quitting the loop when there is no end match.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5488 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-07 15:40:07 +00:00
Benno Schulenberg bb31118fcb Avoiding two compilation warnings.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5481 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-05 11:38:26 +00:00
Benno Schulenberg f2da466388 Rewrapping some lines and tweaking some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5478 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-04 21:11:10 +00:00
Benno Schulenberg 07e806e7f2 Unindenting the part that was the 'else'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5463 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 13:33:45 +00:00
Benno Schulenberg eee07d5755 Renaming a label and eliding an 'else'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5462 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 12:49:17 +00:00
Benno Schulenberg 3d6378b153 Moving a check to a better place.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5461 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-12-01 12:35:48 +00:00
Benno Schulenberg 0129299dc9 Eliding a variable, and tweaking some comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5454 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 14:15:16 +00:00
Benno Schulenberg 98f2f852dd Deleting two redundant conditions, and moving the least frequent case
to the end.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5453 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 13:52:48 +00:00
Benno Schulenberg ee33503402 Using the main multidata-cache-allocation routine.
(Note that there can only be colorstrings when there /is/ a syntax,
so there is no need to check for the latter here.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5452 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 13:20:08 +00:00
Benno Schulenberg e19a16f0e6 Always setting the multidata to CBEGINBEFORE when an end is found,
also when the coloured part is horizontally scrolled off.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5451 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-29 12:31:49 +00:00
Benno Schulenberg f08d79d204 Making Ctrl+Left and Ctrl+Right work on more terminals by asking
ncurses for the keycodes.  This addresses Debian bug #800681.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5434 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-23 08:52:23 +00:00
Benno Schulenberg bde996db67 Discarding a now useless function.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5403 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-11 19:56:35 +00:00