better handle position shifting when unindenting marked text

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3468 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2006-05-05 14:22:42 +00:00
parent aa4dc9596f
commit eb4f90e182
1 changed files with 12 additions and 6 deletions

View File

@ -286,14 +286,20 @@ void do_indent_marked(ssize_t cols)
/* Keep track of the change in the current line. */ /* Keep track of the change in the current line. */
if (f == openfile->mark_begin && if (f == openfile->mark_begin &&
openfile->mark_begin_x > indent_new && openfile->mark_begin_x > indent_new) {
openfile->mark_begin_x >= indent_shift) if (openfile->mark_begin_x <= indent_len)
openfile->mark_begin_x -= indent_shift; openfile->mark_begin_x = indent_new;
else
openfile->mark_begin_x -= indent_shift;
}
if (f == openfile->current && openfile->current_x > if (f == openfile->current && openfile->current_x >
indent_new && openfile->current_x >= indent_new) {
indent_shift) if (openfile->current_x <= indent_len)
openfile->current_x -= indent_shift; openfile->current_x = indent_new;
else
openfile->current_x -= indent_shift;
}
/* We've unindented, so set indent_changed to TRUE. */ /* We've unindented, so set indent_changed to TRUE. */
if (!indent_changed) if (!indent_changed)