+ /*
+ * The cost of clearing is:
+ * ncol - nblank + X
+ * The cost of straight update is:
+ * ncol - nsame
+ * We clear if: nblank - nsame > X
+ * X is the clreol overhead.
+ * So we make gain = nblank - nsame.
+ */
+ if ((--ns)->c_w == (--os)->c_w)
+ gain--;
+ else
+ best_gain--;
+ if (ns->c_w == ' ')
+ gain++;
+ if (gain >= best_gain) {
+ best = j;
+ best_gain = gain;
+ }