enventor - base code for auto-indentation

This commit is contained in:
ChunEon Park 2013-08-18 20:43:01 +09:00
parent aeed6f742d
commit 5b3127f228
6 changed files with 37 additions and 2 deletions

View File

@ -21,7 +21,8 @@ enventor_SOURCES = \
statusbar.c \
syntax_color.c \
ctxpopup.c \
syntax_helper.c
syntax_helper.c \
indent.c
# QuickLaunch
enventorql_SOURCES = $(enventor_SOURCES)

27
src/bin/indent.c Normal file
View File

@ -0,0 +1,27 @@
#include <Elementary.h>
#include "common.h"
struct indent_s
{
Eina_Strbuf *strbuf;
};
indent_data *
indent_init(Eina_Strbuf *strbuf)
{
indent_data *id = malloc(sizeof(indent_data));
return id;
}
void
indent_term(indent_data *id)
{
free(id);
}
int
indent_next_line_step(indent_data *id)
{
}

View File

@ -5,6 +5,7 @@
struct syntax_helper_s
{
color_data *cd;
indent_data *id;
Eina_Strbuf *strbuf;
Ecore_Timer *buf_flush_timer;
};
@ -30,6 +31,7 @@ syntax_init()
sh->buf_flush_timer = ecore_timer_add(1800, buf_flush_timer_cb, sh);
sh->cd = color_init(sh->strbuf);
sh->id = indent_init(sh->strbuf);
return sh;
}
@ -38,6 +40,7 @@ void
syntax_term(syntax_helper *sh)
{
color_term(sh->cd);
indent_term(sh->id);
if (sh->buf_flush_timer) ecore_timer_del(sh->buf_flush_timer);
eina_strbuf_free(sh->strbuf);

View File

@ -35,6 +35,7 @@ typedef struct parser_s parser_data;
typedef struct attr_value_s attr_value;
typedef struct dummy_obj_s dummy_obj;
typedef struct syntax_helper_s syntax_helper;
typedef struct indent_s indent_data;
#include "edc_editor.h"
#include "menu.h"
@ -47,5 +48,6 @@ typedef struct syntax_helper_s syntax_helper;
#include "panes.h"
#include "dummy_obj.h"
#include "ctxpopup.h"
#include "indent.h"
#endif

2
src/include/indent.h Normal file
View File

@ -0,0 +1,2 @@
indent_data *indent_init(Eina_Strbuf *strbuf);
void indent_term(indent_data *id);

View File

@ -1,4 +1,4 @@
color_data *color_init();
color_data *color_init(Eina_Strbuf *strbuf);
void color_term(color_data *cd);
const char *color_cancel(color_data *cd, const char *str, int length);
const char *color_apply(color_data *cd, const char *str, int length,