|  | @@ -12,6 +12,8 @@ static void ansiscr_putc(struct _curses_screen *scr, chtype c) __nonnull;
 | 
		
	
		
			
			| 12 | 12 |  unsigned short _COLS = 80;
 | 
		
	
		
			
			| 13 | 13 |  unsigned short _LINES = 24;
 | 
		
	
		
			
			| 14 | 14 |  
 | 
		
	
		
			
			|  | 15 | +static unsigned int saved_usage;
 | 
		
	
		
			
			|  | 16 | +
 | 
		
	
		
			
			| 15 | 17 |  static void ansiscr_reset ( struct _curses_screen *scr ) {
 | 
		
	
		
			
			| 16 | 18 |  	/* Reset terminal attributes and clear screen */
 | 
		
	
		
			
			| 17 | 19 |  	scr->attrs = 0;
 | 
		
	
	
		
			
			|  | @@ -20,6 +22,16 @@ static void ansiscr_reset ( struct _curses_screen *scr ) {
 | 
		
	
		
			
			| 20 | 22 |  	printf ( "\033[0m" );
 | 
		
	
		
			
			| 21 | 23 |  }
 | 
		
	
		
			
			| 22 | 24 |  
 | 
		
	
		
			
			|  | 25 | +static void ansiscr_init ( struct _curses_screen *scr ) {
 | 
		
	
		
			
			|  | 26 | +	saved_usage = console_set_usage ( CONSOLE_USAGE_TUI );
 | 
		
	
		
			
			|  | 27 | +	ansiscr_reset ( scr );
 | 
		
	
		
			
			|  | 28 | +}
 | 
		
	
		
			
			|  | 29 | +
 | 
		
	
		
			
			|  | 30 | +static void ansiscr_exit ( struct _curses_screen *scr ) {
 | 
		
	
		
			
			|  | 31 | +	ansiscr_reset ( scr );
 | 
		
	
		
			
			|  | 32 | +	console_set_usage ( saved_usage );
 | 
		
	
		
			
			|  | 33 | +}
 | 
		
	
		
			
			|  | 34 | +
 | 
		
	
		
			
			| 23 | 35 |  static void ansiscr_movetoyx ( struct _curses_screen *scr,
 | 
		
	
		
			
			| 24 | 36 |  			       unsigned int y, unsigned int x ) {
 | 
		
	
		
			
			| 25 | 37 |  	if ( ( x != scr->curs_x ) || ( y != scr->curs_y ) ) {
 | 
		
	
	
		
			
			|  | @@ -65,8 +77,8 @@ static bool ansiscr_peek ( struct _curses_screen *scr __unused ) {
 | 
		
	
		
			
			| 65 | 77 |  }
 | 
		
	
		
			
			| 66 | 78 |  
 | 
		
	
		
			
			| 67 | 79 |  SCREEN _ansi_screen = {
 | 
		
	
		
			
			| 68 |  | -	.init		= ansiscr_reset,
 | 
		
	
		
			
			| 69 |  | -	.exit		= ansiscr_reset,
 | 
		
	
		
			
			|  | 80 | +	.init		= ansiscr_init,
 | 
		
	
		
			
			|  | 81 | +	.exit		= ansiscr_exit,
 | 
		
	
		
			
			| 70 | 82 |  	.movetoyx	= ansiscr_movetoyx,
 | 
		
	
		
			
			| 71 | 83 |  	.putc		= ansiscr_putc,
 | 
		
	
		
			
			| 72 | 84 |  	.getc		= ansiscr_getc,
 |