Commit Graph

221 Commits (3b21659661adaae415243f89ca8273c70ec7abc7)

Author SHA1 Message Date
Benno Schulenberg fbb6208d15 browser, files: use full path in error message when in confined mode
The relative path could be . or .. or even empty, which is uninformative.

This fixes the last part of https://savannah.gnu.org/bugs/?47798.
2016-05-22 11:41:58 +02:00
Benno Schulenberg 2e75c22759 browser: fix a memory leak 2016-05-21 21:35:02 +02:00
Benno Schulenberg 9576eb62e6 browser: show a message when getcwd() fails, instead of just beeping 2016-05-21 21:34:25 +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 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 b7f1136342 tweaks: trim or improve some comments, and rewrap two lines 2016-05-16 11:31:47 +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 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 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 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
Benno Schulenberg e0c4f9c5fe input: give more detailed feedback when an unbound key is struck 2016-05-01 22:04:32 +02:00
Benno Schulenberg 3ea8f42c7f browser: rearrange the search loop to elide two unneeded variables
Simply move to the next filename first before starting to match.
2016-04-29 17:50:53 +02:00
Benno Schulenberg 02153402ec browser: when nothing was found, restore the global search flags
Don't skip the end of the function: use break instead of return.
2016-04-29 17:03:45 +02:00
Benno Schulenberg d92eb4fee3 all: eradicate SVN's $Id$ tags 2016-04-05 14:59:12 +02:00
Benno Schulenberg e258cc3e95 Improving the wording of an error message: the confinement of
an operating directory is not the same as restricted mode.

(In restricted mode, the file browser is not available at all.)


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5772 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-29 14:16:55 +00:00
Benno Schulenberg b55e8d7b34 Renaming four variables.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5758 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-21 20:49:29 +00:00
Benno Schulenberg 730b46c139 Trimming a duplicate variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5757 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-21 20:38:08 +00:00
Benno Schulenberg 3dee81bfaa Deleting a now unneeded variable.
We will need this again when one day we make a toggle between
jumping to a directory and searching for a filename fragment,
just like the ^T toggle that exists in the Search / Go-to-line
menus.  But for now, we don't need this.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5745 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-19 17:13:33 +00:00
Benno Schulenberg 01888abb22 Deleting a snippet of dead code -- the MGOTODIR menu doesn't have any
functions that could be executed -- other than the line-edition ones,
which are executed under do_prompt().  So the latter won't return
unless either it was cancelled or an answer was given.  Also, if it
/had/ returned with a value bigger than zero, it tried to put back
the key sequence for do_gotolinecolumn_void(), which does not exist
in the MBROWSER menu, so this would not have done anything.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5744 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-19 17:01:40 +00:00
Benno Schulenberg fb7f7011ec Fixing compilation when configured with --enable-tiny plus --enable-browser.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5718 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-03-11 16:30:29 +00:00
Benno Schulenberg 3b8989b0a9 Now putting things in the proper order: setting 'prev_dir' only when
we've actually succeeded in changing directory.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5677 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 14:08:47 +00:00
Benno Schulenberg 761fa7cd3a Plugging a memory leak by not copying a string twice.
This fixes Savannah bug #47206.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5676 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-25 13:52:54 +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 813f9f72d0 Rebuilding the file list only when necessary, and not for each and every
cursor movement.  This fixes Savannah bug #47133.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5638 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-02-13 16:42:30 +00:00
Benno Schulenberg 0af2f9e55c Deleting the unneeded blanking of a variable.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5579 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2016-01-21 20:44:22 +00:00
Benno Schulenberg 42ac5368e1 Allowing an array parameter to be NULL.
This fixes Savannah bug #46420.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5457 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-11-30 16:44:44 +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
Benno Schulenberg 8a058d1f9a Speeding up the finding of the longest filename in the current folder.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5356 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-08-13 18:22:29 +00:00
Benno Schulenberg 6847616aee Differentiating between something being disabled/restricted and
help texts being unavailable.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5331 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-30 18:10:16 +00:00
Benno Schulenberg 8cde95e170 Using the proper type (off_t) for the size of a file,
and avoiding warnings about too large bit shifts.
Patch by Mike Frysinger.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5303 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-07-17 19:38:22 +00:00
Benno Schulenberg 6062a040e1 Limiting the selected file to the available ones in the list.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5273 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-28 06:32:56 +00:00
Benno Schulenberg c32a58a826 Not checking for non-NULL before freeing a variable, as it's unnecessary.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5249 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-06-14 19:14:41 +00:00
Benno Schulenberg 75d64e677e Handling a SIGWINCH (which signals a change in window size) not when it
happens but only when checking for keyboard input.  It now reports the
SIGWINCH via a special key value to the calling routine, to allow not
only the main editor but also the help viewer and the file browser to
adapt their display to the new size.
Patch by Mahyar Abbaspour, somewhat edited by Benno.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5228 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-28 13:02:29 +00:00
Benno Schulenberg 55d1e1a9b8 Taking the distant possibility of terabyte files into account,
and in the bargain getting rid of the need to calculate the
number of digits in UINT_MAX.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5224 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-08 19:35:47 +00:00
Benno Schulenberg a338798559 Adjusting a few comments and line wrappings.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5222 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-03 13:56:51 +00:00
Benno Schulenberg 46464105f2 Displaying an ellipsis only when the filename is longer than
the available space, not when it still fits.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5221 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-05-03 13:25:24 +00:00
Benno Schulenberg 1cf22d4d4f Initializing the search and replace strings in a central place.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5212 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-21 18:42:11 +00:00
Benno Schulenberg 6bdcc8faa9 Saving the settings of the global case-sens, direction, and regexp flags,
and restoring them on exit.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5210 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-21 17:27:33 +00:00
Benno Schulenberg 4e5ea18394 Removing an unused variable, and adjusting the introductory comment
for the recently tweaked logic.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5192 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 09:04:30 +00:00
Benno Schulenberg 99d2358510 Stopping M-\ and M-/ in the WhereisFile menu from doing also an
unrequested search after having performed their function.
Fixes Savannah bug #44790.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5190 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-12 08:31:53 +00:00
Benno Schulenberg 2dc9cbefd3 Renaming some things, for more contrast or to be more fitting.
And condensing the renamed function, and making it void because
the result isn't used anyway.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5187 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2015-04-08 18:40:40 +00:00