Commit ef0d5a76 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

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
parent 6b49e9e5
Showing with 29 additions and 56 deletions
+29 -56
...@@ -90,6 +90,12 @@ CVS code - ...@@ -90,6 +90,12 @@ CVS code -
do_home(), do_end(), do_up(), do_scroll_up(), do_down(), do_home(), do_end(), do_up(), do_scroll_up(), do_down(),
do_scroll_down(), do_left(), do_right(), do_indent_marked(), do_scroll_down(), do_left(), do_right(), do_indent_marked(),
and get_kbinput(). (Benno Schulenberg, minor tweaks by DLR) 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: - browser.c:
do_browser() do_browser()
- Reference NANO_GOTODIR_(ALT|F)?KEY instead of - Reference NANO_GOTODIR_(ALT|F)?KEY instead of
......
...@@ -248,10 +248,6 @@ void do_uncut_text(void) ...@@ -248,10 +248,6 @@ void do_uncut_text(void)
{ {
assert(openfile->current != NULL && openfile->current->data != NULL); assert(openfile->current != NULL && openfile->current->data != NULL);
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If the cutbuffer is empty, get out. */ /* If the cutbuffer is empty, get out. */
if (cutbuffer == NULL) if (cutbuffer == NULL)
return; return;
......
...@@ -687,10 +687,6 @@ void do_insertfile( ...@@ -687,10 +687,6 @@ void do_insertfile(
bool at_edittop = FALSE; bool at_edittop = FALSE;
/* Whether we're at the top of the edit window. */ /* Whether we're at the top of the edit window. */
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
while (TRUE) { while (TRUE) {
#ifndef NANO_TINY #ifndef NANO_TINY
if (execute) { if (execute) {
......
...@@ -58,10 +58,6 @@ void do_page_up(void) ...@@ -58,10 +58,6 @@ void do_page_up(void)
{ {
int i; int i;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If there's less than a page of text left on the screen, put the /* 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 * cursor at the beginning of the first line of the file, and then
* update the edit window. */ * update the edit window. */
...@@ -97,10 +93,6 @@ void do_page_down(void) ...@@ -97,10 +93,6 @@ void do_page_down(void)
{ {
int i; int i;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If there's less than a page of text left on the screen, put the /* 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 * cursor at the beginning of the last line of the file, and then
* update the edit window. */ * update the edit window. */
...@@ -482,10 +474,6 @@ void do_end(void) ...@@ -482,10 +474,6 @@ void do_end(void)
/* Move up one line. */ /* Move up one line. */
void do_up(void) void do_up(void)
{ {
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If we're at the top of the file, get out. */ /* If we're at the top of the file, get out. */
if (openfile->current == openfile->fileage) if (openfile->current == openfile->fileage)
return; return;
...@@ -520,10 +508,6 @@ void do_up(void) ...@@ -520,10 +508,6 @@ void do_up(void)
/* Scroll up one line without scrolling the cursor. */ /* Scroll up one line without scrolling the cursor. */
void do_scroll_up(void) void do_scroll_up(void)
{ {
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If the top of the file is onscreen, get out. */ /* If the top of the file is onscreen, get out. */
if (openfile->edittop == openfile->fileage) if (openfile->edittop == openfile->fileage)
return; return;
...@@ -543,10 +527,6 @@ void do_scroll_up(void) ...@@ -543,10 +527,6 @@ void do_scroll_up(void)
/* Move down one line. */ /* Move down one line. */
void do_down(void) void do_down(void)
{ {
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If we're at the bottom of the file, get out. */ /* If we're at the bottom of the file, get out. */
if (openfile->current == openfile->filebot) if (openfile->current == openfile->filebot)
return; return;
...@@ -581,10 +561,6 @@ void do_down(void) ...@@ -581,10 +561,6 @@ void do_down(void)
/* Scroll down one line without scrolling the cursor. */ /* Scroll down one line without scrolling the cursor. */
void do_scroll_down(void) void do_scroll_down(void)
{ {
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If we're at the bottom of the file, get out. */ /* If we're at the bottom of the file, get out. */
if (openfile->current == openfile->filebot) if (openfile->current == openfile->filebot)
return; return;
......
...@@ -1315,10 +1315,15 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool ...@@ -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 /* 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 * 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 * empty. Note that it should be empty if we're in view
* mode. */ * mode. */
if (*s_or_t == TRUE || get_key_buffer_len() == 0) { 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) { if (kbinput != NULL) {
/* Display all the characters in the input buffer at /* Display all the characters in the input buffer at
* once, filtering out control characters. */ * once, filtering out control characters. */
...@@ -1451,7 +1456,7 @@ bool do_mouse(void) ...@@ -1451,7 +1456,7 @@ bool do_mouse(void)
} }
#endif /* !DISABLE_MOUSE */ #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 * buffer, filtering out all control characters if allow_cntrls is
* TRUE. */ * TRUE. */
void do_output(char *output, size_t output_len, bool allow_cntrls) void do_output(char *output, size_t output_len, bool allow_cntrls)
......
...@@ -425,19 +425,18 @@ void do_search(void) ...@@ -425,19 +425,18 @@ void do_search(void)
int i; int i;
bool didfind; bool didfind;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
i = search_init(FALSE, FALSE); 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(); search_replace_abort();
else if (i == -2) /* Replace. */ else if (i == -2)
/* Replace. */
do_replace(); do_replace();
#if !defined(NANO_TINY) || defined(HAVE_REGEX_H) #if !defined(NANO_TINY) || defined(HAVE_REGEX_H)
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search else if (i == 1)
* toggle. */ /* Case Sensitive, Backwards, or Regexp search toggle. */
do_search(); do_search();
#endif #endif
...@@ -507,10 +506,6 @@ void do_research(void) ...@@ -507,10 +506,6 @@ void do_research(void)
size_t old_pww = openfile->placewewant; size_t old_pww = openfile->placewewant;
bool didfind; bool didfind;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
search_init_globals(); search_init_globals();
if (last_search[0] != '\0') { if (last_search[0] != '\0') {
...@@ -888,15 +883,17 @@ void do_replace(void) ...@@ -888,15 +883,17 @@ void do_replace(void)
} }
i = search_init(TRUE, FALSE); i = search_init(TRUE, FALSE);
if (i == -1) { /* Cancel, Go to Line, blank search if (i == -1) {
* string, or regcomp() failed. */ /* Cancel, Go to Line, blank search string, or regcomp()
* failed. */
search_replace_abort(); search_replace_abort();
return; return;
} else if (i == -2) { /* No Replace. */ } else if (i == -2) {
/* No Replace. */
do_search(); do_search();
return; return;
} else if (i == 1) /* Case Sensitive, Backwards, or Regexp } else if (i == 1)
* search toggle. */ /* Case Sensitive, Backwards, or Regexp search toggle. */
do_replace(); do_replace();
if (i != 0) if (i != 0)
......
...@@ -124,9 +124,6 @@ void do_delete(void) ...@@ -124,9 +124,6 @@ void do_delete(void)
delete_node(foo); delete_node(foo);
renumber(openfile->current); renumber(openfile->current);
openfile->totsize--; openfile->totsize--;
#ifndef DISABLE_WRAPPING
wrap_reset();
#endif
/* If the NO_NEWLINES flag isn't set, and text has been added to /* 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 * the magicline as a result of deleting at the end of the line
...@@ -519,7 +516,7 @@ bool execute_command(const char *command) ...@@ -519,7 +516,7 @@ bool execute_command(const char *command)
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
#ifndef DISABLE_WRAPPING #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. */ * something other than type text. */
void wrap_reset(void) void wrap_reset(void)
{ {
......
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