display modified buffers names when quit fails
This commit is contained in:
parent
792f0f7f2e
commit
3dd96565b3
17
src/main.cc
17
src/main.cc
|
@ -249,13 +249,24 @@ void quit(const CommandParameters& params, const Context& context)
|
|||
|
||||
if (not force)
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
for (auto& buffer : BufferManager::instance())
|
||||
{
|
||||
if (buffer.type() != Buffer::Type::Scratch and buffer.is_modified())
|
||||
{
|
||||
NCurses::print_status("modified buffer remaining");
|
||||
return;
|
||||
names.push_back(buffer.name());
|
||||
}
|
||||
if (not names.empty())
|
||||
{
|
||||
std::string message = "modified buffers remaining: [";
|
||||
for (auto it = names.begin(); it != names.end(); ++it)
|
||||
{
|
||||
if (it != names.begin())
|
||||
message += ", ";
|
||||
message += *it;
|
||||
}
|
||||
message += "]";
|
||||
NCurses::print_status(message);
|
||||
return;
|
||||
}
|
||||
}
|
||||
quit_requested = true;
|
||||
|
|
Loading…
Reference in New Issue
Block a user