mirror of
				https://github.com/ArthurSonzogni/FTXUI.git
				synced 2025-10-31 10:38:09 +08:00 
			
		
		
		
	Make DEL to be a special character.
This commit is contained in:
		| @@ -19,7 +19,11 @@ class DrawKey : public Component { | ||||
|       for(auto& it : keys[i].input()) | ||||
|         code += L" " + std::to_wstring((unsigned int)it); | ||||
|  | ||||
|       code = L"(" + code + L" ) -> " + keys[i].character() + L")"; | ||||
|       code = L"(" + code + L" ) -> "; | ||||
|       if (keys[i].is_character()) | ||||
|         code +=  keys[i].character(); | ||||
|       else | ||||
|         code +=  L"(special)"; | ||||
|       children.push_back(text(code)); | ||||
|     } | ||||
|     return vbox(std::move(children)); | ||||
|   | ||||
| @@ -49,7 +49,7 @@ struct Event { | ||||
|  private: | ||||
|   std::string input_; | ||||
|   bool is_character_ = false; | ||||
|   wchar_t character_ = '?'; | ||||
|   wchar_t character_ = U'?'; | ||||
| }; | ||||
|  | ||||
| }  // namespace ftxui | ||||
|   | ||||
| @@ -122,6 +122,9 @@ Event Event::GetEvent(std::function<char()> getchar) { | ||||
|   if (input[0] >= 0 && input[0] < 32)  // C0 | ||||
|     return Event::Special(input); | ||||
|  | ||||
|   if (input[0] == 127) // Delete | ||||
|     return Event::Special(input); | ||||
|  | ||||
|   return ParseUTF8(getchar, input); | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ArthurSonzogni
					ArthurSonzogni