commit 40053593a870601c9c346f93ab180be1d564995c
parent 732cf8878656a88a20292bd3ba1d1e9867bffdf3
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 6 Apr 2020 17:42:29 +0200
general: rename "bookmark" to "anchor", to sound less permanent
Diffstat:
8 files changed, 49 insertions(+), 47 deletions(-)
diff --git a/src/cut.c b/src/cut.c
@@ -88,7 +88,7 @@ void do_deletion(undo_type action)
openfile->mark_x += openfile->current_x;
}
- openfile->current->bookmarked |= joining->bookmarked;
+ openfile->current->has_anchor |= joining->has_anchor;
#endif
unlink_node(joining);
renumber_from(openfile->current);
@@ -248,14 +248,14 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
bool same_line = (openfile->mark == top);
bool post_marked = (openfile->mark && (openfile->mark->lineno > top->lineno ||
(same_line && openfile->mark_x > top_x)));
- bool was_bookmarked = top->bookmarked;
+ bool was_anchored = top->has_anchor;
if (top == bot && top_x == bot_x)
return;
if (top != bot)
for (linestruct *line = top->next; line != bot->next; line = line->next)
- was_bookmarked |= line->bookmarked;
+ was_anchored |= line->has_anchor;
#endif
if (top == bot) {
@@ -325,7 +325,7 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
openfile->current_x = top_x;
#ifndef NANO_TINY
- openfile->current->bookmarked = was_bookmarked;
+ openfile->current->has_anchor = was_anchored;
if (post_marked || same_line)
openfile->mark = openfile->current;
diff --git a/src/global.c b/src/global.c
@@ -671,9 +671,9 @@ void shortcut_init(void)
#ifndef NANO_TINY
const char *recordmacro_gist = N_("Start/stop recording a macro");
const char *runmacro_gist = N_("Run the last recorded macro");
- const char *bookmark_gist = N_("Set or remove a bookmark on the current line");
- const char *prevbookmark_gist = N_("Go to previous bookmark");
- const char *nextbookmark_gist = N_("Go to next bookmark");
+ const char *anchor_gist = N_("Place or remove an anchor at the current line");
+ const char *prevanchor_gist = N_("Jump backward to the nearest anchor");
+ const char *nextanchor_gist = N_("Jump forward to the nearest anchor");
#endif
const char *case_gist = N_("Toggle the case sensitivity of the search");
const char *reverse_gist = N_("Reverse the direction of the search");
@@ -1027,12 +1027,12 @@ void shortcut_init(void)
add_to_funcs(run_macro, MMAIN,
N_("Run Macro"), WITHORSANS(runmacro_gist), BLANKAFTER, VIEW);
- add_to_funcs(bookmark, MMAIN,
- N_("Bookmark"), WITHORSANS(bookmark_gist), TOGETHER, NOVIEW);
- add_to_funcs(to_prev_bookmark, MMAIN,
- N_("Previous mark"), WITHORSANS(prevbookmark_gist), TOGETHER, NOVIEW);
- add_to_funcs(to_next_bookmark, MMAIN,
- N_("Next mark"), WITHORSANS(nextbookmark_gist), BLANKAFTER, NOVIEW);
+ add_to_funcs(put_or_lift_anchor, MMAIN,
+ N_("Anchor"), WITHORSANS(anchor_gist), TOGETHER, VIEW);
+ add_to_funcs(to_prev_anchor, MMAIN,
+ N_("Up to anchor"), WITHORSANS(prevanchor_gist), TOGETHER, VIEW);
+ add_to_funcs(to_next_anchor, MMAIN,
+ N_("Down to anchor"), WITHORSANS(nextanchor_gist), BLANKAFTER, VIEW);
add_to_funcs(zap_text, MMAIN,
N_("Zap Text"), WITHORSANS(zap_gist), BLANKAFTER, NOVIEW);
@@ -1204,9 +1204,9 @@ void shortcut_init(void)
add_to_sclist(MMAIN, "Sh-^Del", CONTROL_SHIFT_DELETE, chop_previous_word, 0);
add_to_sclist(MMAIN, "^Del", CONTROL_DELETE, chop_next_word, 0);
add_to_sclist(MMAIN, "M-Del", ALT_DELETE, zap_text, 0);
- add_to_sclist(MMAIN, "M-Ins", ALT_INSERT, bookmark, 0);
- add_to_sclist(MMAIN, "M-PgUp", ALT_PAGEUP, to_prev_bookmark, 0);
- add_to_sclist(MMAIN, "M-PgDn", ALT_PAGEDOWN, to_next_bookmark, 0);
+ add_to_sclist(MMAIN, "M-Ins", ALT_INSERT, put_or_lift_anchor, 0);
+ add_to_sclist(MMAIN, "M-PgUp", ALT_PAGEUP, to_prev_anchor, 0);
+ add_to_sclist(MMAIN, "M-PgDn", ALT_PAGEDOWN, to_next_anchor, 0);
#endif
#ifdef ENABLE_WORDCOMPLETION
add_to_sclist(MMAIN, "^]", 0, complete_a_word, 0);
diff --git a/src/nano.c b/src/nano.c
@@ -76,7 +76,7 @@ linestruct *make_new_node(linestruct *prevnode)
#endif
newnode->lineno = (prevnode) ? prevnode->lineno + 1 : 1;
#ifndef NANO_TINY
- newnode->bookmarked = FALSE;
+ newnode->has_anchor = FALSE;
#endif
return newnode;
@@ -151,7 +151,7 @@ linestruct *copy_node(const linestruct *src)
#endif
dst->lineno = src->lineno;
#ifndef NANO_TINY
- dst->bookmarked = FALSE;
+ dst->has_anchor = FALSE;
#endif
return dst;
diff --git a/src/nano.h b/src/nano.h
@@ -293,8 +293,8 @@ typedef struct linestruct {
/* Array of which multi-line regexes apply to this line. */
#endif
#ifndef NANO_TINY
- bool bookmarked;
- /* Whether the user bookmarked this line. */
+ bool has_anchor;
+ /* Whether the user has placed an anchor at this line. */
#endif
} linestruct;
diff --git a/src/proto.h b/src/proto.h
@@ -483,9 +483,9 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
void do_gotolinecolumn_void(void);
#ifndef NANO_TINY
void do_find_bracket(void);
-void bookmark(void);
-void to_prev_bookmark(void);
-void to_next_bookmark(void);
+void put_or_lift_anchor(void);
+void to_prev_anchor(void);
+void to_next_anchor(void);
#endif
/* Most functions in text.c. */
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -317,12 +317,12 @@ keystruct *strtosc(const char *input)
s->func = record_macro;
else if (!strcmp(input, "runmacro"))
s->func = run_macro;
- else if (!strcmp(input, "bookmark"))
- s->func = bookmark;
- else if (!strcmp(input, "prevbookmark"))
- s->func = to_prev_bookmark;
- else if (!strcmp(input, "nextbookmark"))
- s->func = to_next_bookmark;
+ else if (!strcmp(input, "anchor"))
+ s->func = put_or_lift_anchor;
+ else if (!strcmp(input, "prevanchor"))
+ s->func = to_prev_anchor;
+ else if (!strcmp(input, "nextanchor"))
+ s->func = to_next_anchor;
else if (!strcmp(input, "undo"))
s->func = do_undo;
else if (!strcmp(input, "redo"))
diff --git a/src/search.c b/src/search.c
@@ -978,17 +978,19 @@ void do_find_bracket(void)
openfile->current_x = was_current_x;
}
-/* Set a bookmark on the current line, or remove an existing one. */
-void bookmark(void)
+/* Place an anchor at the current line when none exists, otherwise remove it. */
+void put_or_lift_anchor(void)
{
- openfile->current->bookmarked = !openfile->current->bookmarked;
+ openfile->current->has_anchor = !openfile->current->has_anchor;
- statusbar(openfile->current->bookmarked ?
- _("Bookmarked this line") : _("Removed bookmark"));
+ if (openfile->current->has_anchor)
+ statusbar(_("Placed anchor"));
+ else
+ statusbar(_("Removed anchor"));
}
-/* Jump to the next or previous bookmark, if any. */
-static void go_to_bookmark(bool forward)
+/* Jump to the next or previous anchor, if any. */
+static void go_to_anchor(bool forward)
{
linestruct *was_current = openfile->current;
linestruct *line = was_current;
@@ -1000,28 +1002,28 @@ static void go_to_bookmark(bool forward)
line = (forward ? openfile->filetop : openfile->filebot);
if (line == openfile->current) {
- statusbar(line->bookmarked ?
- _("This is the only bookmark") : _("No bookmark found"));
+ statusbar(line->has_anchor ?
+ _("This is the only anchor") : _("No anchor found"));
return;
}
- } while (!line->bookmarked);
+ } while (!line->has_anchor);
openfile->current = line;
openfile->current_x = 0;
edit_redraw(was_current, CENTERING);
- statusbar(_("Jumped to bookmark"));
+ statusbar(_("Jumped to anchor"));
}
-/* Jump to the first bookmark before the current line. */
-void to_prev_bookmark(void)
+/* Jump to the first anchor before the current line. */
+void to_prev_anchor(void)
{
- go_to_bookmark(BACKWARD);
+ go_to_anchor(BACKWARD);
}
-/* Jump to the first bookmark after the current line. */
-void to_next_bookmark(void)
+/* Jump to the first anchor after the current line. */
+void to_next_anchor(void)
{
- go_to_bookmark(FORWARD);
+ go_to_anchor(FORWARD);
}
#endif /* !NANO_TINY */
diff --git a/src/text.c b/src/text.c
@@ -535,7 +535,7 @@ void do_undo(void)
line->data = charealloc(line->data, strlen(line->data) +
strlen(&u->strdata[regain_from_x]) + 1);
strcat(line->data, &u->strdata[regain_from_x]);
- line->bookmarked |= line->next->bookmarked;
+ line->has_anchor |= line->next->has_anchor;
unlink_node(line->next);
renumber_from(line);
goto_line_posx(u->head_lineno, original_x);