mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:58:13 +00:00
TextEditor: Allow starting with a file argument that doesn't exist
If TextEditor is started with an argument for a file that doesn't exist, we now allow editing it. The file will be created once it is saved.
This commit is contained in:
parent
36bfc912fc
commit
8241a6c8eb
3 changed files with 28 additions and 14 deletions
|
@ -693,6 +693,13 @@ bool MainWidget::read_file_and_close(int fd, String const& path)
|
|||
return true;
|
||||
}
|
||||
|
||||
void MainWidget::open_nonexistent_file(String const& path)
|
||||
{
|
||||
m_editor->set_text({});
|
||||
set_path(path);
|
||||
m_editor->set_focus(true);
|
||||
}
|
||||
|
||||
bool MainWidget::request_close()
|
||||
{
|
||||
if (!editor().document().is_modified())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue