mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:12:43 +00:00 
			
		
		
		
	TextEditor: Show action long texts in the status bar :^)
We now display a description of the currently hovered action in the text editor application's status bar. This is pretty cool! :^) This is currentl achieved via the hooks on GUI::Application. Longer term we'll probably want to find a more flexible abstraction for this, since not all applications will be as simple as TextEditor.
This commit is contained in:
		
							parent
							
								
									22ed6a70eb
								
							
						
					
					
						commit
						e67f392576
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		|  | @ -58,6 +58,7 @@ | ||||||
| #include <LibGUI/ToolbarContainer.h> | #include <LibGUI/ToolbarContainer.h> | ||||||
| #include <LibGUI/VimEditingEngine.h> | #include <LibGUI/VimEditingEngine.h> | ||||||
| #include <LibGfx/Font.h> | #include <LibGfx/Font.h> | ||||||
|  | #include <LibGfx/Painter.h> | ||||||
| #include <LibJS/SyntaxHighlighter.h> | #include <LibJS/SyntaxHighlighter.h> | ||||||
| #include <LibMarkdown/Document.h> | #include <LibMarkdown/Document.h> | ||||||
| #include <LibWeb/OutOfProcessWebView.h> | #include <LibWeb/OutOfProcessWebView.h> | ||||||
|  | @ -274,6 +275,17 @@ TextEditorWidget::TextEditorWidget() | ||||||
| 
 | 
 | ||||||
|     m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar"); |     m_statusbar = *find_descendant_of_type_named<GUI::Statusbar>("statusbar"); | ||||||
| 
 | 
 | ||||||
|  |     GUI::Application::the()->on_action_enter = [this](GUI::Action& action) { | ||||||
|  |         auto text = action.long_text(); | ||||||
|  |         if (text.is_empty()) | ||||||
|  |             text = Gfx::parse_ampersand_string(action.text()); | ||||||
|  |         m_statusbar->set_override_text(move(text)); | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     GUI::Application::the()->on_action_leave = [this](GUI::Action&) { | ||||||
|  |         m_statusbar->set_override_text({}); | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|     m_editor->on_cursor_change = [this] { update_statusbar(); }; |     m_editor->on_cursor_change = [this] { update_statusbar(); }; | ||||||
|     m_editor->on_selection_change = [this] { update_statusbar(); }; |     m_editor->on_selection_change = [this] { update_statusbar(); }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling