aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2017-01-13 23:07:09 +0100
committerThomas White <taw@bitwiz.org.uk>2017-01-13 23:07:09 +0100
commiteeff763f780c06f5421c60dc9e9820f13aca91f4 (patch)
treeccfe463133cdcd227aebece3e8e8077e3976a5d0 /src
parent4495f3ca17aed37702c0576226d1e88875c24fe9 (diff)
Add a load of debug magic keys
Diffstat (limited to 'src')
-rw-r--r--src/frame.c2
-rw-r--r--src/frame.h2
-rw-r--r--src/sc_editor.c32
3 files changed, 34 insertions, 2 deletions
diff --git a/src/frame.c b/src/frame.c
index c8a3a42..d654965 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -894,7 +894,7 @@ static char *run_text(struct text_run *run)
}
-static __attribute__((unused)) void show_para(Paragraph *p)
+void show_para(Paragraph *p)
{
int i;
printf("Paragraph %p\n", p);
diff --git a/src/frame.h b/src/frame.h
index f594d05..4f8be33 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -114,7 +114,7 @@ extern double total_height(struct frame *fr);
extern Paragraph *last_open_para(struct frame *fr);
extern Paragraph *current_para(struct frame *fr);
extern void close_last_paragraph(struct frame *fr);
-
+extern void show_para(Paragraph *p);
extern void set_para_spacing(Paragraph *para, float space[4]);
extern double paragraph_height(Paragraph *para);
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 83bb90b..52bd340 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -1279,6 +1279,26 @@ static void paste_selection(SCEditor *e)
}
+static void debug_paragraphs(SCEditor *e)
+{
+ struct frame *fr = e->cursor_frame;
+ int i;
+
+ printf("Paragraphs in current frame:\n");
+ for ( i=0; i<fr->n_paras; i++ ) {
+ show_para(fr->paras[i]);
+ }
+}
+
+
+static void show_cursor_pos(SCEditor *e)
+{
+ fprintf(stderr, "Cursor: fr %p, para %i, pos %li, trail %i\n",
+ e->cursor_frame, e->cursor_para, (long int)e->cursor_pos,
+ e->cursor_trail);
+}
+
+
static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
SCEditor *e)
{
@@ -1353,6 +1373,18 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
full_rerender(e);
break;
+ case GDK_KEY_F6 :
+ show_cursor_pos(e);
+ break;
+
+ case GDK_KEY_F7 :
+ debug_paragraphs(e);
+ break;
+
+ case GDK_KEY_F8 :
+ show_sc_blocks(e->scblocks);
+ break;
+
case GDK_KEY_C :
case GDK_KEY_c :
if ( event->state == GDK_CONTROL_MASK ) {