mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Add a NOBLOCK flag rather than adding amount to wait for when
dealing with potentially-long sequences. GitHub issue 3001.
This commit is contained in:
		
							
								
								
									
										8
									
								
								tty.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								tty.c
									
									
									
									
									
								
							@@ -206,6 +206,11 @@ tty_block_maybe(struct tty *tty)
 | 
			
		||||
	size_t		 size = EVBUFFER_LENGTH(tty->out);
 | 
			
		||||
	struct timeval	 tv = { .tv_usec = TTY_BLOCK_INTERVAL };
 | 
			
		||||
 | 
			
		||||
	if (size == 0)
 | 
			
		||||
		tty->flags &= ~TTY_NOBLOCK;
 | 
			
		||||
	else if (tty->flags & TTY_NOBLOCK)
 | 
			
		||||
		return (0);
 | 
			
		||||
 | 
			
		||||
	if (size < TTY_BLOCK_START(tty))
 | 
			
		||||
		return (0);
 | 
			
		||||
 | 
			
		||||
@@ -2088,8 +2093,8 @@ tty_set_selection(struct tty *tty, const char *buf, size_t len)
 | 
			
		||||
	encoded = xmalloc(size);
 | 
			
		||||
 | 
			
		||||
	b64_ntop(buf, len, encoded, size);
 | 
			
		||||
	tty->flags |= TTY_NOBLOCK;
 | 
			
		||||
	tty_putcode_ptr2(tty, TTYC_MS, "", encoded);
 | 
			
		||||
	tty->client->redraw = EVBUFFER_LENGTH(tty->out);
 | 
			
		||||
 | 
			
		||||
	free(encoded);
 | 
			
		||||
}
 | 
			
		||||
@@ -2097,6 +2102,7 @@ tty_set_selection(struct tty *tty, const char *buf, size_t len)
 | 
			
		||||
void
 | 
			
		||||
tty_cmd_rawstring(struct tty *tty, const struct tty_ctx *ctx)
 | 
			
		||||
{
 | 
			
		||||
	tty->flags |= TTY_NOBLOCK;
 | 
			
		||||
	tty_add(tty, ctx->ptr, ctx->num);
 | 
			
		||||
	tty_invalidate(tty);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user