commit 5237a42d65562733c4b96abc886ed343f36cc112
parent 46ccc9ba6ae54e89ccf5f60c62b09a37236edaea
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 17 Aug 2017 16:50:04 -0500
weeding: remove the unused be_clever parameter from do_home()/do_end()
Diffstat:
5 files changed, 22 insertions(+), 37 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -842,9 +842,9 @@ void shortcut_init(void)
add_to_funcs(do_next_word_void, MMAIN,
N_("Next Word"), IFSCHELP(nano_nextword_msg), TOGETHER, VIEW);
- add_to_funcs(do_home_void, MMAIN,
+ add_to_funcs(do_home, MMAIN,
N_("Home"), IFSCHELP(nano_home_msg), TOGETHER, VIEW);
- add_to_funcs(do_end_void, MMAIN,
+ add_to_funcs(do_end, MMAIN,
N_("End"), IFSCHELP(nano_end_msg), BLANKAFTER, VIEW);
add_to_funcs(do_up_void, MMAIN|MHELP|MBROWSER,
@@ -1157,10 +1157,10 @@ void shortcut_init(void)
}
add_to_sclist(MMOST, "M-Space", 0, do_prev_word_void, 0);
add_to_sclist(MMOST, "^Space", 0, do_next_word_void, 0);
- add_to_sclist((MMOST & ~MBROWSER), "^A", 0, do_home_void, 0);
- add_to_sclist((MMOST & ~MBROWSER), "Home", KEY_HOME, do_home_void, 0);
- add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end_void, 0);
- add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end_void, 0);
+ add_to_sclist((MMOST & ~MBROWSER), "^A", 0, do_home, 0);
+ add_to_sclist((MMOST & ~MBROWSER), "Home", KEY_HOME, do_home, 0);
+ add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end, 0);
+ add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up_void, 0);
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down_void, 0);
#ifdef ENABLE_UTF8
@@ -1548,9 +1548,9 @@ sc *strtosc(const char *input)
else if (!strcasecmp(input, "nextword"))
s->scfunc = do_next_word_void;
else if (!strcasecmp(input, "home"))
- s->scfunc = do_home_void;
+ s->scfunc = do_home;
else if (!strcasecmp(input, "end"))
- s->scfunc = do_end_void;
+ s->scfunc = do_end;
else if (!strcasecmp(input, "prevblock"))
s->scfunc = do_prev_block;
else if (!strcasecmp(input, "nextblock"))
diff --git a/src/move.c b/src/move.c
@@ -338,10 +338,9 @@ void do_next_word_void(void)
}
/* Move to the beginning of the current line (or softwrapped chunk).
- * If be_clever is TRUE, do a smart home when wanted and possible,
- * and do a dynamic home when in softwrap mode and it's possible.
- * If be_clever is FALSE, just do a simple home. */
-void do_home(bool be_clever)
+ * When enabled, do a smart home. When softwrapping, go the beginning
+ * of the full line when already at the start of a chunk. */
+void do_home(void)
{
filestruct *was_current = openfile->current;
size_t was_column = xplustabs();
@@ -355,7 +354,7 @@ void do_home(bool be_clever)
leftedge_x = actual_x(openfile->current->data, leftedge);
}
- if (ISSET(SMART_HOME) && be_clever) {
+ if (ISSET(SMART_HOME)) {
size_t indent_x = indent_length(openfile->current->data);
if (openfile->current->data[indent_x] != '\0') {
@@ -375,7 +374,7 @@ void do_home(bool be_clever)
if (!moved && ISSET(SOFTWRAP)) {
/* If already at the left edge of the screen, move fully home.
* Otherwise, move to the left edge. */
- if (openfile->current_x == leftedge_x && be_clever)
+ if (openfile->current_x == leftedge_x)
openfile->current_x = 0;
else {
openfile->current_x = leftedge_x;
@@ -398,16 +397,10 @@ void do_home(bool be_clever)
update_line(openfile->current, openfile->current_x);
}
-/* Do a (smart or dynamic) home. */
-void do_home_void(void)
-{
- do_home(TRUE);
-}
-
/* Move to the end of the current line (or softwrapped chunk).
- * If be_clever is TRUE, do a dynamic end when in softwrap mode and
- * it's possible. If be_clever is FALSE, just do a simple end. */
-void do_end(bool be_clever)
+ * When softwrapping and alredy at the end of a chunk, go to the
+ * end of the full line. */
+void do_end(void)
{
filestruct *was_current = openfile->current;
size_t was_column = xplustabs();
@@ -433,7 +426,7 @@ void do_end(bool be_clever)
/* If already at the right edge of the screen, move fully to
* the end of the line. Otherwise, move to the right edge. */
- if (openfile->current_x == rightedge_x && be_clever)
+ if (openfile->current_x == rightedge_x)
openfile->current_x = line_len;
else {
openfile->current_x = rightedge_x;
@@ -456,12 +449,6 @@ void do_end(bool be_clever)
update_line(openfile->current, openfile->current_x);
}
-/* Do a (dynamic) end. */
-void do_end_void(void)
-{
- do_end(TRUE);
-}
-
/* Move the cursor to the preceding line or chunk. If scroll_only is TRUE,
* also scroll the screen one row, so the cursor stays in the same spot. */
void do_up(bool scroll_only)
diff --git a/src/prompt.c b/src/prompt.c
@@ -122,9 +122,9 @@ int do_statusbar_input(bool *ran_func, bool *finished)
else if (s->scfunc == do_next_word_void)
do_statusbar_next_word();
#endif
- else if (s->scfunc == do_home_void)
+ else if (s->scfunc == do_home)
do_statusbar_home();
- else if (s->scfunc == do_end_void)
+ else if (s->scfunc == do_end)
do_statusbar_end();
/* When in restricted mode at the "Write File" prompt and the
* filename isn't blank, disallow any input and deletion. */
diff --git a/src/proto.h b/src/proto.h
@@ -374,10 +374,8 @@ void do_prev_word(bool allow_punct, bool update_screen);
void do_prev_word_void(void);
bool do_next_word(bool allow_punct, bool update_screen);
void do_next_word_void(void);
-void do_home(bool be_clever);
-void do_home_void(void);
-void do_end(bool be_clever);
-void do_end_void(void);
+void do_home(void);
+void do_end(void);
void do_up(bool scroll_only);
void do_up_void(void);
void do_down(bool scroll_only);
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -352,7 +352,7 @@ void parse_syntax(char *ptr)
bool is_universal(void (*func)(void))
{
if (func == do_left || func == do_right ||
- func == do_home_void || func == do_end_void ||
+ func == do_home || func == do_end ||
#ifndef NANO_TINY
func == do_prev_word_void || func == do_next_word_void ||
#endif