Commit Graph

245 Commits (9eeb1c8fb89f9b6141e22940949f9cec7e96e13c)

Author SHA1 Message Date
Benno Schulenberg 2fd497e3ef tweaks: remove a superfluous blanking of the statusbar
The prompt from which the browser was invoked has already blanked it.
2016-09-03 15:34:44 +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 b77b1391c3 tweaks: improve some indentation and reshuffle a few lines 2016-08-26 12:24:18 +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 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 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 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 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
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 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
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 956fead2e1 browser: show an error message when selecting an inaccessible directory
This fixes https://savannah.gnu.org/bugs/?48007.

Tested-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-06-13 11:15:20 +02:00
Benno Schulenberg 17cf833b9c tweaks: normalize some whitespace 2016-05-30 09:09:36 +02:00
Benno Schulenberg 1d3d30776a tweaks: more consistently use * instead of [0] when checking for '\0' 2016-05-27 21:31:55 +02:00
Benno Schulenberg d3bd855c9d tweaks: rename a function, and move the sorting there too 2016-05-25 12:09:22 +02:00
Rishabh Dave bd3f156044 browser: move all openings and closings of a directory to the same function
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-05-25 12:02:33 +02:00
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