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