From f6ff327f0b7b50b74328e448ce862f7212dcae23 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 16 Nov 2012 14:42:47 +0100 Subject: 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 --- main.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index 300d2f8..a6919c5 100644 --- a/main.cpp +++ b/main.cpp @@ -43,6 +43,34 @@ Interface::stdio_vmsg(MessageType type, const gchar *fmt, va_list ap) } } +void +Interface::process_notify(SCNotification *notify) +{ + switch (notify->nmhdr.code) { +#ifdef DEBUG + case SCN_SAVEPOINTREACHED: + g_printf("SCINTILLA SAVEPOINT REACHED\n"); + break; +#endif + case SCN_SAVEPOINTLEFT: +#ifdef DEBUG + g_printf("SCINTILLA SAVEPOINT LEFT\n"); +#endif + + if (!ring.current || ring.current->dirty) + break; + + undo.push_msg(SCI_SETSAVEPOINT); + undo_info_update(ring.current); + undo.push_var(ring.current->dirty); + ring.current->dirty = true; + info_update(ring.current); + break; + default: + break; + } +} + static inline void process_options(int &argc, char **&argv) { @@ -55,7 +83,7 @@ process_options(int &argc, char **&argv) GOptionContext *options; GOptionGroup *interface_group = interface.get_options(); - options = g_option_context_new("- Advanced interactive TECO"); + options = g_option_context_new("- " PACKAGE_STRING); g_option_context_add_main_entries(options, option_entries, NULL); if (interface_group) -- cgit v1.2.3