Commit Graph

5649 Commits

Author SHA1 Message Date
Benno Schulenberg bc33539b11 files: upgrade the locking errors, so they will not be overwritten
Make the failures to read or write a lock file into important messages,
so they will not be overwritten by the number of lines read.
2016-05-18 12:08:54 +02:00
Benno Schulenberg 906ada8fe7 files: remove the special 'quiet' mechanism for not overwriting messages
The general mechanism for not allowing important messages to be overwritten
will take care of not overwriting warnings about failed file lockings.
2016-05-18 12:04:45 +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 f7c3e1cac2 spelling: gettextize the next-word message 2016-05-18 10:25:16 +02:00
Benno Schulenberg d7d3a87624 tweaks: elide an unneeded variable 2016-05-17 21:29:44 +02:00
Benno Schulenberg c03ce956c8 browser: after getting a mouse click, don't try any further interpretation
Either the selected file was changed, or a file or directory was chosen
(and the Enter key virtually pressed), or a shortcut was executed.  So,
just go and read the next key.

This fixes https://savannah.gnu.org/bugs/?47944.
2016-05-17 17:49:15 +02:00
Benno Schulenberg eedec06cc4 tweaks: fix compilation when configured with --enable-tiny --enable-browser 2016-05-17 12:48:47 +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 58404e4ba2 browser: keep the highlight in the same spot or column, when possible
When doing a PageUp or PageDown in the browser, don't move the highlight
to the first line in the same column, but keep it in the same relative
position of the screen.  If we're already on the first or last page,
move the highlight to the first or last line, but keep it in the same
column.  If we're already on the first or last line, only then move it
to the first or last entry.
2016-05-16 17:03:45 +02:00
Benno Schulenberg 36df5ceef6 browser: make Ctrl+Left and Ctrl+Right jump to left and right column 2016-05-16 17:01:45 +02:00
Benno Schulenberg 3d82986725 help: add an extra blank line to the lists of searching shortcuts
To separate things that have little to do with each other.
2016-05-16 16:55:11 +02:00
Benno Schulenberg 04a230f933 tweaks: avoid a warning when configured with --disable-wrapping 2016-05-16 16:36:49 +02:00
Benno Schulenberg 71e452aef2 screen: improve the conditional placement of a help-line item
When compiled with --disable-justify, try to keep the vertical pairing
of related items.
2016-05-16 16:34:07 +02:00
Benno Schulenberg 18bdde4aa4 search: when looking for whole words, examine the entire line
This fixes https://savannah.gnu.org/bugs/?47933.
2016-05-16 13:12:33 +02:00
Benno Schulenberg 0cc3da5d5e spelling: retreat one x position, to not miss the first word
This fixes https://savannah.gnu.org/bugs/?47932.
2016-05-16 12:31:34 +02:00
Benno Schulenberg b7f1136342 tweaks: trim or improve some comments, and rewrap two lines 2016-05-16 11:31:47 +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 06b449b22c utils: provide a failure message for all uses of 'fsfromline' 2016-05-12 12:07:19 +02:00
Benno Schulenberg fe9cf6f399 tweaks: make advancing and retreating more symmetrical 2016-05-12 12:05:11 +02:00
Benno Schulenberg 21edf7bb90 tweaks: do an assignment in a more transparent way 2016-05-12 12:00:56 +02:00
Benno Schulenberg 5e4f16da44 tweaks: remove a superfluous call of 'wnoutrefresh'
The function 'bottombars' has already done this.
2016-05-12 11:59:45 +02:00
Benno Schulenberg 81b29d9a21 tweaks: remove a superfluous setting of 'refresh_needed'
An interactive 'gotolinecolumn' has already refreshed the screen.
2016-05-12 11:56:59 +02:00
Benno Schulenberg 8ddc5e7b93 browser: make the calculation of files-per-line a straightforward one
There is no need to iterate through all the file names, as we already
know the length of the longest.  From this it's easy to calculate how
many names fit on a line.
2016-05-10 21:24:34 +02:00
Benno Schulenberg c6ec435ae9 browser: use the reselection mechanism also after resizing and after help
Also rename some things to be more fitting.  And make sure that something
will be selected even when many files, including the selected one, have
disappeared.
2016-05-10 17:50:07 +02:00
Rishabh Dave 8a5b4f616b browser: keep the same file selected when the directory contents change
When refreshing the screen (and thus the file list), use the prev_dir
mechanism to reselect the file that was selected before the refresh,
to prevent the selection from changing when files were added or deleted.

Also, when the selected name has disappeared, move the highlight one step
back, so that it is obvious that the selection has changed.  (Decrementing
'selected' will never make it negative, because selected == 0 means the
'..' entry, and every directory has a '..' entry, so it will be found.)

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

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-05-10 16:55:58 +02:00
Benno Schulenberg 9cbe6a640c search: when polling the keyboard, consume all waiting keystrokes
When during searching we look at the keyboard, then don't look at
just the first keystroke, but check if there are more, and if so,
check each one until we find a Cancel -- or until all keystrokes
have been consumed and we can continue.

This fixes the first half of https://savannah.gnu.org/bugs/?47438.
2016-05-06 09:31:49 +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 338807a327 help: bring some air into the lists of shortcuts, giving the eye a hold 2016-05-05 13:27:07 +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 97e9849d6c TODO: tidy up the punctuation
Also remove the item about one Replacement Character per invalid UTF-8
sequence, because how many bytes form a sequence?  Two?  Three?  Four?
Better just put one Replacement Character per invalid byte, like is
done now.
2016-05-05 13:00:20 +02:00
Benno Schulenberg be4a3f8273 spelling: separate the fixing of different words with a short pause
When fixing a misspelling and not answering 'All' (but 'Yes' or 'No'),
the chance is quite substantial that one will type y or n at the end of
the next word.  Diminish this chance by showing for a moment a message
on the statusbar.
2016-05-04 19:45:09 +02:00
Benno Schulenberg 433c7e5dc6 spelling: don't partition the file for replacements in a marked region
Partitioning the file makes the undo system lose track, so that undoing
things has a good chance of losing data.  Instead, just make sure that
the region is marked "backwards", with current at the top and the mark
at the bottom, and then let the replace loop take care of not going
outside of the marked region.

This also has the effect that if the marked region fits entirely on the
screen, or all the misspellings are onscreen, then the screen will not
be scrolled at all.  Which makes for a smooth experience.

This fixes https://savannah.gnu.org/bugs/?47836,
and fixes https://savannah.gnu.org/bugs/?45573.
2016-05-04 19:45:09 +02:00
Benno Schulenberg 9d6d5b679a screen: rename a variable, because 'disable' sounds too permanent 2016-05-04 12:18:21 +02:00
Benno Schulenberg f1b9ba2781 rcfile: make an error message equal to another, and more informative 2016-05-04 10:22:28 +02:00
Benno Schulenberg 318ed6b105 scrolling: center the cursor when inserted stuff does not fit on screen
Since nano-2.4.1, reading in or pasting a large piece of text would put
the cursor on the bottom line, leaving only one line of the non-read or
non-pasted text visible.  This is different from the centering behavior
of Pico, and somewhat disorienting, as you can't see "where you are" any
more in relation to the file as it was.

So now center the cursor whenever the read or pasted text is larger than
the screen, but don't center it when the text fits entirely on the screen.
(The latter avoids the effect of the screen jumping unnecessarily when
inserting just a few lines while the cursor is near the bottom.)

To achieve this behavior: default to focusing, and temporarily set it to
FALSE when the focusing effect is unwanted.

This fixes https://savannah.gnu.org/bugs/?47841.
2016-05-04 10:13:36 +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 937c47898a spelling: pass the correct position of the cursor
When starting to replace misspelled words, pass the actual position
of the cursor instead of the position of the first found occurrence,
so that the cursor position will be updated for changed lengths.

This fixes https://savannah.gnu.org/bugs/?47834.
2016-05-03 13:07:40 +02:00
Benno Schulenberg cc0a3d8490 search: modify a function to take a length as parameter instead of a word
When verifying that a match is a separate word (during spell checking),
instead of first copying out the word, then passing the word, and then
measuring its length, just pass its length straigtaway.
2016-05-03 11:08:59 +02:00
Benno Schulenberg e666f8c50d input: write a few ifs more compactly 2016-05-02 21:58:43 +02:00
Benno Schulenberg 05238f31f4 search: elide an unneeded function
When we're spell checking, we don't need a special mechanism to detect
we have come full circle: reaching the end-of-buffer means we're done.
So don't bother to reset came_full_circle when we're spell checking
(when begin == NULL) but simply ignore its value.
2016-05-02 21:07:27 +02:00
Benno Schulenberg e21e954742 browser: add a binding for the refresh function
And make the function actually refresh the list.  Useful for when files
have been added or deleted since opening the browser.
2016-05-02 12:00:56 +02:00
Benno Schulenberg e2556274f7 browser: provide tab completion also outside of the working directory
Add a global variable, 'present_path', so that 'cwd_tab_completion()'
knows where the user is in the browser, so that it can try completions
against names in that directory instead of always against names in the
current working directory (where nano was invoked).

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

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-05-02 12:00:18 +02:00