mirror of git://git.sv.gnu.org/nano.git
Correcting the logic for adjusting the x position of the mark,
and improving the comments. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5395 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
b66e4bfa5b
commit
a1c03ed5c1
|
@ -1,3 +1,8 @@
|
|||
2015-11-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/search.c (do_replace_loop): Correct the logic for adjusting the
|
||||
x position of the mark -- it happened to work because 'mark_begin' is
|
||||
NULL when 'old_mark_set' is FALSE. Also improve the comments.
|
||||
|
||||
2015-11-06 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (write_lockfile): Don't bail out when the hostname is
|
||||
overlong, but instead truncate it properly and continue. This fixes
|
||||
|
|
15
src/search.c
15
src/search.c
|
@ -747,14 +747,12 @@ ssize_t do_replace_loop(
|
|||
length_change = strlen(copy) - strlen(openfile->current->data);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark was on and (mark_begin, mark_begin_x) was the
|
||||
* top of it, don't change mark_begin_x. */
|
||||
if (!old_mark_set || !right_side_up) {
|
||||
/* Keep mark_begin_x in sync with the text changes. */
|
||||
/* If the mark was on and it was located after the cursor,
|
||||
* then adjust its x position for any text length changes. */
|
||||
if (old_mark_set && !right_side_up) {
|
||||
if (openfile->current == openfile->mark_begin &&
|
||||
openfile->mark_begin_x > openfile->current_x) {
|
||||
if (openfile->mark_begin_x < openfile->current_x +
|
||||
match_len)
|
||||
if (openfile->mark_begin_x < openfile->current_x + match_len)
|
||||
openfile->mark_begin_x = openfile->current_x;
|
||||
else
|
||||
openfile->mark_begin_x += length_change;
|
||||
|
@ -762,11 +760,10 @@ ssize_t do_replace_loop(
|
|||
}
|
||||
}
|
||||
|
||||
/* If the mark was on and (current, current_x) was the top
|
||||
* of it, don't change real_current_x. */
|
||||
/* If the mark was not on or it was before the cursor, then
|
||||
* adjust the cursor's x position for any text length changes. */
|
||||
if (!old_mark_set || right_side_up) {
|
||||
#endif
|
||||
/* Keep real_current_x in sync with the text changes. */
|
||||
if (openfile->current == real_current &&
|
||||
openfile->current_x <= *real_current_x) {
|
||||
if (*real_current_x < openfile->current_x + match_len)
|
||||
|
|
Loading…
Reference in New Issue