do {
userdata = getpwent();
- } while (userdata != NULL && strcmp(userdata->pw_name,
- tilde_dir + 1) != 0);
+ } while (userdata != NULL &&
+ strcmp(userdata->pw_name, tilde_dir + 1) != 0);
endpwent();
if (userdata != NULL)
tilde_dir = mallocstrcpy(tilde_dir, userdata->pw_dir);
for (; len > 0; len--)
free(array[len - 1]);
+
free(array);
}
#endif
#endif
matches = (char **)nrealloc(matches, (*num_matches + 1) *
- sizeof(char *));
- matches[*num_matches] =
- charalloc(strlen(userdata->pw_name) + 2);
+ sizeof(char *));
+ matches[*num_matches] = charalloc(strlen(userdata->pw_name) + 2);
sprintf(matches[*num_matches], "~%s", userdata->pw_name);
++(*num_matches);
}
*num_matches = 0;
null_at(&dirname, buf_len);
- /* Okie, if there's a / in the buffer, strip out the directory
- * part. */
+ /* Okie, if there's a / in the buffer, strip out the directory part. */
filename = strrchr(dirname, '/');
if (filename != NULL) {
char *tmpdirname = filename + 1;
/* Cool, found a match. Add it to the list. This makes a
* lot more sense to me (Chris) this way... */
- char *tmp = charalloc(strlen(dirname) +
- strlen(nextdir->d_name) + 1);
+ char *tmp = charalloc(strlen(dirname) + strlen(nextdir->d_name) + 1);
sprintf(tmp, "%s%s", dirname, nextdir->d_name);
#ifndef DISABLE_OPERATINGDIR
continue;
matches = (char **)nrealloc(matches, (*num_matches + 1) *
- sizeof(char *));
+ sizeof(char *));
matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
++(*num_matches);
}
const char *bob = strchr(buf, '/');
if (bob == NULL || bob >= buf + *place)
- matches = username_tab_completion(buf, &num_matches,
- *place);
+ matches = username_tab_completion(buf, &num_matches, *place);
}
/* Match against files relative to the current working directory. */
size_t match, common_len = 0;
char *mzero;
const char *lastslash = revstrstr(buf, "/", buf + *place);
- size_t lastslash_len = (lastslash == NULL) ? 0 :
- lastslash - buf + 1;
+ size_t lastslash_len = (lastslash == NULL) ? 0 : lastslash - buf + 1;
char *match1_mb = charalloc(mb_cur_max() + 1);
char *match2_mb = charalloc(mb_cur_max() + 1);
int match1_mb_len, match2_mb_len;
/* If the matches have something in common, show that part. */
if (common_len != *place) {
buf = charealloc(buf, common_len + buf_len - *place + 1);
- charmove(buf + common_len, buf + *place, buf_len -
- *place + 1);
+ charmove(buf + common_len, buf + *place, buf_len - *place + 1);
strncpy(buf, mzero, common_len);
*place = common_len;
}
break;
}
- disp = display_string(matches[match], 0, longest_name,
- FALSE);
+ disp = display_string(matches[match], 0, longest_name, FALSE);
waddstr(edit, disp);
free(disp);
#ifndef DISABLE_HISTORIES
/* Return the constructed dirfile path, or NULL if we can't find the home
- * directory. The string is dynamically allocated, and should be
- * freed. */
+ * directory. The string is dynamically allocated, and should be freed. */
char *construct_filename(const char *str)
{
char *newstr = NULL;
waddstr(bottomwin, " ]");
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
+
wnoutrefresh(bottomwin);
+ /* Leave the cursor in the edit window, not in the statusbar. */
reset_cursor();
wnoutrefresh(edit);
- /* Leave the cursor at its position in the edit window, not in
- * the statusbar. */
disable_cursorpos = TRUE;
/* If the current line is offscreen, scroll until it's onscreen. */
if (openfile->current->lineno >= openfile->edittop->lineno + maxrows ||
openfile->current->lineno < openfile->edittop->lineno)
- edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER);
+ edit_update((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTER : NONE);
#ifndef NANO_TINY
/* If the mark is on, update all lines between old_current and current. */
#endif
/* Make sure the current line is on the screen. */
- edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER);
+ edit_update((focusing || !ISSET(SMOOTH_SCROLL)) ? CENTER : NONE);
}
foo = openfile->edittop;