mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-11-04 13:38:14 +08:00 
			
		
		
		
	Interpret 8 as 127 (#510)
This resolves: https://github.com/ArthurSonzogni/FTXUI/issues/508 Apparently, this is a common issue: https://www.cs.colostate.edu/~mcrob/toolbox/unix/keyboard.html
This commit is contained in:
		
				
					committed by
					
						
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							1689802349
						
					
				
				
					commit
					2c5681ee20
				
			@@ -19,6 +19,8 @@ const std::map<std::string, std::string> g_uniformize = {{
 | 
				
			|||||||
    // See https://github.com/ArthurSonzogni/FTXUI/issues/337
 | 
					    // See https://github.com/ArthurSonzogni/FTXUI/issues/337
 | 
				
			||||||
    // Here, we uniformize the new line character to `\n`.
 | 
					    // Here, we uniformize the new line character to `\n`.
 | 
				
			||||||
    {"\r", "\n"},
 | 
					    {"\r", "\n"},
 | 
				
			||||||
 | 
					    // See: https://github.com/ArthurSonzogni/FTXUI/issues/508
 | 
				
			||||||
 | 
					    {std::string({8}), std::string({127})},
 | 
				
			||||||
}};
 | 
					}};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TerminalInputParser::TerminalInputParser(Sender<Task> out)
 | 
					TerminalInputParser::TerminalInputParser(Sender<Task> out)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -302,7 +302,7 @@ TEST(Event, Control) {
 | 
				
			|||||||
  };
 | 
					  };
 | 
				
			||||||
  std::vector<TestCase> cases;
 | 
					  std::vector<TestCase> cases;
 | 
				
			||||||
  for (int i = 0; i < 32; ++i) {
 | 
					  for (int i = 0; i < 32; ++i) {
 | 
				
			||||||
    if (i == 13 || i == 24 || i == 26 || i == 27)
 | 
					    if (i == 8 || i == 13 || i == 24 || i == 26 || i == 27)
 | 
				
			||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
    cases.push_back({char(i), false});
 | 
					    cases.push_back({char(i), false});
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@@ -342,6 +342,8 @@ TEST(Event, Special) {
 | 
				
			|||||||
      {str("\x1B[A"), Event::ArrowUp},
 | 
					      {str("\x1B[A"), Event::ArrowUp},
 | 
				
			||||||
      {str("\x1B[B"), Event::ArrowDown},
 | 
					      {str("\x1B[B"), Event::ArrowDown},
 | 
				
			||||||
      {{127}, Event::Backspace},
 | 
					      {{127}, Event::Backspace},
 | 
				
			||||||
 | 
					      // Quirk for: https://github.com/ArthurSonzogni/FTXUI/issues/508
 | 
				
			||||||
 | 
					      {{8}, Event::Backspace},
 | 
				
			||||||
      {str("\x1B[3~"), Event::Delete},
 | 
					      {str("\x1B[3~"), Event::Delete},
 | 
				
			||||||
      //{str("\x1B"), Event::Escape},
 | 
					      //{str("\x1B"), Event::Escape},
 | 
				
			||||||
      {{10}, Event::Return},
 | 
					      {{10}, Event::Return},
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user