mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 23:28:12 +00:00
TextEditor: Focus the editor widget on startup
This commit is contained in:
parent
ee8773c586
commit
f8703d44cc
3 changed files with 4 additions and 2 deletions
|
@ -250,8 +250,6 @@ TextEditorWidget::TextEditorWidget()
|
||||||
|
|
||||||
toolbar->add_action(m_editor->undo_action());
|
toolbar->add_action(m_editor->undo_action());
|
||||||
toolbar->add_action(m_editor->redo_action());
|
toolbar->add_action(m_editor->redo_action());
|
||||||
|
|
||||||
m_editor->set_focus(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditorWidget::~TextEditorWidget()
|
TextEditorWidget::~TextEditorWidget()
|
||||||
|
|
|
@ -19,6 +19,8 @@ public:
|
||||||
void open_sesame(const String& path);
|
void open_sesame(const String& path);
|
||||||
bool request_close();
|
bool request_close();
|
||||||
|
|
||||||
|
GTextEditor& editor() { return *m_editor; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TextEditorWidget();
|
TextEditorWidget();
|
||||||
void set_path(const FileSystemPath& file);
|
void set_path(const FileSystemPath& file);
|
||||||
|
|
|
@ -12,6 +12,8 @@ int main(int argc, char** argv)
|
||||||
auto text_widget = TextEditorWidget::construct();
|
auto text_widget = TextEditorWidget::construct();
|
||||||
window->set_main_widget(text_widget);
|
window->set_main_widget(text_widget);
|
||||||
|
|
||||||
|
text_widget->editor().set_focus(true);
|
||||||
|
|
||||||
window->on_close_request = [&]() -> GWindow::CloseRequestDecision {
|
window->on_close_request = [&]() -> GWindow::CloseRequestDecision {
|
||||||
if (text_widget->request_close())
|
if (text_widget->request_close())
|
||||||
return GWindow::CloseRequestDecision::Close;
|
return GWindow::CloseRequestDecision::Close;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue