mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-25 06:09:38 +03:00
tweaks: frob a few comments
This commit is contained in:
parent
03fd6f3af8
commit
09e95b2d91
@ -523,20 +523,15 @@ void browser_refresh(void)
|
|||||||
size_t infolen;
|
size_t infolen;
|
||||||
/* The length of the file information in columns. */
|
/* The length of the file information in columns. */
|
||||||
int infomaxlen = 7;
|
int infomaxlen = 7;
|
||||||
/* The maximum length of the file information in
|
/* The maximum length of the file information in columns:
|
||||||
* columns: seven for "--", "(dir)", or the file size,
|
* normally seven, but will be twelve for "(parent dir)". */
|
||||||
* and 12 for "(parent dir)". */
|
|
||||||
bool dots = (COLS >= 15 && namelen >= longest - infomaxlen);
|
bool dots = (COLS >= 15 && namelen >= longest - infomaxlen);
|
||||||
/* Do we put an ellipsis before the filename? Don't set
|
/* Whether to put an ellipsis before the filename? We don't
|
||||||
* this to TRUE if we have fewer than 15 columns (i.e.
|
* waste space on dots when there are fewer than 15 columns. */
|
||||||
* one column for padding, plus seven columns for a
|
char *disp = display_string(thename, dots ?
|
||||||
* filename other than ".."). */
|
namelen + infomaxlen + 4 - longest : 0, longest, FALSE);
|
||||||
char *disp = display_string(thename, dots ? namelen -
|
/* The filename (or a fragment of it) in displayable format.
|
||||||
longest + infomaxlen + 4 : 0, longest, FALSE);
|
* When a fragment, account for dots plus one space padding. */
|
||||||
/* If we put an ellipsis before the filename, reserve
|
|
||||||
* one column for padding, plus seven columns for "--",
|
|
||||||
* "(dir)", or the file size, plus three columns for the
|
|
||||||
* ellipsis. */
|
|
||||||
|
|
||||||
/* If this is the selected item, start its highlighting, and
|
/* If this is the selected item, start its highlighting, and
|
||||||
* remember its location to be able to place the cursor on it. */
|
* remember its location to be able to place the cursor on it. */
|
||||||
@ -548,7 +543,7 @@ void browser_refresh(void)
|
|||||||
|
|
||||||
blank_line(edit, line, col, longest);
|
blank_line(edit, line, col, longest);
|
||||||
|
|
||||||
/* If dots is TRUE, we will display something like "...ename". */
|
/* If the name is too long, we display something like "...ename". */
|
||||||
if (dots)
|
if (dots)
|
||||||
mvwaddstr(edit, line, col, "...");
|
mvwaddstr(edit, line, col, "...");
|
||||||
mvwaddstr(edit, line, dots ? col + 3 : col, disp);
|
mvwaddstr(edit, line, dots ? col + 3 : col, disp);
|
||||||
@ -557,21 +552,16 @@ void browser_refresh(void)
|
|||||||
|
|
||||||
col += longest;
|
col += longest;
|
||||||
|
|
||||||
/* Show information about the file. We don't want to report
|
/* Show information about the file: "--" for symlinks (except when
|
||||||
* file sizes for links, so we use lstat(). */
|
* they point to a directory) and for files that have disappeared,
|
||||||
|
* "(dir)" for directories, and the file size for normal files. */
|
||||||
if (lstat(filelist[i], &st) == -1 || S_ISLNK(st.st_mode)) {
|
if (lstat(filelist[i], &st) == -1 || S_ISLNK(st.st_mode)) {
|
||||||
/* If the file doesn't exist (i.e. it's been deleted while
|
|
||||||
* the file browser is open), or it's a symlink that doesn't
|
|
||||||
* point to a directory, display "--". */
|
|
||||||
if (stat(filelist[i], &st) == -1 || !S_ISDIR(st.st_mode))
|
if (stat(filelist[i], &st) == -1 || !S_ISDIR(st.st_mode))
|
||||||
info = mallocstrcpy(NULL, "--");
|
info = mallocstrcpy(NULL, "--");
|
||||||
/* If the file is a symlink that points to a directory,
|
|
||||||
* display it as a directory. */
|
|
||||||
else
|
else
|
||||||
/* TRANSLATORS: Try to keep this at most 7 characters. */
|
/* TRANSLATORS: Try to keep this at most 7 characters. */
|
||||||
info = mallocstrcpy(NULL, _("(dir)"));
|
info = mallocstrcpy(NULL, _("(dir)"));
|
||||||
} else if (S_ISDIR(st.st_mode)) {
|
} else if (S_ISDIR(st.st_mode)) {
|
||||||
/* If the file is a directory, display it as such. */
|
|
||||||
if (strcmp(thename, "..") == 0) {
|
if (strcmp(thename, "..") == 0) {
|
||||||
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
/* TRANSLATORS: Try to keep this at most 12 characters. */
|
||||||
info = mallocstrcpy(NULL, _("(parent dir)"));
|
info = mallocstrcpy(NULL, _("(parent dir)"));
|
||||||
@ -584,6 +574,7 @@ void browser_refresh(void)
|
|||||||
|
|
||||||
info = charalloc(infomaxlen + 1);
|
info = charalloc(infomaxlen + 1);
|
||||||
|
|
||||||
|
/* Massage the file size into a human-readable form. */
|
||||||
if (st.st_size < (1 << 10))
|
if (st.st_size < (1 << 10))
|
||||||
modifier = ' '; /* bytes */
|
modifier = ' '; /* bytes */
|
||||||
else if (st.st_size < (1 << 20)) {
|
else if (st.st_size < (1 << 20)) {
|
||||||
@ -597,8 +588,7 @@ void browser_refresh(void)
|
|||||||
modifier = 'G'; /* gigabytes */
|
modifier = 'G'; /* gigabytes */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Show the size if less than a terabyte,
|
/* Show the size if less than a terabyte, else show "(huge)". */
|
||||||
* otherwise show "(huge)". */
|
|
||||||
if (result < (1 << 10))
|
if (result < (1 << 10))
|
||||||
sprintf(info, "%4ju %cB", (intmax_t)result, modifier);
|
sprintf(info, "%4ju %cB", (intmax_t)result, modifier);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user