Lines 275-280
Link Here
|
275 |
int showmatch; /* Showmatch set on this character. */ |
275 |
int showmatch; /* Showmatch set on this character. */ |
276 |
int wm_set, wm_skip; /* Wrapmargin happened, blank skip flags. */ |
276 |
int wm_set, wm_skip; /* Wrapmargin happened, blank skip flags. */ |
277 |
int max, tmp; |
277 |
int max, tmp; |
|
|
278 |
int nochange; |
278 |
CHAR_T *p; |
279 |
CHAR_T *p; |
279 |
|
280 |
|
280 |
gp = sp->gp; |
281 |
gp = sp->gp; |
Lines 458-463
Link Here
|
458 |
/* Other text input mode setup. */ |
459 |
/* Other text input mode setup. */ |
459 |
quote = Q_NOTSET; |
460 |
quote = Q_NOTSET; |
460 |
carat = C_NOTSET; |
461 |
carat = C_NOTSET; |
|
|
462 |
nochange = 0; |
461 |
FL_INIT(is_flags, |
463 |
FL_INIT(is_flags, |
462 |
LF_ISSET(TXT_SEARCHINCR) ? IS_RESTART | IS_RUNNING : 0); |
464 |
LF_ISSET(TXT_SEARCHINCR) ? IS_RESTART | IS_RUNNING : 0); |
463 |
filec_redraw = hexcnt = showmatch = 0; |
465 |
filec_redraw = hexcnt = showmatch = 0; |
Lines 748-763
Link Here
|
748 |
owrite = tp->owrite; |
750 |
owrite = tp->owrite; |
749 |
insert = tp->insert; |
751 |
insert = tp->insert; |
750 |
if (LF_ISSET(TXT_REPLACE) && owrite != 0) { |
752 |
if (LF_ISSET(TXT_REPLACE) && owrite != 0) { |
751 |
for (p = tp->lb + tp->cno; owrite > 0 && isblank(*p); |
753 |
for (p = tp->lb + tp->cno; owrite > 0 && ISBLANK(*p); |
752 |
++p, --owrite, ++tp->R_erase); |
754 |
++p, --owrite, ++tp->R_erase); |
753 |
if (owrite == 0) |
755 |
if (owrite == 0) |
754 |
for (; insert > 0 && isblank(*p); |
756 |
for (; insert > 0 && ISBLANK(*p); |
755 |
++p, ++tp->R_erase, --insert); |
757 |
++p, ++tp->R_erase, --insert); |
756 |
} else { |
758 |
} else { |
757 |
p = tp->lb + tp->cno + owrite; |
759 |
p = tp->lb + tp->cno + owrite; |
758 |
if (O_ISSET(sp, O_AUTOINDENT)) |
760 |
if (O_ISSET(sp, O_AUTOINDENT)) |
759 |
for (; insert > 0 && |
761 |
for (; insert > 0 && |
760 |
isblank(*p); ++p, --insert); |
762 |
ISBLANK(*p); ++p, --insert); |
761 |
owrite = 0; |
763 |
owrite = 0; |
762 |
} |
764 |
} |
763 |
|
765 |
|
Lines 785-791
Link Here
|
785 |
* characters may have been erased. |
787 |
* characters may have been erased. |
786 |
*/ |
788 |
*/ |
787 |
if (LF_ISSET(TXT_AUTOINDENT)) { |
789 |
if (LF_ISSET(TXT_AUTOINDENT)) { |
788 |
if (carat == C_NOCHANGE) { |
790 |
if (nochange) { |
|
|
791 |
nochange = 0; |
789 |
if (v_txt_auto(sp, OOBLNO, &ait, ait.ai, ntp)) |
792 |
if (v_txt_auto(sp, OOBLNO, &ait, ait.ai, ntp)) |
790 |
goto err; |
793 |
goto err; |
791 |
FREE_SPACEW(sp, ait.lb, ait.lb_len); |
794 |
FREE_SPACEW(sp, ait.lb, ait.lb_len); |
Lines 958-964
Link Here
|
958 |
MEMMOVEW(ait.lb, tp->lb, tp->ai); |
961 |
MEMMOVEW(ait.lb, tp->lb, tp->ai); |
959 |
ait.ai = ait.len = tp->ai; |
962 |
ait.ai = ait.len = tp->ai; |
960 |
|
963 |
|
961 |
carat = C_NOCHANGE; |
964 |
carat = C_NOTSET; |
|
|
965 |
nochange = 1; |
962 |
goto leftmargin; |
966 |
goto leftmargin; |
963 |
case C_ZEROSET: /* 0^D */ |
967 |
case C_ZEROSET: /* 0^D */ |
964 |
if (tp->ai == 0 || tp->cno > tp->ai + tp->offset + 1) |
968 |
if (tp->ai == 0 || tp->cno > tp->ai + tp->offset + 1) |
Lines 1075-1081
Link Here
|
1075 |
} |
1079 |
} |
1076 |
|
1080 |
|
1077 |
/* Skip over trailing space characters. */ |
1081 |
/* Skip over trailing space characters. */ |
1078 |
while (tp->cno > max && isblank(tp->lb[tp->cno - 1])) { |
1082 |
while (tp->cno > max && ISBLANK(tp->lb[tp->cno - 1])) { |
1079 |
--tp->cno; |
1083 |
--tp->cno; |
1080 |
++tp->owrite; |
1084 |
++tp->owrite; |
1081 |
} |
1085 |
} |
Lines 1108-1114
Link Here
|
1108 |
++tp->owrite; |
1112 |
++tp->owrite; |
1109 |
if (FL_ISSET(is_flags, IS_RUNNING)) |
1113 |
if (FL_ISSET(is_flags, IS_RUNNING)) |
1110 |
tp->lb[tp->cno] = ' '; |
1114 |
tp->lb[tp->cno] = ' '; |
1111 |
if (isblank(tp->lb[tp->cno - 1])) |
1115 |
if (ISBLANK(tp->lb[tp->cno - 1])) |
1112 |
break; |
1116 |
break; |
1113 |
} |
1117 |
} |
1114 |
else { |
1118 |
else { |
Lines 1117-1123
Link Here
|
1117 |
++tp->owrite; |
1121 |
++tp->owrite; |
1118 |
if (FL_ISSET(is_flags, IS_RUNNING)) |
1122 |
if (FL_ISSET(is_flags, IS_RUNNING)) |
1119 |
tp->lb[tp->cno] = ' '; |
1123 |
tp->lb[tp->cno] = ' '; |
1120 |
if (isblank(tp->lb[tp->cno - 1])) |
1124 |
if (ISBLANK(tp->lb[tp->cno - 1])) |
1121 |
break; |
1125 |
break; |
1122 |
} |
1126 |
} |
1123 |
if (tp->cno > max) |
1127 |
if (tp->cno > max) |
Lines 1128-1134
Link Here
|
1128 |
if (FL_ISSET(is_flags, IS_RUNNING)) |
1132 |
if (FL_ISSET(is_flags, IS_RUNNING)) |
1129 |
tp->lb[tp->cno] = ' '; |
1133 |
tp->lb[tp->cno] = ' '; |
1130 |
if (tmp != inword(tp->lb[tp->cno - 1]) |
1134 |
if (tmp != inword(tp->lb[tp->cno - 1]) |
1131 |
|| isblank(tp->lb[tp->cno - 1])) |
1135 |
|| ISBLANK(tp->lb[tp->cno - 1])) |
1132 |
break; |
1136 |
break; |
1133 |
} |
1137 |
} |
1134 |
} |
1138 |
} |
Lines 1287-1293
Link Here
|
1287 |
goto resolve; |
1291 |
goto resolve; |
1288 |
} |
1292 |
} |
1289 |
} |
1293 |
} |
1290 |
if (isblank(evp->e_c) && UNMAP_TST) |
1294 |
if (ISBLANK(evp->e_c) && UNMAP_TST) |
1291 |
txt_unmap(sp, tp, &ec_flags); |
1295 |
txt_unmap(sp, tp, &ec_flags); |
1292 |
} |
1296 |
} |
1293 |
if (abb != AB_NOTSET) |
1297 |
if (abb != AB_NOTSET) |
Lines 1337-1343
Link Here
|
1337 |
if (txt_margin(sp, tp, &wmt, &tmp, flags)) |
1341 |
if (txt_margin(sp, tp, &wmt, &tmp, flags)) |
1338 |
goto err; |
1342 |
goto err; |
1339 |
if (tmp) { |
1343 |
if (tmp) { |
1340 |
if (isblank(evp->e_c)) |
1344 |
if (ISBLANK(evp->e_c)) |
1341 |
wm_skip = 1; |
1345 |
wm_skip = 1; |
1342 |
wm_set = 1; |
1346 |
wm_set = 1; |
1343 |
goto k_cr; |
1347 |
goto k_cr; |
Lines 1503-1509
Link Here
|
1503 |
off = tp->cno - 1; /* Previous character. */ |
1507 |
off = tp->cno - 1; /* Previous character. */ |
1504 |
p = tp->lb + off; |
1508 |
p = tp->lb + off; |
1505 |
len = 1; /* One character test. */ |
1509 |
len = 1; /* One character test. */ |
1506 |
if (off == tp->offset || isblank(p[-1])) |
1510 |
if (off == tp->offset || ISBLANK(p[-1])) |
1507 |
goto search; |
1511 |
goto search; |
1508 |
if (inword(p[-1])) /* Move backward to change. */ |
1512 |
if (inword(p[-1])) /* Move backward to change. */ |
1509 |
for (;;) { |
1513 |
for (;;) { |
Lines 1515-1521
Link Here
|
1515 |
for (;;) { |
1519 |
for (;;) { |
1516 |
--off; --p; ++len; |
1520 |
--off; --p; ++len; |
1517 |
if (off == tp->offset || |
1521 |
if (off == tp->offset || |
1518 |
inword(p[-1]) || isblank(p[-1])) |
1522 |
inword(p[-1]) || ISBLANK(p[-1])) |
1519 |
break; |
1523 |
break; |
1520 |
} |
1524 |
} |
1521 |
|
1525 |
|
Lines 1639-1645
Link Here
|
1639 |
|
1643 |
|
1640 |
/* Find the beginning of this "word". */ |
1644 |
/* Find the beginning of this "word". */ |
1641 |
for (off = tp->cno - 1, p = tp->lb + off, len = 0;; --p, --off) { |
1645 |
for (off = tp->cno - 1, p = tp->lb + off, len = 0;; --p, --off) { |
1642 |
if (isblank(*p)) { |
1646 |
if (ISBLANK(*p)) { |
1643 |
++p; |
1647 |
++p; |
1644 |
break; |
1648 |
break; |
1645 |
} |
1649 |
} |
Lines 1706-1712
Link Here
|
1706 |
|
1710 |
|
1707 |
/* Figure out the last <blank> screen column. */ |
1711 |
/* Figure out the last <blank> screen column. */ |
1708 |
for (p = tp->lb, scno = 0, len = tp->len, |
1712 |
for (p = tp->lb, scno = 0, len = tp->len, |
1709 |
spaces = tab_after_sp = 0; len-- && isblank(*p); ++p) |
1713 |
spaces = tab_after_sp = 0; len-- && ISBLANK(*p); ++p) |
1710 |
if (*p == '\t') { |
1714 |
if (*p == '\t') { |
1711 |
if (spaces) |
1715 |
if (spaces) |
1712 |
tab_after_sp = 1; |
1716 |
tab_after_sp = 1; |
Lines 1781-1787
Link Here
|
1781 |
|
1785 |
|
1782 |
/* Count whitespace characters. */ |
1786 |
/* Count whitespace characters. */ |
1783 |
for (p = t; len > 0; ++p, --len) |
1787 |
for (p = t; len > 0; ++p, --len) |
1784 |
if (!isblank(*p)) |
1788 |
if (!ISBLANK(*p)) |
1785 |
break; |
1789 |
break; |
1786 |
|
1790 |
|
1787 |
/* Set count, check for no indentation. */ |
1791 |
/* Set count, check for no indentation. */ |
Lines 2008-2014
Link Here
|
2008 |
} else |
2012 |
} else |
2009 |
retry: for (len = 0, |
2013 |
retry: for (len = 0, |
2010 |
off = tp->cno - 1, p = tp->lb + off;; --off, --p) { |
2014 |
off = tp->cno - 1, p = tp->lb + off;; --off, --p) { |
2011 |
if (isblank(*p)) { |
2015 |
if (ISBLANK(*p)) { |
2012 |
++p; |
2016 |
++p; |
2013 |
break; |
2017 |
break; |
2014 |
} |
2018 |
} |
Lines 2783-2789
Link Here
|
2783 |
|
2787 |
|
2784 |
/* Find the nearest previous blank. */ |
2788 |
/* Find the nearest previous blank. */ |
2785 |
for (off = tp->cno - 1, p = tp->lb + off, len = 0;; --off, --p, ++len) { |
2789 |
for (off = tp->cno - 1, p = tp->lb + off, len = 0;; --off, --p, ++len) { |
2786 |
if (isblank(*p)) { |
2790 |
if (ISBLANK(*p)) { |
2787 |
wp = p + 1; |
2791 |
wp = p + 1; |
2788 |
break; |
2792 |
break; |
2789 |
} |
2793 |
} |
Lines 2835-2841
Link Here
|
2835 |
* Delete any trailing whitespace from the current line. |
2839 |
* Delete any trailing whitespace from the current line. |
2836 |
*/ |
2840 |
*/ |
2837 |
for (;; --p, --off) { |
2841 |
for (;; --p, --off) { |
2838 |
if (!isblank(*p)) |
2842 |
if (!ISBLANK(*p)) |
2839 |
break; |
2843 |
break; |
2840 |
--tp->cno; |
2844 |
--tp->cno; |
2841 |
--tp->len; |
2845 |
--tp->len; |