commit 4da604be5abdb5c0f1a624d62f1fb535a34bc9a0
parent 43754bd11d0e30000868278ec12389739b0c1d0e
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 26 Feb 2020 13:27:22 +0100
tweaks: relocate a function to before its callers
Diffstat:
2 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/src/cut.c b/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
/* Delete text from the cursor until the first start of a word to
* 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;
}
-/* 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. */
void cut_text(void)
{
diff --git a/src/proto.h b/src/proto.h
@@ -264,7 +264,6 @@ void copy_from_buffer(linestruct *somebuffer);
void cut_marked(bool *right_side_up);
#endif
void do_snip(bool copying, bool marked, bool until_eof, bool append);
-bool is_cuttable(bool test_cliff);
void cut_text(void);
#ifndef NANO_TINY
void copy_text(void);