mirror of
				https://github.com/alacritty/alacritty.git
				synced 2025-10-30 23:36:53 -04:00 
			
		
		
		
	Implement tab stop manipulation
Adds implementations for TBC (tabulation clear) and HTS (set horizontal tabstop).
This commit is contained in:
		
							parent
							
								
									a99a69cfcb
								
							
						
					
					
						commit
						7d20d29f37
					
				
					 5 changed files with 44 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1307,7 +1307,9 @@ impl ansi::Handler for Term {
 | 
			
		|||
 | 
			
		||||
    #[inline]
 | 
			
		||||
    fn set_horizontal_tabstop(&mut self) {
 | 
			
		||||
        trace!("[unimplemented] set_horizontal_tabstop");
 | 
			
		||||
        trace!("set_horizontal_tabstop");
 | 
			
		||||
        let column = self.cursor.point.col;
 | 
			
		||||
        self.tabs[column.0] = true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[inline]
 | 
			
		||||
| 
						 | 
				
			
			@ -1502,7 +1504,21 @@ impl ansi::Handler for Term {
 | 
			
		|||
 | 
			
		||||
    #[inline]
 | 
			
		||||
    fn clear_tabs(&mut self, mode: ansi::TabulationClearMode) {
 | 
			
		||||
        trace!("[unimplemented] clear_tabs: {:?}", mode);
 | 
			
		||||
        trace!("clear_tabs: {:?}", mode);
 | 
			
		||||
        match mode {
 | 
			
		||||
            ansi::TabulationClearMode::Current => {
 | 
			
		||||
                let column = self.cursor.point.col;
 | 
			
		||||
                self.tabs[column.0] = false;
 | 
			
		||||
            },
 | 
			
		||||
            ansi::TabulationClearMode::All => {
 | 
			
		||||
                let len = self.tabs.len();
 | 
			
		||||
                // Safe since false boolean is null, each item occupies only 1
 | 
			
		||||
                // byte, and called on the length of the vec.
 | 
			
		||||
                unsafe {
 | 
			
		||||
                    ::std::ptr::write_bytes(self.tabs.as_mut_ptr(), 0, len);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #[inline]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,6 +40,7 @@ ref_tests! {
 | 
			
		|||
    vttest_origin_mode_1
 | 
			
		||||
    vttest_origin_mode_2
 | 
			
		||||
    vttest_scroll
 | 
			
		||||
    vttest_tab_clear_set
 | 
			
		||||
    zsh_tab_completion
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										23
									
								
								tests/ref/vttest_tab_clear_set/alacritty.recording
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								tests/ref/vttest_tab_clear_set/alacritty.recording
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
[1m[7m%[27m[1m[0m                                                                               
 
[0m[27m[24m[Jjwilm@sanctuary.local [01;32m➜ [01;32m [36m~/code/alacritty [00m [K[?1h=[?2004h[1m[31mv[0m[39m[1m[31mv[1m[31mt[0m[39m[1m[31mv[1m[31mt[1m[31mt[0m[39m[1m[31mt[1m[31me[0m[39m[1m[31me[1m[31ms[0m[39m[0m[35mv[0m[35mt[0m[35mt[0m[35me[0m[35ms[35mt[39m[?1l>[?2004l
 | 
			
		||||
[0c[?1l[?3l[?4l[?5l[?6l[?7h[?8l[?40h[?45l[r[0m[2J[3;10HVT100 test program, version 2.7 (20140305)[4;10H[5;10HChoose test type:
 | 
			
		||||
[6;1H[0J
 | 
			
		||||
          0. Exit
 | 
			
		||||
          1. Test of cursor movements
 | 
			
		||||
          2. Test of screen features
 | 
			
		||||
          3. Test of character sets
 | 
			
		||||
          4. Test of double-sized characters
 | 
			
		||||
          5. Test of keyboard
 | 
			
		||||
          6. Test of terminal reports
 | 
			
		||||
          7. Test of VT52 mode
 | 
			
		||||
          8. Test of VT102 features (Insert/Delete Char/Line)
 | 
			
		||||
          9. Test of known bugs
 | 
			
		||||
          10. Test of reset and self-test
 | 
			
		||||
          11. Test non-VT100 (e.g., VT220, XTERM) terminals
 | 
			
		||||
          12. Modify test-parameters
 | 
			
		||||
 | 
			
		||||
          Enter choice number (0 - 12): 2
 | 
			
		||||
[2J[1;1H[?7h****************************************************************************************************************************************************************[?7l[3;1H****************************************************************************************************************************************************************[?7h[5;1HThis should be three identical lines of *'s completely filling
 | 
			
		||||
the top of the screen without any empty lines between.
 | 
			
		||||
(Test of WRAP AROUND mode setting.)
 | 
			
		||||
Push <RETURN>[2J[3g[1;1H[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[3CH[1;4H[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[0g[6C[1;7H[1g[2g[1;1H	*	*	*	*	*	*	*	*	*	*	*	*	*[2;2H     *     *     *     *     *     *     *     *     *     *     *     *     *[4;1HTest of TAB setting/resetting. These two lines
 | 
			
		||||
should look the same. Push <RETURN>
 | 
			
		||||
							
								
								
									
										1
									
								
								tests/ref/vttest_tab_clear_set/grid.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/ref/vttest_tab_clear_set/grid.json
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										1
									
								
								tests/ref/vttest_tab_clear_set/size.json
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/ref/vttest_tab_clear_set/size.json
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1 @@
 | 
			
		|||
{"width":1124.0,"height":676.0,"cell_width":14.0,"cell_height":28.0}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue