Commit Diff


commit - 98411855465df0c75210def209a669060f239901
commit + 5d0feb4b6d3aad62434dfb509ca754ab1739a19c
blob - 882b805359b1bdb158feb783460d4148b22e0aa5
blob + b32cdff12949df5c020c20d882438672582db9a4
--- ChangeLog
+++ 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>
blob - abe72527fe8fb818e1da736edb1a8d9c120d8077
blob + 10a5e4971dcef9c4d0a7b0bfe0a5e295707b8f68
--- cmd.c
+++ 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;
 		}