mirror of
https://github.com/neovim/neovim.git
synced 2025-09-26 13:08:33 +00:00
move changedOneline, changed_bytes
This commit is contained in:
@@ -282,25 +282,21 @@ static void changed_common(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra
|
|||||||
curwin->w_last_cursormoved.lnum = 0;
|
curwin->w_last_cursormoved.lnum = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void changedOneline(buf_T *buf, linenr_T lnum)
|
||||||
changedOneline(buf_T *buf, linenr_T lnum)
|
|
||||||
{
|
{
|
||||||
if (buf->b_mod_set)
|
if (buf->b_mod_set) {
|
||||||
{
|
// find the maximum area that must be redisplayed
|
||||||
// find the maximum area that must be redisplayed
|
if (lnum < buf->b_mod_top)
|
||||||
if (lnum < buf->b_mod_top)
|
buf->b_mod_top = lnum;
|
||||||
buf->b_mod_top = lnum;
|
else if (lnum >= buf->b_mod_bot)
|
||||||
else if (lnum >= buf->b_mod_bot)
|
buf->b_mod_bot = lnum + 1;
|
||||||
buf->b_mod_bot = lnum + 1;
|
} else {
|
||||||
}
|
// set the area that must be redisplayed to one line
|
||||||
else
|
buf->b_mod_set = true;
|
||||||
{
|
buf->b_mod_top = lnum;
|
||||||
// set the area that must be redisplayed to one line
|
buf->b_mod_bot = lnum + 1;
|
||||||
buf->b_mod_set = TRUE;
|
buf->b_mod_xlines = 0;
|
||||||
buf->b_mod_top = lnum;
|
}
|
||||||
buf->b_mod_bot = lnum + 1;
|
|
||||||
buf->b_mod_xlines = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -310,29 +306,26 @@ changedOneline(buf_T *buf, linenr_T lnum)
|
|||||||
* - invalidates cached values
|
* - invalidates cached values
|
||||||
* Careful: may trigger autocommands that reload the buffer.
|
* Careful: may trigger autocommands that reload the buffer.
|
||||||
*/
|
*/
|
||||||
void
|
void changed_bytes(linenr_T lnum, colnr_T col)
|
||||||
changed_bytes(linenr_T lnum, colnr_T col)
|
|
||||||
{
|
{
|
||||||
changedOneline(curbuf, lnum);
|
changedOneline(curbuf, lnum);
|
||||||
changed_common(lnum, col, lnum + 1, 0L);
|
changed_common(lnum, col, lnum + 1, 0L);
|
||||||
|
// notify any channels that are watching
|
||||||
|
buf_updates_send_changes(curbuf, lnum, 1, 1, true);
|
||||||
|
|
||||||
#ifdef FEAT_DIFF
|
// Diff highlighting in other diff windows may need to be updated too.
|
||||||
// Diff highlighting in other diff windows may need to be updated too.
|
if (curwin->w_p_diff) {
|
||||||
if (curwin->w_p_diff)
|
linenr_T wlnum;
|
||||||
{
|
|
||||||
win_T *wp;
|
|
||||||
linenr_T wlnum;
|
|
||||||
|
|
||||||
FOR_ALL_WINDOWS(wp)
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
if (wp->w_p_diff && wp != curwin)
|
if (wp->w_p_diff && wp != curwin) {
|
||||||
{
|
redraw_win_later(wp, VALID);
|
||||||
redraw_win_later(wp, VALID);
|
wlnum = diff_lnum_win(lnum, wp);
|
||||||
wlnum = diff_lnum_win(lnum, wp);
|
if (wlnum > 0)
|
||||||
if (wlnum > 0)
|
changedOneline(wp->w_buffer, wlnum);
|
||||||
changedOneline(wp->w_buffer, wlnum);
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -1785,53 +1785,6 @@ int gchar_pos(pos_T *pos)
|
|||||||
return utf_ptr2char(ml_get_pos(pos));
|
return utf_ptr2char(ml_get_pos(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Changed bytes within a single line for the current buffer.
|
|
||||||
* - marks the windows on this buffer to be redisplayed
|
|
||||||
* - marks the buffer changed by calling changed()
|
|
||||||
* - invalidates cached values
|
|
||||||
* Careful: may trigger autocommands that reload the buffer.
|
|
||||||
*/
|
|
||||||
void changed_bytes(linenr_T lnum, colnr_T col)
|
|
||||||
{
|
|
||||||
changedOneline(curbuf, lnum);
|
|
||||||
changed_common(lnum, col, lnum + 1, 0L);
|
|
||||||
// notify any channels that are watching
|
|
||||||
buf_updates_send_changes(curbuf, lnum, 1, 1, true);
|
|
||||||
|
|
||||||
/* Diff highlighting in other diff windows may need to be updated too. */
|
|
||||||
if (curwin->w_p_diff) {
|
|
||||||
linenr_T wlnum;
|
|
||||||
|
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
|
||||||
if (wp->w_p_diff && wp != curwin) {
|
|
||||||
redraw_win_later(wp, VALID);
|
|
||||||
wlnum = diff_lnum_win(lnum, wp);
|
|
||||||
if (wlnum > 0)
|
|
||||||
changedOneline(wp->w_buffer, wlnum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void changedOneline(buf_T *buf, linenr_T lnum)
|
|
||||||
{
|
|
||||||
if (buf->b_mod_set) {
|
|
||||||
/* find the maximum area that must be redisplayed */
|
|
||||||
if (lnum < buf->b_mod_top)
|
|
||||||
buf->b_mod_top = lnum;
|
|
||||||
else if (lnum >= buf->b_mod_bot)
|
|
||||||
buf->b_mod_bot = lnum + 1;
|
|
||||||
} else {
|
|
||||||
/* set the area that must be redisplayed to one line */
|
|
||||||
buf->b_mod_set = true;
|
|
||||||
buf->b_mod_top = lnum;
|
|
||||||
buf->b_mod_bot = lnum + 1;
|
|
||||||
buf->b_mod_xlines = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Appended "count" lines below line "lnum" in the current buffer.
|
* Appended "count" lines below line "lnum" in the current buffer.
|
||||||
* Must be called AFTER the change and after mark_adjust().
|
* Must be called AFTER the change and after mark_adjust().
|
||||||
|
Reference in New Issue
Block a user