ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/tools/edi.git/commit/?id=aae8ea89bbf49845d1403e6d9ea73ee340b8dadf

commit aae8ea89bbf49845d1403e6d9ea73ee340b8dadf
Author: Andy Williams <[email protected]>
Date:   Sat Feb 14 23:55:05 2015 +0000

    editor: Let's reduce calls to saving files or resetting highlights.
    
    Keep an eye on what has to be saved.
    Only re-run clang parsing if we've actually saved recently
---
 src/bin/editor/edi_editor.c |  7 +++++++
 src/bin/editor/edi_editor.h | 15 +++++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/bin/editor/edi_editor.c b/src/bin/editor/edi_editor.c
index 4976d8f..ab49573 100644
--- a/src/bin/editor/edi_editor.c
+++ b/src/bin/editor/edi_editor.c
@@ -64,6 +64,10 @@ _reset_highlight(Edi_Editor *editor);
 void
 edi_editor_save(Edi_Editor *editor)
 {
+   if (!editor->modified)
+     return;
+
+   editor->save_time = time(NULL);
    edi_mainview_save();
    _reset_highlight(editor);
 
@@ -701,7 +705,10 @@ _reset_highlight(Edi_Editor *editor)
 {
    if (!editor->show_highlight)
      return;
+   if (editor->highlight_time != 0 && editor->save_time <= 
editor->highlight_time)
+     return;
 
+   editor->highlight_time = time(NULL);
    _update_highlight_window(editor);
 
 #if HAVE_LIBCLANG
diff --git a/src/bin/editor/edi_editor.h b/src/bin/editor/edi_editor.h
index 5082cb4..bbab038 100644
--- a/src/bin/editor/edi_editor.h
+++ b/src/bin/editor/edi_editor.h
@@ -1,11 +1,12 @@
-#ifndef _UI_H
-#define _UI_H
-
-#include <Evas.h>
+#ifndef _EDI_EDITOR_H
+#define _EDI_EDITOR_H
 
 #if HAVE_LIBCLANG
 #include <clang-c/Index.h>
 #endif
+#include <time.h>
+
+#include <Evas.h>
 
 #include "mainview/edi_mainview_item.h"
 
@@ -45,8 +46,6 @@ struct _Edi_Editor
    Eina_Bool modified;
    Ecore_Timer *save_timer;
 
-   /* Add new members here. */
-
 #if HAVE_LIBCLANG
    /* Clang */
    CXIndex idx;
@@ -59,6 +58,10 @@ struct _Edi_Editor
    Ecore_Timer *delay_highlight;
    int format_start, format_end, format_line;
    Eina_Bool show_highlight;
+
+   time_t save_time, highlight_time;
+
+   /* Add new members here. */
 };
 
 /**

-- 


Reply via email to