[tin-dev] start_editor_offset

Urs Janßen urs at tin.org
Tue Jul 6 00:52:16 CEST 2021


In <mailman.308.1625513088.1791.tin-dev at tin.org> on Mo, 05 Jul 2021 21:24:37,
    Thomas Dickey wrote:
> The original intent was (probably0 to make the older feature unnecessary.

That's what I guessed as well, the patch below (for current snapshot) should
remove start_editor_offset. (I've also fixed the manpages etc.pp. but skip
that parts of the diff).

=== modified file 'include/extern.h'
--- include/extern.h	2021-07-04 13:30:21 +0000
+++ include/extern.h	2021-07-05 22:31:58 +0000
@@ -1838,7 +1838,6 @@
 extern struct opttxt txt_sort_threads_type;
 extern struct opttxt txt_spamtrap_warning_addresses;
 extern struct opttxt txt_stars_regex;
-extern struct opttxt txt_start_editor_offset;
 #ifndef USE_CURSES
 	extern struct opttxt txt_strip_blanks;
 #endif /* !USE_CURSES */

=== modified file 'include/tin.h'
--- include/tin.h	2021-07-04 13:30:21 +0000
+++ include/tin.h	2021-07-05 22:33:31 +0000
@@ -1674,7 +1674,6 @@
 	BoolField(show_only_unread_arts);	/* 0=all, 1=only unread */
 	BoolField(sigdashes);			/* set TRUE to prepend every signature with dashes */
 	BoolField(signature_repost);	/* set TRUE to add signature when reposting articles */
-	BoolField(start_editor_offset);	/* start editor with line offset */
 	IntField(thread_articles);			/* 0=unthread, 1=subject, 2=refs, 3=both, 4=multipart, 5=percentage */
 	BoolField(thread_catchup_on_exit);	/* catchup thread with left arrow key or not */
 	IntField(thread_perc);			/* percentage threading threshold */
@@ -1769,7 +1768,6 @@
 	BoolField(signature_repost);
 	BoolField(sort_article_type);
 	BoolField(sort_threads_type);
-	BoolField(start_editor_offset);
 	BoolField(tex2iso_conv);
 	BoolField(thread_articles);
 	BoolField(thread_catchup_on_exit);
@@ -2167,8 +2165,7 @@
 #define REDIRECT_PGP_OUTPUT		"> /dev/null"
 #define ENV_VAR_MAILER		"MAILER"
 #define ENV_VAR_SHELL		"SHELL"
-#define TIN_EDITOR_FMT_OFF		"%E %F"
-#define TIN_EDITOR_FMT_ON		"%E +%N %F"
+#define TIN_EDITOR_FMT		"%E +%N %F"
 #define MAILER_FORMAT		"%M -oi -t < %F"
 #define TMPDIR	get_val("TMPDIR", _PATH_TMP)
 #ifdef HAVE_KEY_PREFIX

=== modified file 'include/tinrc.h'
--- include/tinrc.h	2021-07-04 13:30:21 +0000
+++ include/tinrc.h	2021-07-05 22:32:41 +0000
@@ -245,7 +245,6 @@
 	t_bool show_signatures;				/* show signatures when displaying articles */
 	t_bool sigdashes;					/* set TRUE to prepend every signature with dashes */
 	t_bool signature_repost;			/* set TRUE to add signature when reposting articles */
-	t_bool start_editor_offset;
 #	ifndef USE_CURSES
 		t_bool strip_blanks;
 #	endif /* !USE_CURSES */
@@ -362,7 +361,6 @@
 	t_bool attrib_show_signatures;
 	t_bool attrib_sigdashes;
 	t_bool attrib_signature_repost;
-	t_bool attrib_start_editor_offset;
 	t_bool attrib_tex2iso_conv;
 	t_bool attrib_thread_catchup_on_exit;
 	t_bool attrib_verbatim_handling;

=== modified file 'src/attrib.c'
--- src/attrib.c	2021-02-24 18:04:13 +0000
+++ src/attrib.c	2021-07-05 22:27:02 +0000
@@ -156,7 +156,6 @@
 	CopyBool(prompt_followupto, tinrc.prompt_followupto);
 	CopyBool(sigdashes, tinrc.sigdashes);
 	CopyBool(signature_repost, tinrc.signature_repost);
-	CopyBool(start_editor_offset, tinrc.start_editor_offset);
 	attributes->x_comment_to = FALSE;
 	CopyBool(tex2iso_conv, tinrc.tex2iso_conv);
 	attributes->mime_forward = FALSE;
@@ -232,7 +231,6 @@
 	state->signature_repost = FALSE;
 	state->sort_article_type = FALSE;
 	state->sort_threads_type = FALSE;
-	state->start_editor_offset = FALSE;
 	state->tex2iso_conv = FALSE;
 	state->thread_articles = FALSE;
 	state->thread_catchup_on_exit = FALSE;
@@ -474,7 +472,6 @@
 					MATCH_BOOLEAN("show_signatures=", OPT_ATTRIB_SHOW_SIGNATURES);
 					MATCH_BOOLEAN("sigdashes=", OPT_ATTRIB_SIGDASHES);
 					MATCH_BOOLEAN("signature_repost=", OPT_ATTRIB_SIGNATURE_REPOST);
-					MATCH_BOOLEAN("start_editor_offset=", OPT_ATTRIB_START_EDITOR_OFFSET);
 					MATCH_STRING("sigfile=", OPT_ATTRIB_SIGFILE);
 					MATCH_INTEGER("sort_article_type=", OPT_ATTRIB_SORT_ARTICLE_TYPE, SORT_ARTICLES_BY_LINES_ASCEND);
 					MATCH_INTEGER("sort_threads_type=", OPT_ATTRIB_SORT_THREADS_TYPE, SORT_THREADS_BY_LAST_POSTING_DATE_ASCEND);
@@ -834,9 +831,6 @@
 			case OPT_ATTRIB_SIGNATURE_REPOST:
 				SET_BOOLEAN(signature_repost);
 
-			case OPT_ATTRIB_START_EDITOR_OFFSET:
-				SET_BOOLEAN(start_editor_offset);
-
 			case OPT_ATTRIB_THREAD_ARTICLES:
 				SET_INTEGER(thread_articles);
 
@@ -1090,7 +1084,6 @@
 				SET_ATTRIB(prompt_followupto);
 				SET_ATTRIB(sigdashes);
 				SET_ATTRIB(signature_repost);
-				SET_ATTRIB(start_editor_offset);
 				SET_ATTRIB(x_comment_to);
 				SET_ATTRIB(tex2iso_conv);
 				SET_ATTRIB(mime_forward);
@@ -1340,7 +1333,6 @@
 		SORT_THREADS_BY_LAST_POSTING_DATE_DESCEND, _(txt_sort_t_type[SORT_THREADS_BY_LAST_POSTING_DATE_DESCEND]));
 	fprintf(fp, "#    %d=%s\n",
 		SORT_THREADS_BY_LAST_POSTING_DATE_ASCEND, _(txt_sort_t_type[SORT_THREADS_BY_LAST_POSTING_DATE_ASCEND]));
-	fprintf(fp, _("#  start_editor_offset=ON/OFF\n"));
 	fprintf(fp, _("#  tex2iso_conv=ON/OFF\n"));
 	fprintf(fp, _("#  thread_catchup_on_exit=ON/OFF\n"));
 	fprintf(fp, _("#  thread_articles=NUM"));
@@ -1536,8 +1528,6 @@
 					fprintf(fp, "sort_article_type=%u\n", scope->attribute->sort_article_type);
 				if (scope->state->sort_threads_type)
 					fprintf(fp, "sort_threads_type=%u\n", scope->attribute->sort_threads_type);
-				if (scope->state->start_editor_offset)
-					fprintf(fp, "start_editor_offset=%s\n", print_boolean(scope->attribute->start_editor_offset));
 				if (scope->state->tex2iso_conv)
 					fprintf(fp, "tex2iso_conv=%s\n", print_boolean(scope->attribute->tex2iso_conv));
 				if (scope->state->thread_articles)
@@ -1661,7 +1651,6 @@
 		|| scope->state->signature_repost
 		|| scope->state->sort_article_type
 		|| scope->state->sort_threads_type
-		|| scope->state->start_editor_offset
 		|| scope->state->tex2iso_conv
 		|| scope->state->thread_articles
 		|| scope->state->thread_catchup_on_exit
@@ -1787,7 +1776,6 @@
 			debug_print_file("ATTRIBUTES", "\tshow_signatures=%s", print_boolean(group->attribute->show_signatures));
 			debug_print_file("ATTRIBUTES", "\tsigdashes=%s", print_boolean(group->attribute->sigdashes));
 			debug_print_file("ATTRIBUTES", "\tsignature_repost=%s", print_boolean(group->attribute->signature_repost));
-			debug_print_file("ATTRIBUTES", "\tstart_editor_offset=%s", print_boolean(group->attribute->start_editor_offset));
 			debug_print_file("ATTRIBUTES", "\tthread_catchup_on_exit=%s", print_boolean(group->attribute->thread_catchup_on_exit));
 			debug_print_file("ATTRIBUTES", "\tthread_format=%s", BlankIfNull(group->attribute->thread_format));
 			debug_print_file("ATTRIBUTES", "\ttrim_article_body=%d", group->attribute->trim_article_body);
@@ -1902,7 +1890,6 @@
 			debug_print_file(fname, "\t%sshow_signatures=%s", DEBUG_PRINT_STATE(show_signatures), print_boolean(scope->attribute->show_signatures));
 			debug_print_file(fname, "\t%ssigdashes=%s", DEBUG_PRINT_STATE(sigdashes), print_boolean(scope->attribute->sigdashes));
 			debug_print_file(fname, "\t%ssignature_repost=%s", DEBUG_PRINT_STATE(signature_repost), print_boolean(scope->attribute->signature_repost));
-			debug_print_file(fname, "\t%sstart_editor_offset=%s", DEBUG_PRINT_STATE(start_editor_offset), print_boolean(scope->attribute->start_editor_offset));
 			debug_print_file(fname, "\t%sthread_catchup_on_exit=%s", DEBUG_PRINT_STATE(thread_catchup_on_exit), print_boolean(scope->attribute->thread_catchup_on_exit));
 			debug_print_file(fname, "\t%sthread_format=%s", DEBUG_PRINT_STATE(thread_format), DEBUG_PRINT_STRING(thread_format));
 			debug_print_file(fname, "\t%strim_article_body=%d", DEBUG_PRINT_STATE(trim_article_body), scope->attribute->trim_article_body);

=== modified file 'src/config.c'
--- src/config.c	2021-07-04 13:30:21 +0000
+++ src/config.c	2021-07-05 22:33:57 +0000
@@ -739,9 +739,6 @@
 			if (match_string(buf, "spamtrap_warning_addresses=", tinrc.spamtrap_warning_addresses, sizeof(tinrc.spamtrap_warning_addresses)))
 				break;
 
-			if (match_boolean(buf, "start_editor_offset=", &tinrc.start_editor_offset))
-				break;
-
 			if (match_integer(buf, "sort_article_type=", &tinrc.sort_article_type, SORT_ARTICLES_BY_LINES_ASCEND))
 				break;
 
@@ -946,7 +943,7 @@
 
 	/* set defaults if blank */
 	if (!*tinrc.editor_format)
-		STRCPY(tinrc.editor_format, TIN_EDITOR_FMT_ON);
+		STRCPY(tinrc.editor_format, TIN_EDITOR_FMT);
 	if (!*tinrc.select_format)
 		STRCPY(tinrc.select_format, DEFAULT_SELECT_FORMAT);
 	if (!*tinrc.group_format)
@@ -1097,9 +1094,6 @@
 	fprintf(fp, "%s", _(txt_batch_save.tinrc));
 	fprintf(fp, "batch_save=%s\n\n", print_boolean(tinrc.batch_save));
 
-	fprintf(fp, "%s", _(txt_start_editor_offset.tinrc));
-	fprintf(fp, "start_editor_offset=%s\n\n", print_boolean(tinrc.start_editor_offset));
-
 	fprintf(fp, "%s", _(txt_editor_format.tinrc));
 	fprintf(fp, "editor_format=%s\n\n", tinrc.editor_format);
 

=== modified file 'src/init.c'
--- src/init.c	2021-07-04 13:30:21 +0000
+++ src/init.c	2021-07-05 22:27:48 +0000
@@ -383,7 +383,6 @@
 	TRUE,		/* show_signatures */
 	TRUE,		/* sigdashes */
 	TRUE,		/* signature_repost */
-	TRUE,		/* start_editor_offset */
 #ifndef USE_CURSES
 	TRUE,		/* strip_blanks */
 #endif /* !USE_CURSES */
@@ -496,7 +495,6 @@
 	TRUE,		/* attrib_show_signatures */
 	TRUE,		/* attrib_sigdashes */
 	TRUE,		/* attrib_signature_repost */
-	TRUE,		/* attrib_start_editor_offset */
 	FALSE,		/* attrib_tex2iso_conv */
 	TRUE,		/* attrib_thread_catchup_on_exit */
 	TRUE,		/* attrib_verbatim_handling */

=== modified file 'src/lang.c'
--- src/lang.c	2021-07-04 13:30:21 +0000
+++ src/lang.c	2021-07-05 22:28:11 +0000
@@ -2716,13 +2716,6 @@
 	N_("# If ON a screen redraw will always be done after certain external commands\n")
 };
 
-struct opttxt txt_start_editor_offset = {
-	N_("Start editor with line offset. <SPACE> toggles, <CR> sets, <ESC> cancels."),
-	N_("Start editor with line offset"),
-	N_("# If ON editor will be started with cursor offset into the file\n\
-# otherwise the cursor will be positioned at the first line\n")
-};
-
 struct opttxt txt_editor_format = {
 	N_("Enter %E for editor, %F for filename, %N for line-number, <CR> to set."),
 	N_("Invocation of your editor"),

=== modified file 'src/misc.c'
--- src/misc.c	2021-07-04 13:30:21 +0000
+++ src/misc.c	2021-07-05 22:34:14 +0000
@@ -394,9 +394,9 @@
 	}
 
 	if (group != NULL)
-		my_strncpy(editor_format, (*group->attribute->editor_format ? group->attribute->editor_format : (group->attribute->start_editor_offset ? TIN_EDITOR_FMT_ON : TIN_EDITOR_FMT_OFF)), sizeof(editor_format) - 1);
+		my_strncpy(editor_format, (*group->attribute->editor_format ? group->attribute->editor_format : TIN_EDITOR_FMT), sizeof(editor_format) - 1);
 	else
-		my_strncpy(editor_format, (*tinrc.editor_format ? tinrc.editor_format : (tinrc.start_editor_offset ? TIN_EDITOR_FMT_ON : TIN_EDITOR_FMT_OFF)), sizeof(editor_format) - 1);
+		my_strncpy(editor_format, (*tinrc.editor_format ? tinrc.editor_format : TIN_EDITOR_FMT), sizeof(editor_format) - 1);
 
 	if (!strfeditor(editor, lineno, filename, buf, sizeof(buf), editor_format))
 		sh_format(buf, sizeof(buf), "%s %s", editor, filename);

=== modified file 'src/options_menu.c'
--- src/options_menu.c	2021-07-04 13:30:21 +0000
+++ src/options_menu.c	2021-07-05 22:42:47 +0000
@@ -345,7 +345,6 @@
 		case OPT_ATTRIB_SIGDASHES:
 		case OPT_ATTRIB_SIGFILE:
 		case OPT_ATTRIB_SIGNATURE_REPOST:
-		case OPT_ATTRIB_START_EDITOR_OFFSET:
 		case OPT_ATTRIB_THREAD_ARTICLES:
 		case OPT_ATTRIB_THREAD_CATCHUP_ON_EXIT:
 		case OPT_ATTRIB_THREAD_FORMAT:
@@ -1444,11 +1443,6 @@
 								UPDATE_BOOL_ATTRIBUTES(signature_repost);
 							break;
 
-						case OPT_START_EDITOR_OFFSET:
-							if (prompt_option_on_off(option))
-								UPDATE_BOOL_ATTRIBUTES(start_editor_offset);
-							break;
-
 #ifndef USE_CURSES
 						case OPT_STRIP_BLANKS:
 							if (prompt_option_on_off(option)) {
@@ -1752,11 +1746,6 @@
 								SET_BOOL_ATTRIBUTE(signature_repost);
 							break;
 
-						case OPT_ATTRIB_START_EDITOR_OFFSET:
-							if (prompt_option_on_off(option))
-								SET_BOOL_ATTRIBUTE(start_editor_offset);
-							break;
-
 						case OPT_ATTRIB_TEX2ISO_CONV:
 							if (prompt_option_on_off(option))
 								SET_BOOL_ATTRIBUTE(tex2iso_conv);
@@ -2121,7 +2110,7 @@
 						case OPT_EDITOR_FORMAT:
 							if (prompt_option_string(option)) {
 								if (!strlen(tinrc.editor_format))
-									STRCPY(tinrc.editor_format, TIN_EDITOR_FMT_ON);
+									STRCPY(tinrc.editor_format, TIN_EDITOR_FMT);
 								changed |= MISC_OPTS;
 							}
 							break;
@@ -3192,8 +3181,6 @@
 			return curr_scope->state->sigfile;
 		case OPT_ATTRIB_SIGNATURE_REPOST:
 			return curr_scope->state->signature_repost;
-		case OPT_ATTRIB_START_EDITOR_OFFSET:
-			return curr_scope->state->start_editor_offset;
 		case OPT_ATTRIB_THREAD_ARTICLES:
 			return curr_scope->state->thread_articles;
 		case OPT_ATTRIB_THREAD_CATCHUP_ON_EXIT:
@@ -3490,10 +3477,6 @@
 			curr_scope->state->signature_repost = FALSE;
 			tinrc.attrib_signature_repost = default_scope->attribute->signature_repost;
 			break;
-		case OPT_ATTRIB_START_EDITOR_OFFSET:
-			curr_scope->state->start_editor_offset = FALSE;
-			tinrc.attrib_start_editor_offset = default_scope->attribute->start_editor_offset;
-			break;
 		case OPT_ATTRIB_THREAD_ARTICLES:
 			curr_scope->state->thread_articles = FALSE;
 			tinrc.attrib_thread_articles = default_scope->attribute->thread_articles;
@@ -3628,7 +3611,6 @@
 	INITIALIZE_NUM_ATTRIBUTE(show_signatures);
 	INITIALIZE_NUM_ATTRIBUTE(sigdashes);
 	INITIALIZE_NUM_ATTRIBUTE(signature_repost);
-	INITIALIZE_NUM_ATTRIBUTE(start_editor_offset);
 	INITIALIZE_NUM_ATTRIBUTE(thread_articles);
 	INITIALIZE_NUM_ATTRIBUTE(thread_catchup_on_exit);
 	INITIALIZE_NUM_ATTRIBUTE(thread_perc);

=== modified file 'src/tincfg.tbl'
--- src/tincfg.tbl	2021-02-02 15:18:24 +0000
+++ src/tincfg.tbl	2021-07-05 22:41:57 +0000
@@ -282,7 +282,6 @@
 	extquote_regex			OPT_STRING
 #endif
 	force_screen_redraw		OPT_ON_OFF
-	start_editor_offset		OPT_ON_OFF
 	editor_format			OPT_STRING
 	inews_prog			OPT_STRING
 #ifdef USE_CANLOCK
@@ -315,7 +314,6 @@
 #if defined(HAVE_LIBICUUC) && defined(MULTIBYTE_ABLE) && defined(HAVE_UNICODE_UBIDI_H) && !defined(NO_LOCALE)
 	render_bidi			OPT_ON_OFF
 #endif
-	attrib_start_editor_offset	OPT_ON_OFF
 	attrib_editor_format		OPT_STRING
 #ifdef HAVE_ISPELL
 	attrib_ispell			OPT_STRING



More information about the tin-dev mailing list