commit ef0d5a76375b848481e084b0f2b19cb19f7a0cf4
parent 6b49e9e54ee623cd1e2879186ceff1b27b62240f
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Mon, 22 May 2006 02:08:49 +0000
handle prepending of wrapped text in one place instead of many, so that
it always works consistently
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3547 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
7 files changed, 29 insertions(+), 56 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -90,6 +90,12 @@ CVS code -
do_home(), do_end(), do_up(), do_scroll_up(), do_down(),
do_scroll_down(), do_left(), do_right(), do_indent_marked(),
and get_kbinput(). (Benno Schulenberg, minor tweaks by DLR)
+ - Handle prepending of wrapped text in one place instead of
+ many, so that it always works consistently. Changes to
+ do_uncut_text(), do_insertfile(), do_page_up(),
+ do_page_down(), do_up(), do_scroll_up(), do_down(),
+ do_scroll_down(), do_input(), do_search(), do_research(), and
+ do_delete(). (DLR)
- browser.c:
do_browser()
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of
diff --git a/src/cut.c b/src/cut.c
@@ -248,10 +248,6 @@ void do_uncut_text(void)
{
assert(openfile->current != NULL && openfile->current->data != NULL);
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
/* If the cutbuffer is empty, get out. */
if (cutbuffer == NULL)
return;
diff --git a/src/files.c b/src/files.c
@@ -687,10 +687,6 @@ void do_insertfile(
bool at_edittop = FALSE;
/* Whether we're at the top of the edit window. */
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
while (TRUE) {
#ifndef NANO_TINY
if (execute) {
diff --git a/src/move.c b/src/move.c
@@ -58,10 +58,6 @@ void do_page_up(void)
{
int i;
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the first line of the file, and then
* update the edit window. */
@@ -97,10 +93,6 @@ void do_page_down(void)
{
int i;
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the last line of the file, and then
* update the edit window. */
@@ -482,10 +474,6 @@ void do_end(void)
/* Move up one line. */
void do_up(void)
{
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
/* If we're at the top of the file, get out. */
if (openfile->current == openfile->fileage)
return;
@@ -520,10 +508,6 @@ void do_up(void)
/* Scroll up one line without scrolling the cursor. */
void do_scroll_up(void)
{
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
/* If the top of the file is onscreen, get out. */
if (openfile->edittop == openfile->fileage)
return;
@@ -543,10 +527,6 @@ void do_scroll_up(void)
/* Move down one line. */
void do_down(void)
{
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
/* If we're at the bottom of the file, get out. */
if (openfile->current == openfile->filebot)
return;
@@ -581,10 +561,6 @@ void do_down(void)
/* Scroll down one line without scrolling the cursor. */
void do_scroll_down(void)
{
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
/* If we're at the bottom of the file, get out. */
if (openfile->current == openfile->filebot)
return;
diff --git a/src/nano.c b/src/nano.c
@@ -1315,10 +1315,15 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
/* If we got a shortcut or toggle, or if there aren't any other
* characters waiting after the one we read in, we need to
- * display all the characters in the input buffer if it isn't
+ * output all the characters in the input buffer if it isn't
* empty. Note that it should be empty if we're in view
* mode. */
if (*s_or_t == TRUE || get_key_buffer_len() == 0) {
+ /* If we got a shortcut or toggle, turn off prepending of
+ * wrapped text. */
+ if (*s_or_t == TRUE)
+ wrap_reset();
+
if (kbinput != NULL) {
/* Display all the characters in the input buffer at
* once, filtering out control characters. */
@@ -1451,7 +1456,7 @@ bool do_mouse(void)
}
#endif /* !DISABLE_MOUSE */
-/* The user typed ouuput_len multibyte characters. Add them to the edit
+/* The user typed output_len multibyte characters. Add them to the edit
* buffer, filtering out all control characters if allow_cntrls is
* TRUE. */
void do_output(char *output, size_t output_len, bool allow_cntrls)
diff --git a/src/search.c b/src/search.c
@@ -425,19 +425,18 @@ void do_search(void)
int i;
bool didfind;
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
i = search_init(FALSE, FALSE);
- if (i == -1) /* Cancel, Go to Line, blank search string, or
- * regcomp() failed. */
+
+ if (i == -1)
+ /* Cancel, Go to Line, blank search string, or regcomp()
+ * failed. */
search_replace_abort();
- else if (i == -2) /* Replace. */
+ else if (i == -2)
+ /* Replace. */
do_replace();
#if !defined(NANO_TINY) || defined(HAVE_REGEX_H)
- else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
- * toggle. */
+ else if (i == 1)
+ /* Case Sensitive, Backwards, or Regexp search toggle. */
do_search();
#endif
@@ -507,10 +506,6 @@ void do_research(void)
size_t old_pww = openfile->placewewant;
bool didfind;
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
-
search_init_globals();
if (last_search[0] != '\0') {
@@ -888,15 +883,17 @@ void do_replace(void)
}
i = search_init(TRUE, FALSE);
- if (i == -1) { /* Cancel, Go to Line, blank search
- * string, or regcomp() failed. */
+ if (i == -1) {
+ /* Cancel, Go to Line, blank search string, or regcomp()
+ * failed. */
search_replace_abort();
return;
- } else if (i == -2) { /* No Replace. */
+ } else if (i == -2) {
+ /* No Replace. */
do_search();
return;
- } else if (i == 1) /* Case Sensitive, Backwards, or Regexp
- * search toggle. */
+ } else if (i == 1)
+ /* Case Sensitive, Backwards, or Regexp search toggle. */
do_replace();
if (i != 0)
diff --git a/src/text.c b/src/text.c
@@ -124,9 +124,6 @@ void do_delete(void)
delete_node(foo);
renumber(openfile->current);
openfile->totsize--;
-#ifndef DISABLE_WRAPPING
- wrap_reset();
-#endif
/* If the NO_NEWLINES flag isn't set, and text has been added to
* the magicline as a result of deleting at the end of the line
@@ -519,7 +516,7 @@ bool execute_command(const char *command)
#endif /* !NANO_TINY */
#ifndef DISABLE_WRAPPING
-/* Clear the prepend_wrap flag. We need to do this as soon as we do
+/* Unset the prepend_wrap flag. We need to do this as soon as we do
* something other than type text. */
void wrap_reset(void)
{