<feed xmlns='http://www.w3.org/2005/Atom'>
<title>sciteco/src/interface-curses, branch hsrex</title>
<subtitle>Scintilla-based Text Editor and COrrector</subtitle>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/'/>
<entry>
<title>function key macros have been reworked into a more generic key macro feature</title>
<updated>2024-09-12T14:44:13+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2024-09-12T11:55:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=abb5d23eba21a2aafda0346c0c5dd845561b2aa2'/>
<id>abb5d23eba21a2aafda0346c0c5dd845561b2aa2</id>
<content type='text'>
* ALL keypresses (the UTF-8 sequences resulting from key presses) can now be remapped.
* This is especially useful with Unicode support, as you might want to alias
  international characters to their corresponding latin form in the start state,
  so you don't have to change keyboard layouts so often.
  This is done automatically in Gtk, where we have hardware key press information,
  but has to be done with key macros in Curses.
  There is a new key mask 4 (bit 3) for that purpose now.
* Also, you might want to define non-ANSI letters to perform special functions in
  the start state where it won't be accepted by the parser anyway.
  Suppose you have a macro M→, you could define
  @^U[^K→]{m→} 1^_U[^K→]
  This effectively "extends" the parser and allow you to call macro "→" by a single
  key press. See also #5.
* The register prefix has been changed from ^F (for function) to ^K (for key).
  This is the only thing you have to change in order to migrate existing
  function key macros.
* Key macros are enabled by default. There is no longer any way to disable
  function key handling in curses, as I never found any reason or need to disable it.
  Theoretically, the default ESCDELAY could turn out to be too small and function
  keys don't get through. I doubt that's possible unless on extremely slow serial lines.
  Even then, you'd have to increase ESCDELAY and instead of disabling function keys
  simply define an escape surrogate.
* The ED flag has been removed and its place is reserved for a future mouse support flag
  (which does make sense to disable in curses sometimes).
  fnkeys.tes is consequently also enabled by default in sample.teco_ini.
* Key macros are handled as an unit. If one character results in an error,
  the entire string is rubbed out.
  This fixes the "CLOSE" key on Gtk.
  It also makes sure that the original error message is preserved and not overwritten
  by some subsequent syntax error.
  It was never useful that we kept inserting characters after the first error.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* ALL keypresses (the UTF-8 sequences resulting from key presses) can now be remapped.
* This is especially useful with Unicode support, as you might want to alias
  international characters to their corresponding latin form in the start state,
  so you don't have to change keyboard layouts so often.
  This is done automatically in Gtk, where we have hardware key press information,
  but has to be done with key macros in Curses.
  There is a new key mask 4 (bit 3) for that purpose now.
* Also, you might want to define non-ANSI letters to perform special functions in
  the start state where it won't be accepted by the parser anyway.
  Suppose you have a macro M→, you could define
  @^U[^K→]{m→} 1^_U[^K→]
  This effectively "extends" the parser and allow you to call macro "→" by a single
  key press. See also #5.
* The register prefix has been changed from ^F (for function) to ^K (for key).
  This is the only thing you have to change in order to migrate existing
  function key macros.
* Key macros are enabled by default. There is no longer any way to disable
  function key handling in curses, as I never found any reason or need to disable it.
  Theoretically, the default ESCDELAY could turn out to be too small and function
  keys don't get through. I doubt that's possible unless on extremely slow serial lines.
  Even then, you'd have to increase ESCDELAY and instead of disabling function keys
  simply define an escape surrogate.
* The ED flag has been removed and its place is reserved for a future mouse support flag
  (which does make sense to disable in curses sometimes).
  fnkeys.tes is consequently also enabled by default in sample.teco_ini.
* Key macros are handled as an unit. If one character results in an error,
  the entire string is rubbed out.
  This fixes the "CLOSE" key on Gtk.
  It also makes sure that the original error message is preserved and not overwritten
  by some subsequent syntax error.
  It was never useful that we kept inserting characters after the first error.
</pre>
</div>
</content>
</entry>
<entry>
<title>the SciTECO parser is Unicode-based now (refs #5)</title>
<updated>2024-09-11T14:14:27+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2024-09-11T10:21:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=68578072bfaf6054a96bb6bcedfccb6e56a508fe'/>
<id>68578072bfaf6054a96bb6bcedfccb6e56a508fe</id>
<content type='text'>
The following rules apply:
 * All SciTECO macros __must__ be in valid UTF-8, regardless of the
   the register's configured encoding.
   This is checked against before execution, so we can use glib's non-validating
   UTF-8 API afterwards.
 * Things will inevitably get slower as we have to validate all macros first
   and convert to gunichar for each and every character passed into the parser.
   As an optimization, it may make sense to have our own inlineable version of
   g_utf8_get_char() (TODO).
   Also, Unicode glyphs in syntactically significant positions may be case-folded -
   just like ASCII chars were. This is is of course slower than case folding
   ASCII. The impact of this should be measured and perhaps we should restrict
   case folding to a-z via teco_ascii_toupper().
 * The language itself does not use any non-ANSI characters, so you don't have to
   use UTF-8 characters.
 * Wherever the parser expects a single character, it will now accept an arbitrary
   Unicode/UTF-8 glyph as well.
   In other words, you can call macros like M§ instead of having to write M[§].
   You can also get the codepoint of any Unicode character with ^^x.
   Pressing an Unicode character in the start state or in Ex and Fx will now
   give a sane error message.
 * When pressing a key which produces a multi-byte UTF-8 sequence, the character
   gets translated back and forth multiple times:
   1. It's converted to an UTF-8 string, either buffered or by IME methods (Gtk).
      On Curses we could directly get a wide char using wget_wch(), but it's
      not currently used, so we don't depend on widechar curses.
   2. Parsed into gunichar for passing into the edit command callbacks.
      This also validates the codepoint - everything later on can assume valid
      codepoints and valid UTF-8 strings.
   3. Once the edit command handling decides to insert the key into the command line,
      it is serialized back into an UTF-8 string as the command line macro has
      to be in UTF-8 (like all other macros).
   4. The parser reads back gunichars without validation for passing into
      the parser callbacks.
 * Flickering in the Curses UI and Pango warnings in Gtk, due to incompletely
   inserted and displayed UTF-8 sequences, are now fixed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The following rules apply:
 * All SciTECO macros __must__ be in valid UTF-8, regardless of the
   the register's configured encoding.
   This is checked against before execution, so we can use glib's non-validating
   UTF-8 API afterwards.
 * Things will inevitably get slower as we have to validate all macros first
   and convert to gunichar for each and every character passed into the parser.
   As an optimization, it may make sense to have our own inlineable version of
   g_utf8_get_char() (TODO).
   Also, Unicode glyphs in syntactically significant positions may be case-folded -
   just like ASCII chars were. This is is of course slower than case folding
   ASCII. The impact of this should be measured and perhaps we should restrict
   case folding to a-z via teco_ascii_toupper().
 * The language itself does not use any non-ANSI characters, so you don't have to
   use UTF-8 characters.
 * Wherever the parser expects a single character, it will now accept an arbitrary
   Unicode/UTF-8 glyph as well.
   In other words, you can call macros like M§ instead of having to write M[§].
   You can also get the codepoint of any Unicode character with ^^x.
   Pressing an Unicode character in the start state or in Ex and Fx will now
   give a sane error message.
 * When pressing a key which produces a multi-byte UTF-8 sequence, the character
   gets translated back and forth multiple times:
   1. It's converted to an UTF-8 string, either buffered or by IME methods (Gtk).
      On Curses we could directly get a wide char using wget_wch(), but it's
      not currently used, so we don't depend on widechar curses.
   2. Parsed into gunichar for passing into the edit command callbacks.
      This also validates the codepoint - everything later on can assume valid
      codepoints and valid UTF-8 strings.
   3. Once the edit command handling decides to insert the key into the command line,
      it is serialized back into an UTF-8 string as the command line macro has
      to be in UTF-8 (like all other macros).
   4. The parser reads back gunichars without validation for passing into
      the parser callbacks.
 * Flickering in the Curses UI and Pango warnings in Gtk, due to incompletely
   inserted and displayed UTF-8 sequences, are now fixed.
</pre>
</div>
</content>
</entry>
<entry>
<title>allow Unicode characters in command line arguments (refs #5)</title>
<updated>2024-09-09T16:22:21+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2024-08-29T00:12:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=90bad24f96deeaaa2255f0ad89ece21d5397b78b'/>
<id>90bad24f96deeaaa2255f0ad89ece21d5397b78b</id>
<content type='text'>
* the locale must be initialized very early before g_option_context_parse()
* will allow UTF-8 characters in the test suite
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* the locale must be initialized very early before g_option_context_parse()
* will allow UTF-8 characters in the test suite
</pre>
</div>
</content>
</entry>
<entry>
<title>input and displaying of Unicode characters is now possible (refs #5)</title>
<updated>2024-09-09T16:16:07+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2024-08-28T10:59:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=4c6b6814abfc9c022c6ea8d1e23097c2a774fde5'/>
<id>4c6b6814abfc9c022c6ea8d1e23097c2a774fde5</id>
<content type='text'>
* All non-ASCII characters are inserted as Unicode.
  On Curses, this also requires a properly set up locale.
* We still do not need any widechar Curses, as waddch() handles
  multibyte characters on ncurses.
  We will see whether there is any Curses variant that strictly requires
  wadd_wch().
  If this will be an exception, we might keep both widechar and non-widechar
  support.
* By convention gsize is used exclusively for byte sizes.
  Character offsets or lengths use int or long.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* All non-ASCII characters are inserted as Unicode.
  On Curses, this also requires a properly set up locale.
* We still do not need any widechar Curses, as waddch() handles
  multibyte characters on ncurses.
  We will see whether there is any Curses variant that strictly requires
  wadd_wch().
  If this will be an exception, we might keep both widechar and non-widechar
  support.
* By convention gsize is used exclusively for byte sizes.
  Character offsets or lengths use int or long.
</pre>
</div>
</content>
</entry>
<entry>
<title>updated copyright to 2024</title>
<updated>2024-01-21T11:45:05+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2024-01-21T11:07:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=1cecf04656532e94e1fe9fe25460774324b2197c'/>
<id>1cecf04656532e94e1fe9fe25460774324b2197c</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>fixed caret scrolling on startup</title>
<updated>2023-06-18T15:50:39+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2023-06-18T15:50:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=493504f12f79990dae7791efa27366b560151f2c'/>
<id>493504f12f79990dae7791efa27366b560151f2c</id>
<content type='text'>
* Since Scintilla no longer automatically scrolls the caret (see 941f48da6dde691a7800290cc729aaaacd051392),
  the caret wouldn't always end up in the view on startup.
* Added teco_interface_refresh() which includes SCI_SCROLLCARET and
  is invoked on startup. This helps with the Curses backend.
  It also reduces code redundancies.
* On Gtk, the caret cannot be easily scrolled on startup as long as no size is allocated
  to the window, so we also added a size-allocate callback to the
  window's event box. Sizes are less often allocated to the event box than to the
  window itself for some strange reason.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Since Scintilla no longer automatically scrolls the caret (see 941f48da6dde691a7800290cc729aaaacd051392),
  the caret wouldn't always end up in the view on startup.
* Added teco_interface_refresh() which includes SCI_SCROLLCARET and
  is invoked on startup. This helps with the Curses backend.
  It also reduces code redundancies.
* On Gtk, the caret cannot be easily scrolled on startup as long as no size is allocated
  to the window, so we also added a size-allocate callback to the
  window's event box. Sizes are less often allocated to the event box than to the
  window itself for some strange reason.
</pre>
</div>
</content>
</entry>
<entry>
<title>fixed CTRL+C interruptions on Windows; optimized CTRL+C polling on Gtk+</title>
<updated>2023-05-09T17:08:32+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2023-05-09T17:08:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=f557af9a9112955d3b65f6ad0d54c0791189f961'/>
<id>f557af9a9112955d3b65f6ad0d54c0791189f961</id>
<content type='text'>
* teco_interrupt() turned out to be unsuitable to kill child processes (eg. when &lt;EB&gt; hangs).
  Instead, we have Win32-specific code now.
* Since SIGINT can be ignored on UNIX, pressing CTRL+C was not guaranteed to kill the
  child process (eg. when &lt;EB&gt; hangs).
  At the same time, it makes sense to send SIGINT first, so programs can terminate gracefully.
  The behaviour has therefore been adapted: Interrupting with CTRL+C the first time will kill
  gracefully. The second time, a more agressive signal is sent to kill the child process.
  Unfortunately, this would be relatively tricky and complicated to do on Windows, so CTRL+C will always
  "hard-kill" the child process.
* Moreover, teco_interrupt() killed the entire process on Windows when called the second time.
  This resulted in any interruption to terminate SciTECO unexpectedly when tried the second time on Gtk/Win32.
* teco_sigint_occurred renamed to teco_interrupted:
  There may be several different sources for setting this flag.
* Checking for CTRL+C on Gtk involves driving the main event loop repeatedly.
  This is a very expensive operation. We now do that only every 100ms. This is still sufficient since
  keyboard input comes from humans.
  This optimization saves 75% runtime on Windows and 90% on Linux.
  * The same optimization turned out to be contraproductive on PDCurses/WinGUI.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* teco_interrupt() turned out to be unsuitable to kill child processes (eg. when &lt;EB&gt; hangs).
  Instead, we have Win32-specific code now.
* Since SIGINT can be ignored on UNIX, pressing CTRL+C was not guaranteed to kill the
  child process (eg. when &lt;EB&gt; hangs).
  At the same time, it makes sense to send SIGINT first, so programs can terminate gracefully.
  The behaviour has therefore been adapted: Interrupting with CTRL+C the first time will kill
  gracefully. The second time, a more agressive signal is sent to kill the child process.
  Unfortunately, this would be relatively tricky and complicated to do on Windows, so CTRL+C will always
  "hard-kill" the child process.
* Moreover, teco_interrupt() killed the entire process on Windows when called the second time.
  This resulted in any interruption to terminate SciTECO unexpectedly when tried the second time on Gtk/Win32.
* teco_sigint_occurred renamed to teco_interrupted:
  There may be several different sources for setting this flag.
* Checking for CTRL+C on Gtk involves driving the main event loop repeatedly.
  This is a very expensive operation. We now do that only every 100ms. This is still sufficient since
  keyboard input comes from humans.
  This optimization saves 75% runtime on Windows and 90% on Linux.
  * The same optimization turned out to be contraproductive on PDCurses/WinGUI.
</pre>
</div>
</content>
</entry>
<entry>
<title>Curses: do not allow typing any non-ASCII characters - fixes crashes on PDCurses/WinGUI</title>
<updated>2023-04-20T10:23:39+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2023-04-20T10:23:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=5470fc3a63ff1cb15d7d5128e5c9d682dda28341'/>
<id>5470fc3a63ff1cb15d7d5128e5c9d682dda28341</id>
<content type='text'>
* we can neither display, nor parse Unicode characters properly, so this does not worsen anything
* makes it harder to confuse the parser as long as we do not support Unicode.
* behaves like on Gtk: pressing a non-ASCII char will simply be ignored
* Most importantly, this fixes crashes on PDCurses/WinGUI.
  It apparently couldn't handle the negative integers that resulted from passing a value &gt;= 0x80 &lt;= 0xFF
  into gchar (which is a signed integer).
  Changing everything into guchar is not worth the effort - we need full Unicode support anyway.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* we can neither display, nor parse Unicode characters properly, so this does not worsen anything
* makes it harder to confuse the parser as long as we do not support Unicode.
* behaves like on Gtk: pressing a non-ASCII char will simply be ignored
* Most importantly, this fixes crashes on PDCurses/WinGUI.
  It apparently couldn't handle the negative integers that resulted from passing a value &gt;= 0x80 &lt;= 0xFF
  into gchar (which is a signed integer).
  Changing everything into guchar is not worth the effort - we need full Unicode support anyway.
</pre>
</div>
</content>
</entry>
<entry>
<title>no longer try to avoid automatic scrolling - this is patched out of Scintilla now</title>
<updated>2023-04-18T09:11:55+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2023-04-18T09:11:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=941f48da6dde691a7800290cc729aaaacd051392'/>
<id>941f48da6dde691a7800290cc729aaaacd051392</id>
<content type='text'>
* The patch avoids all automatic scrolling consistently, including in SCI_UNDO.
  This speads up Undo (especially after interruptions).
* Also, the patch disables a very costly and pointless (in SciTECO) algorithm that
  effectively made &lt;Ix$&gt; uninterruptible.
* Effectively reverts large parts of 8ef010da59743fcc4927c790f585ba414ec7b129.
  I have never liked using unintuitive Scintilla messages to avoid scrolling.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* The patch avoids all automatic scrolling consistently, including in SCI_UNDO.
  This speads up Undo (especially after interruptions).
* Also, the patch disables a very costly and pointless (in SciTECO) algorithm that
  effectively made &lt;Ix$&gt; uninterruptible.
* Effectively reverts large parts of 8ef010da59743fcc4927c790f585ba414ec7b129.
  I have never liked using unintuitive Scintilla messages to avoid scrolling.
</pre>
</div>
</content>
</entry>
<entry>
<title>updated Scintilla to v5.3.4, Scinterm to v4.1 and Lexilla to v5.2.4</title>
<updated>2023-04-16T09:59:50+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>robin.haberkorn@googlemail.com</email>
</author>
<published>2023-04-16T09:59:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=2344b11599ce696ebc0bd7773befada44246897c'/>
<id>2344b11599ce696ebc0bd7773befada44246897c</id>
<content type='text'>
* actually everything is updated to their current HEADs but the aforementioned versions are close.
* Scintilla uses threads now, so we added checks for pthread.
  To be on the safe side, we imported AX_PTHREAD from the Autoconf archives.
  The flags are kept out of the ordinary build system, though and used only for compiling Scintilla
  and for linking.
  SciTECO may also use threads, but via Glib.
* Scinterm removed SCI_COLOR_PAIR(), so we re-added it to src/interface-curses/interface.c.
* There is an Asciidoc lexer now.
* The &lt;Ix$&gt; interruption bug (see TODO) is not fixed by this upgrade.
  Perhaps the Mac OS version runs better now. Feedback is needed (refs #12).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* actually everything is updated to their current HEADs but the aforementioned versions are close.
* Scintilla uses threads now, so we added checks for pthread.
  To be on the safe side, we imported AX_PTHREAD from the Autoconf archives.
  The flags are kept out of the ordinary build system, though and used only for compiling Scintilla
  and for linking.
  SciTECO may also use threads, but via Glib.
* Scinterm removed SCI_COLOR_PAIR(), so we re-added it to src/interface-curses/interface.c.
* There is an Asciidoc lexer now.
* The &lt;Ix$&gt; interruption bug (see TODO) is not fixed by this upgrade.
  Perhaps the Mac OS version runs better now. Feedback is needed (refs #12).
</pre>
</div>
</content>
</entry>
</feed>
