diff options
author | Thomas White <taw@bitwiz.org.uk> | 2015-11-08 23:12:50 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2015-11-08 23:12:50 +0100 |
commit | 9fa18b75c1354989dabf682788b9ea41fe28c707 (patch) | |
tree | c3e2a7bdcc64f1d531bb420e25f117fa65e0c7bc /src/sc_editor.c | |
parent | 4f2a324e715ea835b6be56579d8f8380a9e7370d (diff) |
WIP on breaks
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r-- | src/sc_editor.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index 11ec724..f1af23f 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -778,6 +778,28 @@ void insert_scblock(SCBlock *scblock, SCEditor *e) static void update_local(SCEditor *e, struct frame *fr, int line, int bn) { struct wrap_box *box = &fr->lines[line].boxes[bn]; + const char *text; + size_t len_bytes; + int len_chars; + PangoLogAttr *log_attrs; + int offs; + + text = sc_block_contents(box->scblock); + len_bytes = strlen(text); + len_chars = g_utf8_strlen(text, -1); + + log_attrs = malloc((len_chars+1)*sizeof(PangoLogAttr)); + if ( log_attrs == NULL ) return; + pango_get_log_attrs(text, len_bytes, -1, e->lang, + log_attrs, len_chars+1); + + offs = box->offs_char + e->cursor_pos; + + if ( log_attrs[offs].is_line_break ) { + printf("Just typed a break!\n"); + } + + free(log_attrs); /* Shape the box again */ shape_box(box->cf->cf); |