Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
09e95b2d
Commit
09e95b2d
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: frob a few comments
parent
03fd6f3a
master
feature/match-parens
refactor/readbility
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/browser.c
+14
-24
src/browser.c
with
14 additions
and
24 deletions
+14
-24
src/browser.c
View file @
09e95b2d
...
...
@@ -523,20 +523,15 @@ void browser_refresh(void)
size_t
infolen
;
/* The length of the file information in columns. */
int
infomaxlen
=
7
;
/* The maximum length of the file information in
* columns: seven for "--", "(dir)", or the file size,
* and 12 for "(parent dir)". */
/* The maximum length of the file information in columns:
* normally seven, but will be twelve for "(parent dir)". */
bool
dots
=
(
COLS
>=
15
&&
namelen
>=
longest
-
infomaxlen
);
/* Do we put an ellipsis before the filename? Don't set
* this to TRUE if we have fewer than 15 columns (i.e.
* one column for padding, plus seven columns for a
* filename other than ".."). */
char
*
disp
=
display_string
(
thename
,
dots
?
namelen
-
longest
+
infomaxlen
+
4
:
0
,
longest
,
FALSE
);
/* 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. */
/* Whether to put an ellipsis before the filename? We don't
* waste space on dots when there are fewer than 15 columns. */
char
*
disp
=
display_string
(
thename
,
dots
?
namelen
+
infomaxlen
+
4
-
longest
:
0
,
longest
,
FALSE
);
/* The filename (or a fragment of it) in displayable format.
* When a fragment, account for dots plus one space padding. */
/* If this is the selected item, start its highlighting, and
* 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
);
/* If
dots is TRUE, we will
display something like "...ename". */
/* If
the name is too long, we
display something like "...ename". */
if
(
dots
)
mvwaddstr
(
edit
,
line
,
col
,
"..."
);
mvwaddstr
(
edit
,
line
,
dots
?
col
+
3
:
col
,
disp
);
...
...
@@ -557,21 +552,16 @@ void browser_refresh(void)
col
+=
longest
;
/* Show information about the file. We don't want to report
* file sizes for links, so we use lstat(). */
/* Show information about the file: "--" for symlinks (except when
* 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 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
))
info
=
mallocstrcpy
(
NULL
,
"--"
);
/* If the file is a symlink that points to a directory,
* display it as a directory. */
else
/* TRANSLATORS: Try to keep this at most 7 characters. */
info
=
mallocstrcpy
(
NULL
,
_
(
"(dir)"
));
}
else
if
(
S_ISDIR
(
st
.
st_mode
))
{
/* If the file is a directory, display it as such. */
if
(
strcmp
(
thename
,
".."
)
==
0
)
{
/* TRANSLATORS: Try to keep this at most 12 characters. */
info
=
mallocstrcpy
(
NULL
,
_
(
"(parent dir)"
));
...
...
@@ -584,6 +574,7 @@ void browser_refresh(void)
info
=
charalloc
(
infomaxlen
+
1
);
/* Massage the file size into a human-readable form. */
if
(
st
.
st_size
<
(
1
<<
10
))
modifier
=
' '
;
/* bytes */
else
if
(
st
.
st_size
<
(
1
<<
20
))
{
...
...
@@ -597,8 +588,7 @@ void browser_refresh(void)
modifier
=
'G'
;
/* gigabytes */
}
/* Show the size if less than a terabyte,
* otherwise show "(huge)". */
/* Show the size if less than a terabyte, else show "(huge)". */
if
(
result
<
(
1
<<
10
))
sprintf
(
info
,
"%4ju %cB"
,
(
intmax_t
)
result
,
modifier
);
else
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help