if (b->parent()) {
// This is a child document, just close the tab
// after saving but keep the file loaded.
- if (!closeBuffer(*b, tolastopened, is_active_wa))
+ if (!closeBuffer(*b, false, tolastopened, is_active_wa))
return false;
continue;
}
Buffer * c = *it;
// If a child is dirty, do not close
// without user intervention
- if (!closeBuffer(*c, false))
+ //FIXME: should buffers be closed or not?
+ if (!closeBuffer(*c, false, false))
return false;
}
}
// closeBuffer() needs buffer workArea still alive and
// set as currrent one, and destroys it
- if (b && !closeBuffer(*b, tolastopened, is_active_wa))
+ if (b && !closeBuffer(*b, true, tolastopened, is_active_wa))
return false;
}
}
bool GuiView::closeBuffer()
{
Buffer * buf = buffer();
- return buf && closeBuffer(*buf);
+ return buf && closeBuffer(*buf, !buf->parent());
}
-bool GuiView::closeBuffer(Buffer & buf, bool tolastopened, bool mark_active)
+bool GuiView::closeBuffer(Buffer & buf, bool close_buffer,
+ bool tolastopened, bool mark_active)
{
// goto bookmark to update bookmark pit.
//FIXME: we should update only the bookmarks related to this buffer!
// is opened as well
if (tolastopened)
theSession().lastOpened().add(buf.fileName(), mark_active);
- if (buf.parent())
- // Don't close child documents.
+ if (!close_buffer)
removeWorkArea(currentMainWorkArea());
else
theBufferList().release(&buf);
///
bool saveBuffer(Buffer & b);
///
- bool closeBuffer(Buffer & buf, bool tolastopened = false,
- bool mark_active = false);
+ bool closeBuffer(Buffer & buf, bool keep_buffer,
+ bool tolastopened = false, bool mark_active = false);
///
bool saveBufferIfNeeded(Buffer & buf);
///