Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ for details

* Resolve crash when user tries to switch top or bottom line outside of scope
* Resolved crash when the user tries to `delete word` past the end of a line
* Resolved defect that allowed unnamed buffers to be saved as `NO NAME`

### v0.0.3 | 17/Mar/2026
* Use `;e` to open a different file from within iris
Expand Down
9 changes: 7 additions & 2 deletions src/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,8 +620,10 @@ bool Controller::parse_command() {

} else if (cmd == ";wq") {
// This just does the same as ;w and ;q
std::ignore = write_to_file(view.get_active_model(), std::nullopt);
return quit_app(false);
WriteData data = write_to_file(view.get_active_model(), std::nullopt);
if (data.valid) { return quit_app(false); }
view.display_message("Could not save file: no filename specified", rawterm::Colors::red);
return false;

} else if (cmd == ";wa") {
WriteAllData write_data = write_all();
Expand All @@ -644,6 +646,9 @@ bool Controller::parse_command() {
std::string msg =
std::format("Saved {} bytes ({} lines)", file_write.bytes, file_write.lines);
view.display_message(msg, rawterm::Colors::green);
} else {
view.display_message(
"Could not save file: no filename specified", rawterm::Colors::red);
}

} else if (cmd == ";qa") {
Expand Down
5 changes: 3 additions & 2 deletions src/text_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@
}

[[nodiscard]] WriteData write_to_file(Model* model, std::optional<std::string> filename_input) {
if (!filename_input.has_value() && model->filename == "") { return WriteData(); }

if (!filename_input.has_value() && (model->filename == "NO NAME" || model->filename == "")) {
return WriteData();
}
if (filename_input.has_value()) { model->filename = filename_input.value(); }

std::ofstream out(model->filename);
Expand Down
2 changes: 1 addition & 1 deletion tests/fixture/test_file_2.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
testtest
testtesttest
2 changes: 1 addition & 1 deletion tests/integration/command_mode_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def test_write_all_command(r: TmuxRunner):
assert first_line[0] == "h"

r.press("u")
time.sleep(0.1)
r.iris_cmd("wa")
time.sleep(0.1)

with open(r.filename, "r") as f:
first_line = f.readlines()[0]
Expand Down
Loading