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