aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-06-23 15:20:17 +0200
committerOmar Polo <op@omarpolo.com>2021-06-23 15:20:17 +0200
commit5d0feb4b6d3aad62434dfb509ca754ab1739a19c (patch)
treef94b51594bd919f1186798a3bc41d4f46bb98bcd
parent98411855465df0c75210def209a669060f239901 (diff)
downloadtelescope-5d0feb4b6d3aad62434dfb509ca754ab1739a19c.tar.gz
telescope-5d0feb4b6d3aad62434dfb509ca754ab1739a19c.tar.bz2
save_excursion during next/previous-button
-rw-r--r--ChangeLog2
-rw-r--r--cmd.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 882b805..b32cdff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2021-06-23 Omar Polo <op@omarpolo.com>
+ * cmd.c (cmd_previous_button): stay on the line in next-button if there is no next link, and the same for previous-button
+
* telescope.c (handle_imsg_buf): "humanize" byte progress (i.e. trasform XYZ bytes to something readable)
2021-06-22 Omar Polo <op@omarpolo.com>
diff --git a/cmd.c b/cmd.c
index abe7252..10a5e49 100644
--- a/cmd.c
+++ b/cmd.c
@@ -243,9 +243,14 @@ cmd_push_button_new_tab(struct buffer *buffer)
void
cmd_previous_button(struct buffer *buffer)
{
+ struct excursion place;
+
+ save_excursion(&place, buffer);
+
do {
if (buffer->current_line == NULL ||
buffer->current_line == TAILQ_FIRST(&buffer->head)) {
+ restore_excursion(&place, buffer);
message("No previous link");
return;
}
@@ -256,9 +261,14 @@ cmd_previous_button(struct buffer *buffer)
void
cmd_next_button(struct buffer *buffer)
{
+ struct excursion place;
+
+ save_excursion(&place, buffer);
+
do {
if (buffer->current_line == NULL ||
buffer->current_line == TAILQ_LAST(&buffer->head, vhead)) {
+ restore_excursion(&place, buffer);
message("No next link");
return;
}