Commit 6d690a39 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

New tabsize code, Im very excited

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@157 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 134 additions and 134 deletions
+134 -134
This diff is collapsed.
...@@ -29,7 +29,7 @@ extern int current_x, current_y, posible_max, totlines; ...@@ -29,7 +29,7 @@ extern int current_x, current_y, posible_max, totlines;
extern int placewewant; extern int placewewant;
extern int mark_beginx, samelinewrap; extern int mark_beginx, samelinewrap;
extern int totsize, temp_opt; extern int totsize, temp_opt;
extern int fill, flags; extern int fill, flags,tabsize;
extern WINDOW *edit, *topwin, *bottomwin; extern WINDOW *edit, *topwin, *bottomwin;
extern char *filename, *answer, *last_search, *last_replace; extern char *filename, *answer, *last_search, *last_replace;
......
...@@ -73,9 +73,9 @@ int xpt(filestruct * fileptr, int index) ...@@ -73,9 +73,9 @@ int xpt(filestruct * fileptr, int index)
tabs++; tabs++;
if (fileptr->data[i] == NANO_CONTROL_I) { if (fileptr->data[i] == NANO_CONTROL_I) {
if (tabs % TABSIZE == 0); if (tabs % tabsize == 0);
else else
tabs += TABSIZE - (tabs % TABSIZE); tabs += tabsize - (tabs % tabsize);
} else if (fileptr->data[i] & 0x80) } else if (fileptr->data[i] & 0x80)
/* Make 8 bit chars only 1 collumn! */ /* Make 8 bit chars only 1 collumn! */
; ;
...@@ -106,10 +106,10 @@ int actual_x_from_start(filestruct * fileptr, int xplus, int start) ...@@ -106,10 +106,10 @@ int actual_x_from_start(filestruct * fileptr, int xplus, int start)
for (i = start; tot <= xplus && fileptr->data[i] != 0; i++, tot++) for (i = start; tot <= xplus && fileptr->data[i] != 0; i++, tot++)
if (fileptr->data[i] == NANO_CONTROL_I) { if (fileptr->data[i] == NANO_CONTROL_I) {
if (tot % TABSIZE == 0) if (tot % tabsize == 0)
tot++; tot++;
else else
tot += TABSIZE - (tot % TABSIZE); tot += tabsize - (tot % tabsize);
} else if (fileptr->data[i] & 0x80) } else if (fileptr->data[i] & 0x80)
tot++; /* Make 8 bit chars only 1 column (again) */ tot++; /* Make 8 bit chars only 1 column (again) */
else if (fileptr->data[i] < 32) else if (fileptr->data[i] < 32)
...@@ -140,9 +140,9 @@ int strlenpt(char *buf) ...@@ -140,9 +140,9 @@ int strlenpt(char *buf)
tabs++; tabs++;
if (buf[i] == NANO_CONTROL_I) { if (buf[i] == NANO_CONTROL_I) {
if (tabs % TABSIZE == 0); if (tabs % tabsize == 0);
else else
tabs += TABSIZE - (tabs % TABSIZE); tabs += tabsize - (tabs % tabsize);
} else if (buf[i] & 0x80) } else if (buf[i] & 0x80)
/* Make 8 bit chars only 1 collumn! */ /* Make 8 bit chars only 1 collumn! */
; ;
...@@ -773,7 +773,7 @@ void update_line(filestruct * fileptr, int index) ...@@ -773,7 +773,7 @@ void update_line(filestruct * fileptr, int index)
virt_cur_x++; virt_cur_x++;
if (i < mark_beginx) if (i < mark_beginx)
virt_mark_beginx++; virt_mark_beginx++;
} while (pos % TABSIZE); } while (pos % tabsize);
/* must decrement once to account for tab-is-one-character */ /* must decrement once to account for tab-is-one-character */
if (i < current_x) if (i < current_x)
virt_cur_x--; virt_cur_x--;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment