anchor: during full justification preserve anchors as during single ones
When a single paragraph is justified, any anchor on any of its lines gets moved to its first line. Let a full justification do the same for each of the paragraphs. This fixes https://savannah.gnu.org/bugs/?58272 in a better way.master
parent
703cebaaac
commit
11f099e1da
|
@ -1564,7 +1564,9 @@ void concat_paragraph(linestruct *line, size_t count)
|
|||
line->data = charealloc(line->data,
|
||||
line_len + next_line_len - next_lead_len + 1);
|
||||
strcat(line->data, next_line->data + next_lead_len);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
line->has_anchor |= next_line->has_anchor;
|
||||
#endif
|
||||
unlink_node(next_line);
|
||||
count--;
|
||||
}
|
||||
|
@ -1733,8 +1735,6 @@ void do_justify(bool full_justify)
|
|||
/* Whether the mark (if any) is before the cursor. */
|
||||
bool before_eol = FALSE;
|
||||
/* Whether the end of a marked region is before the end of its line. */
|
||||
bool had_anchor = FALSE;
|
||||
/* Whether the first line of the paragraph had an anchor. */
|
||||
char *primary_lead = NULL;
|
||||
/* The leading part (quoting + indentation) of the first line
|
||||
* of the paragraph where the marked region begins. */
|
||||
|
@ -1872,7 +1872,6 @@ void do_justify(bool full_justify)
|
|||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(CUT, NULL);
|
||||
had_anchor = openfile->current->has_anchor;
|
||||
#endif
|
||||
/* Do the equivalent of a marked cut into an empty cutbuffer. */
|
||||
cutbuffer = NULL;
|
||||
|
@ -1942,7 +1941,7 @@ void do_justify(bool full_justify)
|
|||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(PASTE, NULL);
|
||||
if (full_justify && !openfile->mark && !had_anchor)
|
||||
if (full_justify && !openfile->mark && !cutbuffer->has_anchor)
|
||||
openfile->current->has_anchor = FALSE;
|
||||
#endif
|
||||
/* Do the equivalent of a paste of the justified text. */
|
||||
|
|
Loading…
Reference in New Issue