diff --git a/ChangeLog b/ChangeLog index 1d5a8935..c6805630 100644 --- a/ChangeLog +++ b/ChangeLog @@ -69,6 +69,9 @@ Changes do_uncut_text() - If uncutting more than one line of unmarked text at editbot, don't center the screen, since Pico doesn't. (DLR) + - If uncutting previously unmarked text, uncut to end if we're + not at the beginning of the line, and set placewewant to 0 if + we are. This matches Pico's behavior. (DLR) - files.c: load_file() - Remove unneeded wmove() call. (David Benbennick) @@ -162,6 +165,9 @@ Changes so that functions only used with tab completion are properly #ifdef'ed out. (DLR) - search.c: + do_search() + - Remove erroneously introduced near-duplicate call to + update_history(). (DLR) print_replaced() - Remove and replace with an equivalent ngettext() call. (DLR) do_replace_loop() diff --git a/cut.c b/cut.c index c566dfb1..bc99bc02 100644 --- a/cut.c +++ b/cut.c @@ -293,10 +293,8 @@ int do_uncut_text(void) { filestruct *tmp = current, *fileptr = current; filestruct *newbuf = NULL, *newend = NULL; -#ifndef NANO_SMALL char *tmpstr, *tmpstr2; filestruct *hold = current; -#endif int i; wrap_reset(); @@ -304,9 +302,18 @@ int do_uncut_text(void) if (cutbuffer == NULL || fileptr == NULL) return 0; /* AIEEEEEEEEEEEE */ -#ifndef NANO_SMALL + /* If we're uncutting a previously non-marked block, uncut to end if + we're not at the beginning of the line. If we are at the + beginning of the line, set placewewant to 0. Pico does both of + these. */ + if (marked_cut == 0) { + if (current_x != 0) + marked_cut = 2; + else + placewewant = 0; + } + if (marked_cut == 0 || cutbuffer->next != NULL) -#endif { newbuf = copy_filestruct(cutbuffer); for (newend = newbuf; newend->next != NULL && newend != NULL; @@ -315,7 +322,6 @@ int do_uncut_text(void) } /* Hook newbuf into fileptr */ -#ifndef NANO_SMALL if (marked_cut != 0) { int recenter_me = 0; /* Should we eventually use edit_update(CENTER)? */ @@ -424,7 +430,6 @@ int do_uncut_text(void) UNSET(KEEP_CUTBUFFER); return 0; } -#endif if (fileptr != fileage) { tmp = fileptr->prev; diff --git a/search.c b/search.c index e5e6449c..4f85eae8 100644 --- a/search.c +++ b/search.c @@ -90,8 +90,8 @@ void search_init_globals(void) * abort, 0 on success, and 1 on rerun calling program. Return -2 to * run opposite program (search -> replace, replace -> search). * - * replacing = 1 if we call from do_replace, 0 if called from do_search - * func. */ + * replacing = 1 if we call from do_replace(), 0 if called from + * do_search(). */ int search_init(int replacing) { int i = 0; @@ -399,15 +399,10 @@ int do_search(void) #ifndef NANO_SMALL /* add this search string to the search history list */ - if (strcmp(answer, "")) + if (answer[0] != '\0') update_history(&search_history, answer); #endif /* !NANO_SMALL */ -#ifndef NANO_SMALL - /* add this search string to the search history list */ - update_history(&search_history, answer); -#endif /* !NANO_SMALL */ - search_last_line = 0; didfind = findnextstr(FALSE, FALSE, current, current_x, answer);