commit 2eb745939eadf1f7589f3a6440d8a6c4ca9111fe
parent 3288925efbb7c3f31eab03c842b45498a92e1cb3
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 21 Oct 2004 16:25:44 +0000
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
Diffstat:
3 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -80,6 +80,9 @@ CVS code -
findnextstr(). Changes to do_int_spell_fix(), findnextstr(),
do_search(), do_research(), do_replace(), and
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:
do_insertfile()
- 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
toggling works both ways now and non-numeric text shouldn't be
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()
- Miscellaneous cleanups: set current to real_current and
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,
suggested by Joseph Birthisel)
- 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:
regexp_bol_or_eol()
- Don't assume any longer that string will be found if
diff --git a/src/nano.c b/src/nano.c
@@ -1420,7 +1420,7 @@ bool do_int_spell_fix(const char *word)
{
char *save_search;
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 *current_save = current;
/* Save where we are. */
@@ -1466,6 +1466,7 @@ bool do_int_spell_fix(const char *word)
edittop = fileage;
current = fileage;
current_x = -1;
+ placewewant = 0;
/* Find the first whole-word occurrence of word. */
while (findnextstr(TRUE, TRUE, FALSE, fileage, 0, word, NULL,
@@ -1503,6 +1504,7 @@ bool do_int_spell_fix(const char *word)
edittop = edittop_save;
current = current_save;
current_x = current_x_save;
+ placewewant = pww_save;
/* Restore case sensitivity setting. */
if (!case_sens_set)
diff --git a/src/search.c b/src/search.c
@@ -412,6 +412,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
current = fileptr;
current_x = current_x_find;
current_y = current_y_find;
+ placewewant = xplustabs();
/* needle_len holds the length of needle. */
if (needle_len != NULL)
@@ -749,7 +750,6 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
#endif
if (!replaceall) {
- placewewant = xplustabs();
edit_redraw(current_save, old_pww);
old_pww = placewewant;
}
@@ -870,7 +870,7 @@ void do_replace(void)
{
int i;
filestruct *edittop_save, *begin;
- size_t beginx;
+ size_t beginx, pww_save;
ssize_t numreplaced;
if (ISSET(VIEW_MODE)) {
@@ -937,6 +937,7 @@ void do_replace(void)
edittop_save = edittop;
begin = current;
beginx = current_x;
+ pww_save = placewewant;
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE);
@@ -944,6 +945,7 @@ void do_replace(void)
edittop = edittop_save;
current = begin;
current_x = beginx;
+ placewewant = pww_save;
renumber_all();
edit_refresh();