int count_lines(Point pt1, Point pt2) { if (cmp_point(pt1, pt2) > 0) swap_point(&pt1, &pt2); return pt2.n - pt1.n; }
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); }
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; }