From af9052d7c75f6469a8080c2fb583e3567d5746c1 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Mon, 1 May 2006 17:14:25 +0000 Subject: [PATCH] cosmetic fixes git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3463 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- src/proto.h | 2 +- src/text.c | 40 +++++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/proto.h b/src/proto.h index 642d599b..c373e0d8 100644 --- a/src/proto.h +++ b/src/proto.h @@ -603,7 +603,7 @@ void do_delete(void); void do_backspace(void); void do_tab(void); #ifndef NANO_TINY -void do_indent_marked(ssize_t len); +void do_indent_marked(ssize_t cols); void do_indent_marked_void(void); void do_unindent_marked_void(void); #endif diff --git a/src/text.c b/src/text.c index 302e6374..a2d33df3 100644 --- a/src/text.c +++ b/src/text.c @@ -194,12 +194,12 @@ void do_tab(void) } #ifndef NANO_TINY -/* Indent or unindent all lines covered by the mark len characters, +/* Indent or unindent all lines covered by the mark len columns, * depending on whether len is positive or negative. If the * TABS_TO_SPACES flag is set, indent/unindent by len spaces. * Otherwise, indent/unindent by (len / tabsize) tabs and (len % * tabsize) spaces. */ -void do_indent_marked(ssize_t len) +void do_indent_marked(ssize_t cols) { bool indent_changed = FALSE; /* Whether any indenting or unindenting was done. */ @@ -224,13 +224,14 @@ void do_indent_marked(ssize_t len) return; } - /* If len is zero, get out. */ - if (len == 0) + /* If cols is zero, get out. */ + if (cols == 0) return; - /* If len is negative, make it positive and set unindent to TRUE. */ - if (len < 0) { - len = -len; + /* If cols is negative, make it positive and set unindent to + * TRUE. */ + if (cols < 0) { + cols = -cols; unindent = TRUE; /* Otherwise, we're indenting, in which case the file will always be * modified, so set indent_changed to TRUE. */ @@ -242,17 +243,17 @@ void do_indent_marked(ssize_t len) (const filestruct **)&bot, &bot_x, NULL); /* Set up the text we'll be using as indentation. */ - line_indent = charalloc(len + 1); + line_indent = charalloc(cols + 1); if (ISSET(TABS_TO_SPACES)) { - /* Set the indentation to len spaces. */ - charset(line_indent, ' ', len); - line_indent_len = len; + /* Set the indentation to cols spaces. */ + charset(line_indent, ' ', cols); + line_indent_len = cols; } else { - /* Set the indentation to (len / tabsize) tabs and (len % + /* Set the indentation to (cols / tabsize) tabs and (cols % * tabsize) spaces. */ - size_t num_tabs = len / tabsize; - size_t num_spaces = len % tabsize; + size_t num_tabs = cols / tabsize; + size_t num_spaces = cols % tabsize; charset(line_indent, '\t', num_tabs); charset(line_indent + num_tabs, ' ', num_spaces); @@ -270,11 +271,12 @@ void do_indent_marked(ssize_t len) if (unindent) { size_t indent_col = strnlenpt(f->data, indent_len); - if (len <= indent_col) { - size_t indent_new = actual_x(f->data, indent_col - len); + if (cols <= indent_col) { + size_t indent_new = actual_x(f->data, indent_col - + cols); size_t indent_shift = indent_len - indent_new; - /* If we're unindenting, and there's at least len + /* If we're unindenting, and there's at least cols * columns' worth of indentation at the beginning of the * non-whitespace text of this line, remove it. */ charmove(&f->data[indent_new], &f->data[indent_len], @@ -330,13 +332,13 @@ void do_indent_marked(ssize_t len) } } -/* Indent all lines covered by the mark tabsize characters. */ +/* Indent all lines covered by the mark tabsize columns. */ void do_indent_marked_void(void) { do_indent_marked(tabsize); } -/* Unindent all lines covered by the mark tabsize characters. */ +/* Unindent all lines covered by the mark tabsize columns. */ void do_unindent_marked_void(void) { do_indent_marked(-tabsize); -- 2.39.5