@@ -2029,14 +2029,9 @@ static void refresh_terminal(Terminal *term)
2029
2029
}
2030
2030
linenr_T ml_before = buf -> b_ml .ml_line_count ;
2031
2031
2032
- // Some refresh_ functions assume the terminal buffer is current. Don't call refresh_cursor here,
2033
- // as we don't want a terminal that was possibly made temporarily current influencing the cursor.
2034
- aco_save_T aco ;
2035
- aucmd_prepbuf (& aco , buf );
2036
2032
refresh_size (term , buf );
2037
2033
refresh_scrollback (term , buf );
2038
2034
refresh_screen (term , buf );
2039
- aucmd_restbuf (& aco );
2040
2035
2041
2036
int ml_added = buf -> b_ml .ml_line_count - ml_before ;
2042
2037
adjust_topline (term , buf , ml_added );
@@ -2168,7 +2163,6 @@ static void adjust_scrollback(Terminal *term, buf_T *buf)
2168
2163
// Refresh the scrollback of an invalidated terminal.
2169
2164
static void refresh_scrollback (Terminal * term , buf_T * buf )
2170
2165
{
2171
- assert (buf == curbuf ); // TODO(seandewar): remove this condition
2172
2166
int width , height ;
2173
2167
vterm_get_size (term -> vt , & height , & width );
2174
2168
@@ -2177,8 +2171,8 @@ static void refresh_scrollback(Terminal *term, buf_T *buf)
2177
2171
int row_offset = term -> sb_pending ;
2178
2172
while (term -> sb_pending > 0 && buf -> b_ml .ml_line_count < height ) {
2179
2173
fetch_row (term , term -> sb_pending - row_offset - 1 , width );
2180
- ml_append ( 0 , term -> textbuf , 0 , false);
2181
- appended_lines ( 0 , 1 );
2174
+ ml_append_buf ( buf , 0 , term -> textbuf , 0 , false);
2175
+ appended_lines_buf ( buf , 0 , 1 );
2182
2176
term -> sb_pending -- ;
2183
2177
}
2184
2178
@@ -2190,21 +2184,21 @@ static void refresh_scrollback(Terminal *term, buf_T *buf)
2190
2184
// section of the buffer
2191
2185
if (((int )buf -> b_ml .ml_line_count - height ) >= (int )term -> sb_size ) {
2192
2186
// scrollback full, delete lines at the top
2193
- ml_delete ( 1 , false);
2194
- deleted_lines ( 1 , 1 );
2187
+ ml_delete_buf ( buf , 1 , false);
2188
+ deleted_lines_buf ( buf , 1 , 1 );
2195
2189
}
2196
2190
fetch_row (term , - term -> sb_pending - row_offset , width );
2197
2191
int buf_index = (int )buf -> b_ml .ml_line_count - height ;
2198
- ml_append ( buf_index , term -> textbuf , 0 , false);
2199
- appended_lines ( buf_index , 1 );
2192
+ ml_append_buf ( buf , buf_index , term -> textbuf , 0 , false);
2193
+ appended_lines_buf ( buf , buf_index , 1 );
2200
2194
term -> sb_pending -- ;
2201
2195
}
2202
2196
2203
2197
// Remove extra lines at the bottom
2204
2198
int max_line_count = (int )term -> sb_current + height ;
2205
2199
while (buf -> b_ml .ml_line_count > max_line_count ) {
2206
- ml_delete ( buf -> b_ml .ml_line_count , false);
2207
- deleted_lines ( buf -> b_ml .ml_line_count , 1 );
2200
+ ml_delete_buf ( buf , buf -> b_ml .ml_line_count , false);
2201
+ deleted_lines_buf ( buf , buf -> b_ml .ml_line_count , 1 );
2208
2202
}
2209
2203
2210
2204
adjust_scrollback (term , buf );
@@ -2214,7 +2208,6 @@ static void refresh_scrollback(Terminal *term, buf_T *buf)
2214
2208
// focused) of a invalidated terminal
2215
2209
static void refresh_screen (Terminal * term , buf_T * buf )
2216
2210
{
2217
- assert (buf == curbuf ); // TODO(bfredl): remove this condition
2218
2211
int changed = 0 ;
2219
2212
int added = 0 ;
2220
2213
int height ;
@@ -2235,10 +2228,10 @@ static void refresh_screen(Terminal *term, buf_T *buf)
2235
2228
fetch_row (term , r , width );
2236
2229
2237
2230
if (linenr <= buf -> b_ml .ml_line_count ) {
2238
- ml_replace ( linenr , term -> textbuf , true);
2231
+ ml_replace_buf ( buf , linenr , term -> textbuf , true, false );
2239
2232
changed ++ ;
2240
2233
} else {
2241
- ml_append ( linenr - 1 , term -> textbuf , 0 , false);
2234
+ ml_append_buf ( buf , linenr - 1 , term -> textbuf , 0 , false);
2242
2235
added ++ ;
2243
2236
}
2244
2237
}
0 commit comments