mirror of
				https://github.com/neovim/neovim.git
				synced 2025-11-04 09:44:31 +00:00 
			
		
		
		
	Merge pull request #9218 from bfredl/termbuf
channel: avoid buffering output when only terminal and no callbacks are active
This commit is contained in:
		@@ -607,12 +607,15 @@ static void on_channel_output(Stream *stream, Channel *chan, RBuffer *buf,
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  rbuffer_consumed(buf, count);
 | 
			
		||||
  // if buffer wasn't consumed, a pending callback is stalled. Aggregate the
 | 
			
		||||
  // received data and avoid a "burst" of multiple callbacks.
 | 
			
		||||
  bool buffer_set = reader->buffer.ga_len > 0;
 | 
			
		||||
  ga_concat_len(&reader->buffer, ptr, count);
 | 
			
		||||
  if (!reader->buffered && !buffer_set && callback_reader_set(*reader)) {
 | 
			
		||||
    process_channel_event(chan, &reader->cb, type, reader, 0);
 | 
			
		||||
 | 
			
		||||
  if (callback_reader_set(*reader) || reader->buffered) {
 | 
			
		||||
    // if buffer wasn't consumed, a pending callback is stalled. Aggregate the
 | 
			
		||||
    // received data and avoid a "burst" of multiple callbacks.
 | 
			
		||||
    bool buffer_set = reader->buffer.ga_len > 0;
 | 
			
		||||
    ga_concat_len(&reader->buffer, ptr, count);
 | 
			
		||||
    if (callback_reader_set(*reader) && !reader->buffered && !buffer_set) {
 | 
			
		||||
      process_channel_event(chan, &reader->cb, type, reader, 0);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user