when saving or changing file positions, be sure not to ignore

placewewant; also move a misplaced changelog entry


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2006 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
David Lawrence Ramsey 2004-10-21 16:25:44 +00:00
parent 3288925efb
commit 2eb745939e
3 changed files with 20 additions and 13 deletions

View File

@ -80,6 +80,9 @@ CVS code -
findnextstr(). Changes to do_int_spell_fix(), findnextstr(), findnextstr(). Changes to do_int_spell_fix(), findnextstr(),
do_search(), do_research(), do_replace(), and do_search(), do_research(), do_replace(), and
do_find_bracket(). (DLR) do_find_bracket(). (DLR)
- When saving or changing file positions, be sure not to ignore
placewewant. Changes to do_int_spell_fix(), findnextstr(),
do_replace_loop(), and do_replace(). (DLR)
- files.c: - files.c:
do_insertfile() do_insertfile()
- Readd the NANO_SMALL #ifdef around the start_again: label to - Readd the NANO_SMALL #ifdef around the start_again: label to
@ -181,6 +184,16 @@ CVS code -
the search prompt to the "Go To Line" prompt, since the the search prompt to the "Go To Line" prompt, since the
toggling works both ways now and non-numeric text shouldn't be toggling works both ways now and non-numeric text shouldn't be
lost when going only one of those ways. (DLR) lost when going only one of those ways. (DLR)
findnextstr()
- Take the no_sameline parameter after can_display_wrap and
wholewords, not after all other parameters. (DLR)
- Maintain current_y's value when moving up or down lines so
that smooth scrolling works correctly. (DLR)
- Fix handling of the wholewords flag so that it works with
regular expressions and in conjunction with the no_sameline
flag, and add new parameters wrapped (used to return the value
of search_last_line) and needle_len (used to return the length
of the match). (DLR)
do_replace_loop() do_replace_loop()
- Miscellaneous cleanups: set current to real_current and - Miscellaneous cleanups: set current to real_current and
current_x to current_x_save, only turn the mark off and call current_x to current_x_save, only turn the mark off and call
@ -192,16 +205,6 @@ CVS code -
replacing only marked text when the mark is on. (DLR, replacing only marked text when the mark is on. (DLR,
suggested by Joseph Birthisel) suggested by Joseph Birthisel)
- Return ssize_t instead of int. (DLR) - Return ssize_t instead of int. (DLR)
findnextstr()
- Take the no_sameline parameter after can_display_wrap and
wholewords, not after all other parameters. (DLR)
- Maintain current_y's value when moving up or down lines so
that smooth scrolling works correctly. (DLR)
- Fix handling of the wholewords flag so that it works with
regular expressions and in conjunction with the no_sameline
flag, and add new parameters wrapped (used to return the value
of search_last_line) and needle_len (used to return the length
of the match). (DLR)
- utils.c: - utils.c:
regexp_bol_or_eol() regexp_bol_or_eol()
- Don't assume any longer that string will be found if - Don't assume any longer that string will be found if

View File

@ -1420,7 +1420,7 @@ bool do_int_spell_fix(const char *word)
{ {
char *save_search; char *save_search;
char *save_replace; char *save_replace;
size_t current_x_save = current_x; size_t current_x_save = current_x, pww_save = placewewant;
filestruct *edittop_save = edittop; filestruct *edittop_save = edittop;
filestruct *current_save = current; filestruct *current_save = current;
/* Save where we are. */ /* Save where we are. */
@ -1466,6 +1466,7 @@ bool do_int_spell_fix(const char *word)
edittop = fileage; edittop = fileage;
current = fileage; current = fileage;
current_x = -1; current_x = -1;
placewewant = 0;
/* Find the first whole-word occurrence of word. */ /* Find the first whole-word occurrence of word. */
while (findnextstr(TRUE, TRUE, FALSE, fileage, 0, word, NULL, while (findnextstr(TRUE, TRUE, FALSE, fileage, 0, word, NULL,
@ -1503,6 +1504,7 @@ bool do_int_spell_fix(const char *word)
edittop = edittop_save; edittop = edittop_save;
current = current_save; current = current_save;
current_x = current_x_save; current_x = current_x_save;
placewewant = pww_save;
/* Restore case sensitivity setting. */ /* Restore case sensitivity setting. */
if (!case_sens_set) if (!case_sens_set)

View File

@ -412,6 +412,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
current = fileptr; current = fileptr;
current_x = current_x_find; current_x = current_x_find;
current_y = current_y_find; current_y = current_y_find;
placewewant = xplustabs();
/* needle_len holds the length of needle. */ /* needle_len holds the length of needle. */
if (needle_len != NULL) if (needle_len != NULL)
@ -749,7 +750,6 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
#endif #endif
if (!replaceall) { if (!replaceall) {
placewewant = xplustabs();
edit_redraw(current_save, old_pww); edit_redraw(current_save, old_pww);
old_pww = placewewant; old_pww = placewewant;
} }
@ -870,7 +870,7 @@ void do_replace(void)
{ {
int i; int i;
filestruct *edittop_save, *begin; filestruct *edittop_save, *begin;
size_t beginx; size_t beginx, pww_save;
ssize_t numreplaced; ssize_t numreplaced;
if (ISSET(VIEW_MODE)) { if (ISSET(VIEW_MODE)) {
@ -937,6 +937,7 @@ void do_replace(void)
edittop_save = edittop; edittop_save = edittop;
begin = current; begin = current;
beginx = current_x; beginx = current_x;
pww_save = placewewant;
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE); numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE);
@ -944,6 +945,7 @@ void do_replace(void)
edittop = edittop_save; edittop = edittop_save;
current = begin; current = begin;
current_x = beginx; current_x = beginx;
placewewant = pww_save;
renumber_all(); renumber_all();
edit_refresh(); edit_refresh();