tweaks: normalize the indentation after the previous change
Also, improve five comments.master
parent
3dcabd6d03
commit
91ba76e1e0
16
src/files.c
16
src/files.c
|
@ -2517,7 +2517,7 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
||||||
char char1[MAXCHARLEN], char2[MAXCHARLEN];
|
char char1[MAXCHARLEN], char2[MAXCHARLEN];
|
||||||
int len1, len2;
|
int len1, len2;
|
||||||
|
|
||||||
/* Get the number of characters that all matches have in common. */
|
/* Determine the number of characters that all matches have in common. */
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
len1 = collect_char(matches[0] + common_len, char1);
|
len1 = collect_char(matches[0] + common_len, char1);
|
||||||
|
|
||||||
|
@ -2549,7 +2549,7 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
||||||
if (num_matches == 1 && (is_dir(mzero) || is_dir(glued)))
|
if (num_matches == 1 && (is_dir(mzero) || is_dir(glued)))
|
||||||
mzero[common_len++] = '/';
|
mzero[common_len++] = '/';
|
||||||
|
|
||||||
/* If the matches have something in common, show that part. */
|
/* If the matches have something in common, copy that part. */
|
||||||
if (common_len != *place) {
|
if (common_len != *place) {
|
||||||
buf = charealloc(buf, common_len + 1);
|
buf = charealloc(buf, common_len + 1);
|
||||||
memmove(buf + common_len, buf + *place, 1);
|
memmove(buf + common_len, buf + *place, 1);
|
||||||
|
@ -2557,14 +2557,14 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
||||||
*place = common_len;
|
*place = common_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If there is more than one possible completion, show a sorted list. */
|
||||||
if (num_matches > 1) {
|
if (num_matches > 1) {
|
||||||
size_t longest_name = 0, ncols;
|
size_t longest_name = 0, ncols;
|
||||||
int row = 0;
|
int row = 0;
|
||||||
|
|
||||||
/* Sort the list of available choices. */
|
|
||||||
qsort(matches, num_matches, sizeof(char *), diralphasort);
|
qsort(matches, num_matches, sizeof(char *), diralphasort);
|
||||||
|
|
||||||
/* Find the length of the longest among the choices. */
|
/* Find the length of the longest name among the matches. */
|
||||||
for (match = 0; match < num_matches; match++) {
|
for (match = 0; match < num_matches; match++) {
|
||||||
size_t namelen = breadth(matches[match]);
|
size_t namelen = breadth(matches[match]);
|
||||||
|
|
||||||
|
@ -2575,9 +2575,8 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
||||||
if (longest_name > COLS - 1)
|
if (longest_name > COLS - 1)
|
||||||
longest_name = COLS - 1;
|
longest_name = COLS - 1;
|
||||||
|
|
||||||
/* Each column will be (longest_name + 2) columns wide, i.e.
|
/* The columns of names will be separated by two spaces,
|
||||||
* two spaces between columns, except that there will be
|
* but the last column will have just one space after it. */
|
||||||
* only one space after the last column. */
|
|
||||||
ncols = (COLS + 1) / (longest_name + 2);
|
ncols = (COLS + 1) / (longest_name + 2);
|
||||||
|
|
||||||
/* Blank the edit window and hide the cursor. */
|
/* Blank the edit window and hide the cursor. */
|
||||||
|
@ -2607,11 +2606,10 @@ char *input_tab(char *buf, size_t *place, void (*refresh_func)(void), bool *list
|
||||||
*listed = TRUE;
|
*listed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free_chararray(matches, num_matches);
|
||||||
free(glued);
|
free(glued);
|
||||||
free(mzero);
|
free(mzero);
|
||||||
|
|
||||||
free_chararray(matches, num_matches);
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_TABCOMP */
|
#endif /* ENABLE_TABCOMP */
|
||||||
|
|
Loading…
Reference in New Issue