Skip to content

Commit

Permalink
improve merging of snips when a style change is applied to a range (a…
Browse files Browse the repository at this point in the history
…s by the syntax colorer)

svn: r4871
  • Loading branch information
mflatt committed Nov 16, 2006
1 parent 4172625 commit c0268de
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/mred/wxme/wx_mpriv.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void wxMediaEdit::_ChangeStyle(long start, long end,
wxSnip *gsnip, *startSnip, *endSnip;
wxStyleChangeRecord *rec;
wxStyle *style, *style2, *prev_style;
long p, prev_style_pos;
long p, prev_style_pos, extra_check_pos = 0;
int something;

if (writeLocked || userLocked)
Expand Down Expand Up @@ -317,7 +317,9 @@ void wxMediaEdit::_ChangeStyle(long start, long end,
gsnip->style = style2;

if (rec && (style != prev_style)) {
rec->AddStyleChange(prev_style_pos, p, prev_style);
if (prev_style) {
rec->AddStyleChange(prev_style_pos, p, prev_style);
}
prev_style_pos = p;
prev_style = style;
}
Expand All @@ -327,6 +329,8 @@ void wxMediaEdit::_ChangeStyle(long start, long end,
if (maxWidth > 0)
gsnip->line->MarkCheckFlow();

extra_check_pos = p;

something = TRUE;
} else if (rec && prev_style) {
rec->AddStyleChange(prev_style_pos, p, prev_style);
Expand Down Expand Up @@ -356,7 +360,10 @@ void wxMediaEdit::_ChangeStyle(long start, long end,
delayedStreak = TRUE;

CheckMergeSnips(start);
CheckMergeSnips(end);
if (extra_check_pos)
CheckMergeSnips(extra_check_pos);
if (extra_check_pos != end)
CheckMergeSnips(end);

if (!modified && counts_as_mod)
SetModified(TRUE);
Expand Down

0 comments on commit c0268de

Please sign in to comment.