Rewrapping and reshuffling some lines.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5673 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
a9a32d6d89
commit
f5eb316603
|
@ -5,6 +5,7 @@
|
||||||
backwardly marked region. This fixes Savannah bug #46980.
|
backwardly marked region. This fixes Savannah bug #46980.
|
||||||
* src/text.c (do_undo, do_redo): Center the cursor when the
|
* src/text.c (do_undo, do_redo): Center the cursor when the
|
||||||
thing being undone or redone is currently off the screen.
|
thing being undone or redone is currently off the screen.
|
||||||
|
* src/{files,nano,winio}.c: Rewrap and reshuffle some lines.
|
||||||
|
|
||||||
2016-02-22 Chris Allegretta <chrisa@asty.org>
|
2016-02-22 Chris Allegretta <chrisa@asty.org>
|
||||||
* Add ability to kill the trailing spaces when justifying
|
* Add ability to kill the trailing spaces when justifying
|
||||||
|
|
33
src/files.c
33
src/files.c
|
@ -2550,8 +2550,8 @@ char *real_dir_from_tilde(const char *buf)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
userdata = getpwent();
|
userdata = getpwent();
|
||||||
} while (userdata != NULL && strcmp(userdata->pw_name,
|
} while (userdata != NULL &&
|
||||||
tilde_dir + 1) != 0);
|
strcmp(userdata->pw_name, tilde_dir + 1) != 0);
|
||||||
endpwent();
|
endpwent();
|
||||||
if (userdata != NULL)
|
if (userdata != NULL)
|
||||||
tilde_dir = mallocstrcpy(tilde_dir, userdata->pw_dir);
|
tilde_dir = mallocstrcpy(tilde_dir, userdata->pw_dir);
|
||||||
|
@ -2599,6 +2599,7 @@ void free_chararray(char **array, size_t len)
|
||||||
|
|
||||||
for (; len > 0; len--)
|
for (; len > 0; len--)
|
||||||
free(array[len - 1]);
|
free(array[len - 1]);
|
||||||
|
|
||||||
free(array);
|
free(array);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2665,9 +2666,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
matches = (char **)nrealloc(matches, (*num_matches + 1) *
|
matches = (char **)nrealloc(matches, (*num_matches + 1) *
|
||||||
sizeof(char *));
|
sizeof(char *));
|
||||||
matches[*num_matches] =
|
matches[*num_matches] = charalloc(strlen(userdata->pw_name) + 2);
|
||||||
charalloc(strlen(userdata->pw_name) + 2);
|
|
||||||
sprintf(matches[*num_matches], "~%s", userdata->pw_name);
|
sprintf(matches[*num_matches], "~%s", userdata->pw_name);
|
||||||
++(*num_matches);
|
++(*num_matches);
|
||||||
}
|
}
|
||||||
|
@ -2693,8 +2693,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||||
*num_matches = 0;
|
*num_matches = 0;
|
||||||
null_at(&dirname, buf_len);
|
null_at(&dirname, buf_len);
|
||||||
|
|
||||||
/* Okie, if there's a / in the buffer, strip out the directory
|
/* Okie, if there's a / in the buffer, strip out the directory part. */
|
||||||
* part. */
|
|
||||||
filename = strrchr(dirname, '/');
|
filename = strrchr(dirname, '/');
|
||||||
if (filename != NULL) {
|
if (filename != NULL) {
|
||||||
char *tmpdirname = filename + 1;
|
char *tmpdirname = filename + 1;
|
||||||
|
@ -2736,8 +2735,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||||
/* Cool, found a match. Add it to the list. This makes a
|
/* Cool, found a match. Add it to the list. This makes a
|
||||||
* lot more sense to me (Chris) this way... */
|
* lot more sense to me (Chris) this way... */
|
||||||
|
|
||||||
char *tmp = charalloc(strlen(dirname) +
|
char *tmp = charalloc(strlen(dirname) + strlen(nextdir->d_name) + 1);
|
||||||
strlen(nextdir->d_name) + 1);
|
|
||||||
sprintf(tmp, "%s%s", dirname, nextdir->d_name);
|
sprintf(tmp, "%s%s", dirname, nextdir->d_name);
|
||||||
|
|
||||||
#ifndef DISABLE_OPERATINGDIR
|
#ifndef DISABLE_OPERATINGDIR
|
||||||
|
@ -2758,7 +2756,7 @@ char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
matches = (char **)nrealloc(matches, (*num_matches + 1) *
|
matches = (char **)nrealloc(matches, (*num_matches + 1) *
|
||||||
sizeof(char *));
|
sizeof(char *));
|
||||||
matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
|
matches[*num_matches] = mallocstrcpy(NULL, nextdir->d_name);
|
||||||
++(*num_matches);
|
++(*num_matches);
|
||||||
}
|
}
|
||||||
|
@ -2791,8 +2789,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||||
const char *bob = strchr(buf, '/');
|
const char *bob = strchr(buf, '/');
|
||||||
|
|
||||||
if (bob == NULL || bob >= buf + *place)
|
if (bob == NULL || bob >= buf + *place)
|
||||||
matches = username_tab_completion(buf, &num_matches,
|
matches = username_tab_completion(buf, &num_matches, *place);
|
||||||
*place);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Match against files relative to the current working directory. */
|
/* Match against files relative to the current working directory. */
|
||||||
|
@ -2807,8 +2804,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||||
size_t match, common_len = 0;
|
size_t match, common_len = 0;
|
||||||
char *mzero;
|
char *mzero;
|
||||||
const char *lastslash = revstrstr(buf, "/", buf + *place);
|
const char *lastslash = revstrstr(buf, "/", buf + *place);
|
||||||
size_t lastslash_len = (lastslash == NULL) ? 0 :
|
size_t lastslash_len = (lastslash == NULL) ? 0 : lastslash - buf + 1;
|
||||||
lastslash - buf + 1;
|
|
||||||
char *match1_mb = charalloc(mb_cur_max() + 1);
|
char *match1_mb = charalloc(mb_cur_max() + 1);
|
||||||
char *match2_mb = charalloc(mb_cur_max() + 1);
|
char *match2_mb = charalloc(mb_cur_max() + 1);
|
||||||
int match1_mb_len, match2_mb_len;
|
int match1_mb_len, match2_mb_len;
|
||||||
|
@ -2858,8 +2854,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||||
/* If the matches have something in common, show that part. */
|
/* If the matches have something in common, show that part. */
|
||||||
if (common_len != *place) {
|
if (common_len != *place) {
|
||||||
buf = charealloc(buf, common_len + buf_len - *place + 1);
|
buf = charealloc(buf, common_len + buf_len - *place + 1);
|
||||||
charmove(buf + common_len, buf + *place, buf_len -
|
charmove(buf + common_len, buf + *place, buf_len - *place + 1);
|
||||||
*place + 1);
|
|
||||||
strncpy(buf, mzero, common_len);
|
strncpy(buf, mzero, common_len);
|
||||||
*place = common_len;
|
*place = common_len;
|
||||||
}
|
}
|
||||||
|
@ -2915,8 +2910,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place, bool
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
disp = display_string(matches[match], 0, longest_name,
|
disp = display_string(matches[match], 0, longest_name, FALSE);
|
||||||
FALSE);
|
|
||||||
waddstr(edit, disp);
|
waddstr(edit, disp);
|
||||||
free(disp);
|
free(disp);
|
||||||
|
|
||||||
|
@ -2958,8 +2952,7 @@ const char *tail(const char *foo)
|
||||||
|
|
||||||
#ifndef DISABLE_HISTORIES
|
#ifndef DISABLE_HISTORIES
|
||||||
/* Return the constructed dirfile path, or NULL if we can't find the home
|
/* Return the constructed dirfile path, or NULL if we can't find the home
|
||||||
* directory. The string is dynamically allocated, and should be
|
* directory. The string is dynamically allocated, and should be freed. */
|
||||||
* freed. */
|
|
||||||
char *construct_filename(const char *str)
|
char *construct_filename(const char *str)
|
||||||
{
|
{
|
||||||
char *newstr = NULL;
|
char *newstr = NULL;
|
||||||
|
|
|
@ -2625,10 +2625,6 @@ int main(int argc, char **argv)
|
||||||
UNSET(MULTIBUFFER);
|
UNSET(MULTIBUFFER);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
fprintf(stderr, "Main: top and bottom win\n");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* If a starting position was given on the command line, go there. */
|
/* If a starting position was given on the command line, go there. */
|
||||||
if (startline > 0 || startcol > 0)
|
if (startline > 0 || startcol > 0)
|
||||||
do_gotolinecolumn(startline, startcol, FALSE, FALSE);
|
do_gotolinecolumn(startline, startcol, FALSE, FALSE);
|
||||||
|
@ -2641,6 +2637,10 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
fprintf(stderr, "Main: bottom win, top win and edit win\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
display_main_list();
|
display_main_list();
|
||||||
|
|
||||||
display_buffer();
|
display_buffer();
|
||||||
|
|
|
@ -2145,11 +2145,11 @@ void statusbar(const char *msg, ...)
|
||||||
waddstr(bottomwin, " ]");
|
waddstr(bottomwin, " ]");
|
||||||
wattroff(bottomwin, A_BOLD);
|
wattroff(bottomwin, A_BOLD);
|
||||||
wattroff(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
|
wattroff(bottomwin, interface_color_pair[STATUS_BAR].pairnum);
|
||||||
|
|
||||||
wnoutrefresh(bottomwin);
|
wnoutrefresh(bottomwin);
|
||||||
|
/* Leave the cursor in the edit window, not in the statusbar. */
|
||||||
reset_cursor();
|
reset_cursor();
|
||||||
wnoutrefresh(edit);
|
wnoutrefresh(edit);
|
||||||
/* Leave the cursor at its position in the edit window, not in
|
|
||||||
* the statusbar. */
|
|
||||||
|
|
||||||
disable_cursorpos = TRUE;
|
disable_cursorpos = TRUE;
|
||||||
|
|
||||||
|
@ -2955,7 +2955,7 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||||
/* If the current line is offscreen, scroll until it's onscreen. */
|
/* If the current line is offscreen, scroll until it's onscreen. */
|
||||||
if (openfile->current->lineno >= openfile->edittop->lineno + maxrows ||
|
if (openfile->current->lineno >= openfile->edittop->lineno + maxrows ||
|
||||||
openfile->current->lineno < openfile->edittop->lineno)
|
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
|
#ifndef NANO_TINY
|
||||||
/* If the mark is on, update all lines between old_current and current. */
|
/* If the mark is on, update all lines between old_current and current. */
|
||||||
|
@ -2997,7 +2997,7 @@ void edit_refresh(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Make sure the current line is on the screen. */
|
/* 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;
|
foo = openfile->edittop;
|
||||||
|
|
Loading…
Reference in New Issue