Changeset 7149832


Ignore:
Timestamp:
May 3, 2010, 9:08:14 PM (14 years ago)
Author:
Nelson Elhage <nelhage@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
d625cfd
Parents:
7ce30a9
git-author:
Nelson Elhage <nelhage@mit.edu> (04/28/10 00:14:48)
git-committer:
Nelson Elhage <nelhage@mit.edu> (05/03/10 21:08:14)
Message:
Visually indicate soft line-breaks in the editwin.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r7ce30a9 r7149832  
    4747static int oe_char_width(gunichar c, int column);
    4848static int oe_region_width(owl_editwin *e, int start, int end, int width);
    49 static int oe_find_display_line(owl_editwin *e, int *x, int index);
     49static int oe_find_display_line(owl_editwin *e, int *x, int index, int *hard);
    5050static void oe_insert_char(owl_editwin *e, gunichar c);
    5151static int owl_editwin_limit_maxcols(int v, int maxv);
     
    388388}
    389389
    390 static int oe_find_display_line(owl_editwin *e, int *x, int index)
     390static int oe_find_display_line(owl_editwin *e, int *x, int index, int *hard)
    391391{
    392392  int width = 0, cw;
     
    408408      if (x != NULL && *x == width)
    409409        *x = -1;
     410      if (hard != NULL) *hard = 0;
    410411      break;
    411412    }
     
    415416      if (width < e->wincols)
    416417        ++index; /* skip the newline */
     418      if (hard != NULL) *hard = 1;
    417419      break;
    418420    }
     
    423425      if (x != NULL && e->index > index)
    424426        *x = width + 1;
     427      if (hard != NULL) *hard = 1;
    425428      break;
    426429    }
     
    452455    last = e->index;
    453456    for (n = 0, i = e->index; i < index; n++)
    454       i = oe_find_display_line(e, NULL, i);
     457      i = oe_find_display_line(e, NULL, i, NULL);
    455458    count += n == 0 ? 1 : n;
    456459    if (count < goal)
     
    461464  /* if we overshot, backtrack */
    462465  for (n = 0; n < (count - goal); n++)
    463     e->topindex = oe_find_display_line(e, NULL, e->topindex);
     466    e->topindex = oe_find_display_line(e, NULL, e->topindex, NULL);
    464467
    465468  oe_restore_excursion(e, &x);
     
    483486void owl_editwin_redisplay(owl_editwin *e)
    484487{
    485   int x = -1, y = -1, t;
     488  int x = -1, y = -1, t, hard;
    486489  int line, index, lineindex, times = 0;
    487490
     
    497500      lineindex = index;
    498501      t = -1;
    499       index = oe_find_display_line(e, &t, lineindex);
     502      index = oe_find_display_line(e, &t, lineindex, &hard);
    500503      if (x == -1 && t != -1)
    501504        x = t, y = line;
     
    518521            oe_mvaddnec(e, line, 0, oe_region_width(e, lineindex, index, 0));
    519522        }
     523        if (!hard)
     524          waddch(e->curswin, '\\');
    520525      }
    521526      line++;
Note: See TracChangeset for help on using the changeset viewer.