tweaks: relocate a function to before its callers
parent
43754bd11d
commit
4da604be5a
52
src/cut.c
52
src/cut.c
|
@ -138,6 +138,32 @@ void do_backspace(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return FALSE when a cut command would not actually cut anything: when
|
||||||
|
* on an empty line at EOF, or when the mark covers zero characters, or
|
||||||
|
* (when test_cliff is TRUE) when the magic line would be cut. */
|
||||||
|
bool is_cuttable(bool test_cliff)
|
||||||
|
{
|
||||||
|
size_t from = (test_cliff) ? openfile->current_x : 0;
|
||||||
|
|
||||||
|
if ((openfile->current->next == NULL && openfile->current->data[from] == '\0'
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
&& openfile->mark == NULL) ||
|
||||||
|
(openfile->mark == openfile->current &&
|
||||||
|
openfile->mark_x == openfile->current_x) ||
|
||||||
|
(from > 0 && !ISSET(NO_NEWLINES) &&
|
||||||
|
openfile->current->data[from] == '\0' &&
|
||||||
|
openfile->current->next == openfile->filebot
|
||||||
|
#endif
|
||||||
|
)) {
|
||||||
|
#ifndef NANO_TINY
|
||||||
|
statusbar(_("Nothing was cut"));
|
||||||
|
openfile->mark = NULL;
|
||||||
|
#endif
|
||||||
|
return FALSE;
|
||||||
|
} else
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Delete text from the cursor until the first start of a word to
|
/* Delete text from the cursor until the first start of a word to
|
||||||
* the left, or to the right when forward is TRUE. */
|
* the left, or to the right when forward is TRUE. */
|
||||||
|
@ -508,32 +534,6 @@ void do_snip(bool copying, bool marked, bool until_eof, bool append)
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return FALSE when a cut command would not actually cut anything: when
|
|
||||||
* on an empty line at EOF, or when the mark covers zero characters, or
|
|
||||||
* (when test_cliff is TRUE) when the magic line would be cut. */
|
|
||||||
bool is_cuttable(bool test_cliff)
|
|
||||||
{
|
|
||||||
size_t from = (test_cliff) ? openfile->current_x : 0;
|
|
||||||
|
|
||||||
if ((openfile->current->next == NULL && openfile->current->data[from] == '\0'
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
&& openfile->mark == NULL) ||
|
|
||||||
(openfile->mark == openfile->current &&
|
|
||||||
openfile->mark_x == openfile->current_x) ||
|
|
||||||
(from > 0 && !ISSET(NO_NEWLINES) &&
|
|
||||||
openfile->current->data[from] == '\0' &&
|
|
||||||
openfile->current->next == openfile->filebot
|
|
||||||
#endif
|
|
||||||
)) {
|
|
||||||
#ifndef NANO_TINY
|
|
||||||
statusbar(_("Nothing was cut"));
|
|
||||||
openfile->mark = NULL;
|
|
||||||
#endif
|
|
||||||
return FALSE;
|
|
||||||
} else
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Move text from the current buffer into the cutbuffer. */
|
/* Move text from the current buffer into the cutbuffer. */
|
||||||
void cut_text(void)
|
void cut_text(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -264,7 +264,6 @@ void copy_from_buffer(linestruct *somebuffer);
|
||||||
void cut_marked(bool *right_side_up);
|
void cut_marked(bool *right_side_up);
|
||||||
#endif
|
#endif
|
||||||
void do_snip(bool copying, bool marked, bool until_eof, bool append);
|
void do_snip(bool copying, bool marked, bool until_eof, bool append);
|
||||||
bool is_cuttable(bool test_cliff);
|
|
||||||
void cut_text(void);
|
void cut_text(void);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void copy_text(void);
|
void copy_text(void);
|
||||||
|
|
Loading…
Reference in New Issue