aboutsummaryrefslogtreecommitdiff
path: root/src/wrap.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2014-09-27 00:24:41 +0200
committerThomas White <taw@bitwiz.org.uk>2014-09-27 00:24:41 +0200
commitab6af6b34c9e5fdfa8cff44fa0f78f9c34ed28ef (patch)
tree8b655e9b7befeff6e370b278bd2c20dbb2bf3be3 /src/wrap.c
parent217a194d10d404d1b78dec1b8ea89cfcc123ac29 (diff)
SCEditor, part I
Diffstat (limited to 'src/wrap.c')
-rw-r--r--src/wrap.c146
1 files changed, 0 insertions, 146 deletions
diff --git a/src/wrap.c b/src/wrap.c
index 6d43557..1f7a77a 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -167,152 +167,6 @@ void get_cursor_pos(struct wrap_box *box, int pos,
}
-void move_cursor_back(struct presentation *p)
-{
- int retreat = 0;
- signed int cp, cb, cl;
- struct wrap_line *line;
- struct wrap_box *box;
-
- cp = p->cursor_pos;
- cb = p->cursor_box;
- cl = p->cursor_line;
-
- line = &p->cursor_frame->lines[p->cursor_line];
- box = &line->boxes[p->cursor_box];
- if ( box->type == WRAP_BOX_PANGO ) {
-
- if ( cp == 0 ) {
- retreat = 1;
- } else {
- cp--;
- }
-
- } else {
- cp--;
- if ( cp < 0 ) retreat = 1;
- }
-
- if ( retreat ) {
-
- do {
-
- cb--;
-
- if ( cb < 0 ) {
- cl--;
- if ( cl < 0 ) return;
- p->cursor_line = cl;
- line = &p->cursor_frame->lines[cl];
- cb = line->n_boxes - 1;
- }
-
- } while ( !line->boxes[cb].editable );
-
- p->cursor_box = cb;
- box = &line->boxes[cb];
- if ( box->type == WRAP_BOX_PANGO ) {
- cp = box->len_chars;
- if ( box->space == WRAP_SPACE_NONE ) {
- cp--;
- }
- } else {
- cp = 1;
- }
-
- }
- p->cursor_pos = cp;
-}
-
-
-void cur_box_diag(struct presentation *p)
-{
- int sln, sbx, sps;
- struct frame *fr;
-
- fr = p->cursor_frame;
- sln = p->cursor_line;
- sbx = p->cursor_box;
- sps = p->cursor_pos;
-
- struct wrap_box *sbox = &p->cursor_frame->lines[sln].boxes[sbx];
-
- printf("line/box/pos: [%i of %i]/[%i of %i]/[%i of %i]\n",
- sln, fr->n_lines,
- sbx, p->cursor_frame->lines[sln].n_boxes,
- sps, sbox->len_chars);
- printf("box type is %i, space type is %i\n", sbox->type, sbox->space);
- if ( sbox->type == WRAP_BOX_NOTHING ) {
- printf("Warning: in a nothing box!\n");
- }
-}
-
-
-void advance_cursor(struct presentation *p)
-{
- int advance = 0;
- signed int cp, cb, cl;
- struct wrap_line *line = &p->cursor_frame->lines[p->cursor_line];
- struct wrap_box *box = &line->boxes[p->cursor_box];
-
- cp = p->cursor_pos;
- cb = p->cursor_box;
- cl = p->cursor_line;
-
- switch ( box->type ) {
-
- case WRAP_BOX_PANGO:
- if ( cp+1 > box->len_chars ) {
- advance = 1;
- } else {
- cp++;
- }
- break;
-
- case WRAP_BOX_NOTHING:
- case WRAP_BOX_SENTINEL:
- advance = 1;
- break;
-
- case WRAP_BOX_IMAGE:
- cp++;
- if ( cp > 1 ) advance = 1;
- break;
-
- }
-
- if ( advance ) {
-
- do {
-
- cb++;
- cp = 0;
-
- if ( box->space == WRAP_SPACE_NONE ) {
- cp = 1;
- }
-
- if ( cb >= line->n_boxes ) {
- cl++;
- if ( cl >= p->cursor_frame->n_lines ) {
- /* Give up - could not move */
- return;
- }
- line = &p->cursor_frame->lines[cl];
- cb = 0;
- cp = 0;
- }
-
- } while ( !line->boxes[cb].editable );
-
- p->cursor_line = cl;
- p->cursor_box = cb;
-
- }
- p->cursor_pos = cp;
-}
-
-
static int find_cursor_line(struct frame *fr, double yposd, int *end)
{
int i;