Re: use same numbers for pager(responses) and thread(articles) view

Rado S <[email protected]> Sat, 26 May 2007 16:28:20 +0200
Newsgroups gmane.network.tin.devel
Message-ID <[email protected]>
=- Urs Janßen wrote on Sat 26.May'07 at 15:46:44 +0200 -=

> > When in the pager I hit #4, it jumps to a different message than
> > when I hit #4 in the thread view. This is ... confusing.
> 
> it prompts for different things, in the thread level it prompts:
> "Select article> " whereas in the pager it prompts
> "Read response> ". article 1 is response 0 so the current code is correct.
>
> > Shouldn't the same number jumped to refer to the same message
> > in the thread independent of viewing mode?
> 
> only if you prompt for the same thing (which the current code doesn't do).

Ok, if it's just the word, there you go.

I also noticed 2 other issues for treating "0".
Correction for all attached.

-- 
© Rado S. -- You must provide YOUR effort for your goal!
EVERY effort counts: at least to show your attitude.
You're responsible for ALL you do: you get what you give.
samenumber.pat (text/plain, 2.9 KB)
diff -ur torg/include/proto.h tgo/include/proto.h
--- torg/include/proto.h	Tue Mar 27 20:25:48 2007
+++ tgo/include/proto.h	Fri May 25 20:32:42 2007
@@ -205,7 +205,7 @@
 extern void top_of_list(void);
 extern void end_of_list(void);
 extern void move_to_item(int n);
-extern void prompt_item_num(int ch, const char *prompt);
+extern void prompt_item_num(int startwith, int ch, const char *prompt);
 extern void scroll_down(void);
 extern void scroll_up(void);
 extern void set_first_screen_item(void);
diff -ur torg/src/global.c tgo/src/global.c
--- torg/src/global.c	Tue Mar 27 20:25:48 2007
+++ tgo/src/global.c	Sat May 26 16:23:53 2007
@@ -195,6 +195,7 @@
 
 void
 prompt_item_num(
+	int startwith,
 	int ch,
 	const char *prompt)
 {
@@ -206,8 +207,9 @@
 		clear_message();
 		return;
 	}
+	num += 1 - startwith;
 
-	if (--num < 0) /* index from 0 (internal) vs. 1 (user) */
+	if (--num < 0) /* index from 0 (internal) vs. 1 (user, not thread.c, begins with 0, too, to match page.c) */
 		num = 0;
 
 	if (num >= currmenu->max)
diff -ur torg/src/group.c tgo/src/group.c
--- torg/src/group.c	Tue Mar 27 20:25:48 2007
+++ tgo/src/group.c	Fri May 25 20:30:24 2007
@@ -214,7 +214,7 @@
 			case DIGIT_8:
 			case DIGIT_9:
 				if (grpmenu.max)
-					prompt_item_num(func_to_key(func, group_keys), _(txt_select_thread));
+					prompt_item_num(1,func_to_key(func, group_keys), _(txt_select_thread));
 				break;
 
 #	ifndef NO_SHELL_ESCAPE
diff -ur torg/src/page.c tgo/src/page.c
--- torg/src/page.c	Tue Mar 27 20:25:48 2007
+++ tgo/src/page.c	Sat May 26 15:59:17 2007
@@ -1785,7 +1785,7 @@
 
 	clear_message();
 
-	if ((num = prompt_num(ch, _(txt_read_resp))) == -1) {
+	if ((num = prompt_num(ch, _(txt_select_art))) == -1) {
 		clear_message();
 		return -1;
 	}
diff -ur torg/src/select.c tgo/src/select.c
--- torg/src/select.c	Tue Mar 27 20:25:48 2007
+++ tgo/src/select.c	Fri May 25 20:31:45 2007
@@ -146,7 +146,7 @@
 			case DIGIT_8:
 			case DIGIT_9:
 				if (selmenu.max)
-					prompt_item_num(func_to_key(func, select_keys), _(txt_select_group));
+					prompt_item_num(1,func_to_key(func, select_keys), _(txt_select_group));
 				else
 					info_message(_(txt_no_groups));
 				break;
diff -ur torg/src/thread.c tgo/src/thread.c
--- torg/src/thread.c	Tue Mar 27 20:25:48 2007
+++ tgo/src/thread.c	Sat May 26 15:56:43 2007
@@ -152,7 +152,7 @@
 		sprintf(buffer, "%s ", tin_ltoa(l + 1, 6));
 	else
 #endif /* 0 */
-	sprintf(buffer, "  %s ", tin_ltoa(l + 1, 4));
+	sprintf(buffer, "  %s ", tin_ltoa(l , 4));
 	rest_of_line -= 7;
 
 	/*
@@ -470,6 +470,7 @@
 			case GLOBAL_ABORT:			/* Abort */
 				break;
 
+			case DIGIT_0:
 			case DIGIT_1:
 			case DIGIT_2:
 			case DIGIT_3:
@@ -482,7 +483,7 @@
 				if (thdmenu.max == 1)
 					info_message(_(txt_no_responses));
 				else
-					prompt_item_num(func_to_key(func, thread_keys), _(txt_select_art));
+					prompt_item_num(0,func_to_key(func, thread_keys), _(txt_select_art));
 				break;
 
 #ifndef NO_SHELL_ESCAPE