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
No related merge requests found
Showing with 29 additions and 56 deletions
+29 -56
......@@ -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
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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)
......
......@@ -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)
......
......@@ -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)
{
......
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