ref: 681cf1fceba4ea761a0b16612e28381167ef7752
parent: dcb69af7ed90daff59d8ae100e8d1d2c77b1c42c
author: Ali Gholami Rudi <[email protected]>
date: Fri May 26 06:19:00 EDT 2017
reg: .ta clears all previous tab stops
--- a/reg.c
+++ b/reg.c
@@ -374,11 +374,17 @@
void tr_ta(char **args)
{
int i;
- char *s;
- for (i = 0; i < NARGS && args[i]; i++) {
- env->tabs[i] = eval_re(args[i], i > 0 ? env->tabs[i - 1] : 0, 'm');
- s = args[i][0] ? strchr(args[i], '\0') - 1 : "";
- env->tabs_type[i] = strchr("LRC", *s) ? *s : 'L';
+ int c;
+ for (i = 0; i < NTABS; i++) {
+ if (i + 1 < NARGS && args[i + 1]) {
+ char *a = args[i + 1];
+ env->tabs[i] = eval_re(a, i > 0 ? env->tabs[i - 1] : 0, 'm');
+ c = a[0] ? (unsigned char) strchr(a, '\0')[-1] : 0;
+ env->tabs_type[i] = strchr("LRC", c) ? c : 'L';
+ } else {
+ env->tabs[i] = 0;
+ env->tabs_type[i] = 0;
+ }
}
}