Exemplo n.º 1
0
int count_lines(Point pt1, Point pt2)
{
  if (cmp_point(pt1, pt2) > 0)
    swap_point(&pt1, &pt2);

  return pt2.n - pt1.n;
}
Exemplo n.º 2
0
static void calculate_highlight_region(Window *wp, Region *r, int *highlight)
{
  if ((wp != cur_wp
       && !lookup_bool_variable("highlight-nonselected-windows"))
      || (!wp->bp->mark)
      || (!transient_mark_mode())
      || (transient_mark_mode() && !(wp->bp->mark_active))) {
    *highlight = FALSE;
    return;
  }

  *highlight = TRUE;
  r->start = window_pt(wp);
  r->end = wp->bp->mark->pt;
  if (cmp_point(r->end, r->start) < 0)
    swap_point(&r->end, &r->start);
}
Exemplo n.º 3
0
int point_dist(Point pt1, Point pt2)
{
  int size = 0;
  Line *lp;

  if (cmp_point(pt1, pt2) > 0)
    swap_point(&pt1, &pt2);

  for (lp = pt1.p; ; lp = list_next(lp)) {
    size += astr_len(lp->item);

    if (lp == pt1.p)
      size -= pt1.o;

    if (lp == pt2.p) {
      size -= astr_len(lp->item) - pt2.o;
      break;
    }
    else
      size++;
  }

  return size;
}