Show feedback to user when trying to quit with dirty buffers

This commit is contained in:
Igor Támara 2025-10-03 16:07:03 -05:00 committed by CJ van den Berg
parent 552417091d
commit d3e601e774
4 changed files with 58 additions and 13 deletions

View file

@ -273,7 +273,13 @@ const cmds = struct {
const Result = command.Result;
pub fn quit(self: *Self, _: Ctx) Result {
try self.check_all_not_dirty();
const logger = log.logger("buffer");
defer logger.deinit();
self.check_all_not_dirty() catch |err| {
const dirties = self.buffer_manager.number_of_dirties();
logger.print("There are {} unsaved buffer(s), use 'quit without saving' if not needed to save them", .{dirties});
return err;
};
try tp.self_pid().send("quit");
}
pub const quit_meta: Meta = .{ .description = "Quit" };