aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main.c
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-09 16:54:26 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2024-09-09 18:22:21 +0200
commit4f231871a0208ec9bcc2679fce25d3b9795d1597 (patch)
treebdc9055166fe236f009c6640acf53b6706310c27 /src/main.c
parent41ab5cf0289dab60ac1ddc97cf9680ee2468ea6c (diff)
downloadsciteco-4f231871a0208ec9bcc2679fce25d3b9795d1597.tar.gz
added raw ANSI mode to facilitate 8-bit clean editing (refs #5)
* When enabled with bit 2 in the ED flags (0,4ED), all registers and buffers will get the raw ANSI encoding (as if 0EE had been called on them). You can still manually change the encoding, eg. by calling 65001EE afterwards. * Also the ANSI mode sets up character representations for all bytes >= 0x80. This is currently done only depending on the ED flag, not when setting 0EE. * Since setting 16,4ED for 8-bit clean editing in a macro can be tricky - the default unnamed buffer will still be at UTF-8 and at least a bunch of environment registers as well - we added the command line option `--8bit` (short `-8`) which configures the ED flags very early on. As another advantage you can mung the profile in 8-bit mode as well when using SciTECO as a sort of interactive hex editor. * Disable UTF-8 checks in 8-bit clean mode (sample.teco_ini).
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index c38b1a3..abf8d2f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -105,6 +105,7 @@ teco_get_default_config_path(const gchar *program)
static gchar *teco_eval_macro = NULL;
static gboolean teco_mung_file = FALSE;
static gboolean teco_mung_profile = TRUE;
+static gboolean teco_8bit_clean = FALSE;
static gchar *
teco_process_options(gint *argc, gchar ***argv)
@@ -120,6 +121,8 @@ teco_process_options(gint *argc, gchar ***argv)
"Do not mung "
"$SCITECOCONFIG" G_DIR_SEPARATOR_S INI_FILE " "
"even if it exists"},
+ {"8bit", '8', 0, G_OPTION_ARG_NONE, &teco_8bit_clean,
+ "Use ANSI encoding by default and disable automatic EOL conversion"},
{NULL}
};
@@ -320,6 +323,10 @@ main(int argc, char **argv)
* to the macro or munged file.
*/
+ if (teco_8bit_clean)
+ /* equivalent to 16,4ED but executed earlier */
+ teco_ed = (teco_ed & ~TECO_ED_AUTOEOL) | TECO_ED_DEFAULT_ANSI;
+
/*
* Theoretically, QReg tables should only be initialized
* after the interface, since they contain Scintilla documents.