aboutsummaryrefslogtreecommitdiffhomepage
path: root/qbuffers.h
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-16 14:42:47 +0100
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-11-16 14:42:47 +0100
commitf6ff327f0b7b50b74328e448ce862f7212dcae23 (patch)
tree4a773dcb9120d6a7fb96fce92422667e8702dbdf /qbuffers.h
parent0a8f940ffe1aaf77ba12ccc02d4e382be2118151 (diff)
downloadsciteco-f6ff327f0b7b50b74328e448ce862f7212dcae23.tar.gz
keep a buffer dirty flag and display infos about the current buffer in the interfaces (including the dirty flag)
* was a bit tricky because the Scintilla SAVEPOINTS cannot be (fully) used * when a file is loaded or saved, a Scintilla SAVEPOINT is set * SAVEPOINTLEFT notifications are used to set a buffer dirty * SAVEPOINTREACHED notifications are useless since Scintilla does not consider the saves themselves to be undoable * GTK interface displays infos in window title bar * NCURSES interface has also been updated and cleaned up a bit. Infos are displayed in a new info line. * NCURSES: fixed popup display after terminal resizing
Diffstat (limited to 'qbuffers.h')
-rw-r--r--qbuffers.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/qbuffers.h b/qbuffers.h
index 61aab64..8ceaffa 100644
--- a/qbuffers.h
+++ b/qbuffers.h
@@ -71,10 +71,12 @@ public:
{
interface.ssm(SCI_SETDOCPOINTER, 0, (sptr_t)get_document());
interface.ssm(SCI_GOTOPOS, dot);
+ interface.info_update(this);
}
inline void
undo_edit(void)
{
+ interface.undo_info_update(this);
undo.push_msg(SCI_GOTOPOS, dot);
undo.push_msg(SCI_SETDOCPOINTER, 0, (sptr_t)get_document());
}
@@ -157,12 +159,15 @@ public:
gint savepoint_id;
+ /* set by Interfaces using Scintilla notifications */
+ bool dirty;
+
private:
typedef void document;
document *doc;
public:
- Buffer() : filename(NULL), dot(0), savepoint_id(0)
+ Buffer() : filename(NULL), dot(0), savepoint_id(0), dirty(false)
{
doc = (document *)interface.ssm(SCI_CREATEDOCUMENT);
}
@@ -184,6 +189,7 @@ public:
gchar *resolved = get_absolute_path(filename);
g_free(Buffer::filename);
Buffer::filename = resolved;
+ interface.info_update(this);
}
inline void
@@ -191,10 +197,12 @@ public:
{
interface.ssm(SCI_SETDOCPOINTER, 0, (sptr_t)doc);
interface.ssm(SCI_GOTOPOS, dot);
+ interface.info_update(this);
}
inline void
undo_edit(void)
{
+ interface.undo_info_update(this);
undo.push_msg(SCI_GOTOPOS, dot);
undo.push_msg(SCI_SETDOCPOINTER, 0, (sptr_t)doc);
}