+ if (value(WRAPMARGIN) &&
+ (outcol >= OCOLUMNS - value(WRAPMARGIN) ||
+ backsl && outcol==0) &&
+ commch != 'r') {
+ /*
+ * At end of word and hit wrapmargin.
+ * Move the word to next line and keep going.
+ */
+ wdkind = 1;
+ *gcursor++ = c;
+ if (backsl)
+ *gcursor++ = getkey();
+ *gcursor = 0;
+ /*
+ * Find end of previous word if we are past it.
+ */
+ for (cp=gcursor; cp>ogcursor && isspace(cp[-1]); cp--)
+ ;
+ if (outcol+(backsl?OCOLUMNS:0) - (gcursor-cp) >= OCOLUMNS - value(WRAPMARGIN)) {
+ /*
+ * Find beginning of previous word.
+ */
+ for (; cp>ogcursor && !isspace(cp[-1]); cp--)
+ ;
+ if (cp <= ogcursor) {
+ /*
+ * There is a single word that
+ * is too long to fit. Just
+ * let it pass, but beep for
+ * each new letter to warn
+ * the luser.
+ */
+ c = *--gcursor;
+ *gcursor = 0;
+ beep();
+ goto dontbreak;
+ }
+ /*
+ * Save it for next line.
+ */
+ macpush(cp, 0);
+ cp--;
+ }
+ macpush("\n", 0);
+ /*
+ * Erase white space before the word.
+ */
+ while (cp > ogcursor && isspace(cp[-1]))
+ cp--; /* skip blank */
+ gobblebl = 3;
+ goto vbackup;