From 26e2b6a8d389f691a6e721381d5e412557fe4ea4 Mon Sep 17 00:00:00 2001 From: "David C. Rankin" Date: Mon, 1 Oct 2018 17:27:58 -0500 Subject: [PATCH] Initialize bstack variables in context_init() and add bstack_clear() in mainwin keypress handler to eliminate initial shift-left issue. --- README.md | 2 +- gtk_appdata.c | 3 +++ gtk_filebuf.c | 2 +- gtk_windef.c | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 636e881..a65aa02 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ The editor provides case-conversion, lower-to-upper, upper-to-lower, and title-c Word-completion is provided by GtkSourceView. [Return] is used to activate the selected proposal. Word-completion can be enabled/disabed in Settings->File Load/Save->Word-completion. The settings dialog allows setting the minimum number of characters typed before the word-completion dialog appears. (default: 3) -A custom keypress input handler for `Ctrl+Shift+Right-Arrow` and `Ctrl+Shift+Left-Arrow` to correct the annoying default gtk handler that will *select-to-end-of-next-word* when used in leading whitespace instead of the desired behavior of *select-to-beginning-of-next-word*. A cusom keypress hanlder for `Shift+Left-Arrow` is also included as part of the fix to allows reduction of the selection original selection on a per-character basis by releasing the `Ctrl` key and using `Shift+Left-Arrow`. (no corresponding `Shift+Right-Arrow` is required as the default behavior handles reduction of the slection started with `Ctrl+Shift+Right-Arrow` just fine. A configuration option in Settings, `Appearance->Cursor & Selection->Ctrl + Shift + Right-Arrow fix`. This enables a corresponding keypress handler for `Ctrl+Shift+Left-Arrow` and small stack to track sequential `Ctrl+Shift+Left/Right` events. This is set on by default. To restore default gtk handling, simply uncheck the box in settings. +A custom keypress input handler for `Ctrl+Shift+Right-Arrow` and `Ctrl+Shift+Left-Arrow` to correct the annoying default gtk handler that will *select-to-end-of-next-word* when used in leading whitespace instead of the desired behavior of *select-to-beginning-of-next-word*. A cusom keypress hanlder for `Shift+Left-Arrow` is also included as part of the fix to allow reduction of the selection original selection on a per-character basis by releasing the `Ctrl` key and using `Shift+Left-Arrow`. (no corresponding `Shift+Right-Arrow` is required as the default behavior handles reduction of the slection started with `Ctrl+Shift+Right-Arrow` just fine. A configuration option in Settings, `Appearance->Cursor & Selection->Ctrl + Shift + Right-Arrow fix`. This enables a corresponding keypress handler for `Ctrl+Shift+Left-Arrow` and small stack to track sequential `Ctrl+Shift+Left/Right` events. This is set on by default. To restore default gtk handling, simply uncheck the box in settings. End-of-line detection (`LF`, `CRLF` and `CR`) is provided on file-open and can be selected in the `Tools` menu. Default EOL for new files on each operating system except DOS/Windows is `LF` (line-feed), with the DOS/Windows default being `CRLF`. Pre-OSX `CR` will be detected and set on File-Open, but no specific pre-processor check tests for earlier MacOS. After open, or change of any new file, selecting a different EOL (from the `Tools menu` or within `Settings`) will convert the file to the selected EOL. `Settings->File Load/Save->End-of-Line Handling/Selection` allows for a persistent EOL to be selected along with options for `Use EOL from File` or `Use OS Default` (default). When set to anything other than `Use EOL from File`, a prompt on file-open is presented to convert to the persistent EOL setting if the file EOL differs from the persistent setting. Once open, the `Tools->End of Line Selection` operates independent of the persistent setting allowing conversion to/from any of the line endings without affecting the persistent setting. diff --git a/gtk_appdata.c b/gtk_appdata.c index 883cf31..8076f3d 100644 --- a/gtk_appdata.c +++ b/gtk_appdata.c @@ -491,6 +491,9 @@ void context_init (kwinst *app, char **argv) /* load default values */ context_set_defaults (app, argv); + /* initialze bstack variables zero */ + bstack_clear (app); + /* create an empty key_file */ app->keyfile = g_key_file_new(); diff --git a/gtk_filebuf.c b/gtk_filebuf.c index f0ad84d..6e4aa49 100644 --- a/gtk_filebuf.c +++ b/gtk_filebuf.c @@ -1561,7 +1561,7 @@ void ibar_eol_chk_default (kwinst *app) g_free (msg); } } -g_print ("ibar_eol_chk_default - out\n"); + } /** EOL check against default setting on file open to warn of mismatch */ diff --git a/gtk_windef.c b/gtk_windef.c index dce5862..130604f 100644 --- a/gtk_windef.c +++ b/gtk_windef.c @@ -343,6 +343,10 @@ gboolean on_keypress (GtkWidget *widget, GdkEventKey *event, kwinst *app) app->kphome = FALSE; /* reset kphome - return above protects needed TRUE */ + /* if any other key and bindex or bstack[0], clear stack */ + if (app->bindex || app->bstack[0]) + bstack_clear (app); + return FALSE; if (widget) {}