<feed xmlns='http://www.w3.org/2005/Atom'>
<title>sciteco/src, branch master</title>
<subtitle>Scintilla-based Text Editor and COrrector</subtitle>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/'/>
<entry>
<title>Revert "optimize main state machine transitions with tail calls"</title>
<updated>2026-08-23T20:08:16+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-23T20:08:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=33bab281e27cf866e77fb3bba6e37f5a5edfef03'/>
<id>33bab281e27cf866e77fb3bba6e37f5a5edfef03</id>
<content type='text'>
For yet unknown reasons this does not improve performance on GCC 16
even though it also supports `__attribute__((musttail))`.
As long as I do not understand why, I don't want to risk any
unnecessary problems. I have reason to believe that the tail-call
optimized version still has subtle bugs.

See also the "tail-calls" branch.

This reverts commit 2e097cec409182c3cb39b74489387480bf8a278f.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For yet unknown reasons this does not improve performance on GCC 16
even though it also supports `__attribute__((musttail))`.
As long as I do not understand why, I don't want to risk any
unnecessary problems. I have reason to believe that the tail-call
optimized version still has subtle bugs.

See also the "tail-calls" branch.

This reverts commit 2e097cec409182c3cb39b74489387480bf8a278f.
</pre>
</div>
</content>
</entry>
<entry>
<title>curses/UNIX: improved error handling in teco_interface_{set,get}_clipboard()</title>
<updated>2026-08-23T10:27:44+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-23T10:27:44+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=6aa97a68a85b83267de597bfb30b70c04b7de97b'/>
<id>6aa97a68a85b83267de597bfb30b70c04b7de97b</id>
<content type='text'>
Now use the teco_spawn_check_wait_status(), which was previously in spawn.c,
so we no longer have to handle the UNIX-specific WEXITSTATUS() macros.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now use the teco_spawn_check_wait_status(), which was previously in spawn.c,
so we no longer have to handle the UNIX-specific WEXITSTATUS() macros.
</pre>
</div>
</content>
</entry>
<entry>
<title>introduced helper functions teco_qreg_table_get_string() and teco_qreg_table_get_integer()</title>
<updated>2026-08-22T22:28:23+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-22T22:28:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=32122651bdb51006edce2be3586dd09179bed52f'/>
<id>32122651bdb51006edce2be3586dd09179bed52f</id>
<content type='text'>
* Simplifies the common task of querying an integer or string from a Q-Register table.
* Undefined Q-Regs are reported as TECO_ERROR_QREGUNDEF, so you can theoretically
  handle this case. In practice however, it requires less boilerplating to
  just call teco_qreg_table_find() manually.
* It also doesn't make sense to use these functions when getting and setting
  a register at the same time as you will want to avoid repeated lookups.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Simplifies the common task of querying an integer or string from a Q-Register table.
* Undefined Q-Regs are reported as TECO_ERROR_QREGUNDEF, so you can theoretically
  handle this case. In practice however, it requires less boilerplating to
  just call teco_qreg_table_find() manually.
* It also doesn't make sense to use these functions when getting and setting
  a register at the same time as you will want to avoid repeated lookups.
</pre>
</div>
</content>
</entry>
<entry>
<title>optimize main state machine transitions with tail calls</title>
<updated>2026-08-22T20:27:33+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-22T20:27:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=2e097cec409182c3cb39b74489387480bf8a278f'/>
<id>2e097cec409182c3cb39b74489387480bf8a278f</id>
<content type='text'>
* On newer GCC (&gt;= 15) and Clang (&gt;= 13) versions we can tail call
  at the end of input_cb() implementations to the next state's input_cb(),
  which will be optimized to jumps (often direct jumps).
  That is, the compilers always optimized tail calls, but we can
  guarantee tail calls with the __attribute__((musttail)) statement
  attribute.
* Every `return &amp;teco_state_xxx` has to be replaced with
  `TECO_RETURN(ctx, &amp;teco_state_xxx, error)`.
* This speeds up `-O2 -flto` builds by 18%
  (e.g. tested on grosciteco for sciteco(7)).
  Part of the speed up could also be because of inlining through
  TECO_RETURN().
* The other state machines (stringbuilding and q-reg spec) cannot
  currently be optimized the same way since they get their characters
  passed in from the "main" state machine.
* All loops around callbacks could be optimized the same way.
  E.g. the undo token runner could also tail call into the next runner,
  but it's probably not important to optimize undo token executions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* On newer GCC (&gt;= 15) and Clang (&gt;= 13) versions we can tail call
  at the end of input_cb() implementations to the next state's input_cb(),
  which will be optimized to jumps (often direct jumps).
  That is, the compilers always optimized tail calls, but we can
  guarantee tail calls with the __attribute__((musttail)) statement
  attribute.
* Every `return &amp;teco_state_xxx` has to be replaced with
  `TECO_RETURN(ctx, &amp;teco_state_xxx, error)`.
* This speeds up `-O2 -flto` builds by 18%
  (e.g. tested on grosciteco for sciteco(7)).
  Part of the speed up could also be because of inlining through
  TECO_RETURN().
* The other state machines (stringbuilding and q-reg spec) cannot
  currently be optimized the same way since they get their characters
  passed in from the "main" state machine.
* All loops around callbacks could be optimized the same way.
  E.g. the undo token runner could also tail call into the next runner,
  but it's probably not important to optimize undo token executions.
</pre>
</div>
</content>
</entry>
<entry>
<title>don't crash on `0N...$`, but always throw an error</title>
<updated>2026-08-18T19:32:03+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-18T19:32:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=3ae89e34f6a04dd553f3871856521334a4dbe62f'/>
<id>3ae89e34f6a04dd553f3871856521334a4dbe62f</id>
<content type='text'>
See also 8a8edaa2daf37f7c12e21b9199755b5de8e489f5.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See also 8a8edaa2daf37f7c12e21b9199755b5de8e489f5.
</pre>
</div>
</content>
</entry>
<entry>
<title>curses: check for return values of newpad() and newwin()</title>
<updated>2026-08-12T23:04:41+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-12T22:49:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=64c8e378b251669241a3565adf2c8f2d792e1b8d'/>
<id>64c8e378b251669241a3565adf2c8f2d792e1b8d</id>
<content type='text'>
These can fail, so abort() just like glib does internally in case of OOM.
A special case is the pad allocation for autocompletion popups, which
can have excessively many lines. This is handled gracefully now
(the popup simply won't be displayed).
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These can fail, so abort() just like glib does internally in case of OOM.
A special case is the pad allocation for autocompletion popups, which
can have excessively many lines. This is handled gracefully now
(the popup simply won't be displayed).
</pre>
</div>
</content>
</entry>
<entry>
<title>LSP: support ctags-lsp</title>
<updated>2026-08-12T23:04:41+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-12T22:29:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=b24c22dd15c0b02847d105b12e2fde72cb301d7d'/>
<id>b24c22dd15c0b02847d105b12e2fde72cb301d7d</id>
<content type='text'>
* It sends `null` instead of empty lists, even though this is violating the LSP specs.
* Filter out duplicates from the auto-completion lists.
  This may benefit other servers as well.
* ctags-lsp does not fuzzy search for workspace/symbol, so auto-completions
  aren't really a thing.
  The only special case is sending the empty string, which results in
  all symbols being returned. This can be slow, though.
* ctags-lsp does not support textDocument/references, so n:FT$ won't be supported.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* It sends `null` instead of empty lists, even though this is violating the LSP specs.
* Filter out duplicates from the auto-completion lists.
  This may benefit other servers as well.
* ctags-lsp does not fuzzy search for workspace/symbol, so auto-completions
  aren't really a thing.
  The only special case is sending the empty string, which results in
  all symbols being returned. This can be slow, though.
* ctags-lsp does not support textDocument/references, so n:FT$ won't be supported.
</pre>
</div>
</content>
</entry>
<entry>
<title>LSP: ignore not only server notifications but all requests as well</title>
<updated>2026-08-11T20:15:21+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-11T20:03:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=259678833ad563f43d789c33e5304b2b7c6853cb'/>
<id>259678833ad563f43d789c33e5304b2b7c6853cb</id>
<content type='text'>
* We use 23 now as the "id" for all JSON-RPC requests.
* Every message with a different "id" can be ignored,
  as it is a request, we haven't advertised to support.
  Alternatively, we should perhaps send an error response to
  unexpected requests?
* Fixes support for the ccls server which sends window/workDoneProgress/create
  even though I didn't advertise it.
  ccls cannot practically be used with FTsymbol$ though since it returns
  full declarations.
  You can perform a fuzzy symbol search, though.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* We use 23 now as the "id" for all JSON-RPC requests.
* Every message with a different "id" can be ignored,
  as it is a request, we haven't advertised to support.
  Alternatively, we should perhaps send an error response to
  unexpected requests?
* Fixes support for the ccls server which sends window/workDoneProgress/create
  even though I didn't advertise it.
  ccls cannot practically be used with FTsymbol$ though since it returns
  full declarations.
  You can perform a fuzzy symbol search, though.
</pre>
</div>
</content>
</entry>
<entry>
<title>LSP: use 0 (NULL) as the invalid value for GPid</title>
<updated>2026-08-11T19:05:49+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-11T19:05:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=1b43702731178ae8c2e4d5155e20ae1be6aa49c0'/>
<id>1b43702731178ae8c2e4d5155e20ae1be6aa49c0</id>
<content type='text'>
Should fix Windows builds.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Should fix Windows builds.
</pre>
</div>
</content>
</entry>
<entry>
<title>support lookups via language servers (LSP)</title>
<updated>2026-08-10T22:38:31+00:00</updated>
<author>
<name>Robin Haberkorn</name>
<email>rhaberkorn@fmsbw.de</email>
</author>
<published>2026-08-02T13:24:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.fmsbw.de/sciteco/commit/?id=44f5bf677282308b959411c416da2b5b08db2062'/>
<id>44f5bf677282308b959411c416da2b5b08db2062</id>
<content type='text'>
* The main interface is the `FT` command.
  `FT` was an undocumented Video TECO command for etags/ctags lookups.
  I don't want to exactly copy its interface, though.
* `FT` allows looking up symbol names,
  definitions and references.
* ctags will be supported via ctags-lsp.
  LSP support is more powerful though and works without
  regenerating TAGS files all the time.
  The LSP will also allow you to customize auto-completions
  using SciTECO itself (i.e. by writing a language server
  in SciTECO).
* For multiple results, `FT$` can be used to cycle through
  results - this should mimic repeated `S$` or `N$`.
* `:FT...$` does a fuzzy search. IMHO it's not important
  to return a status integer instead. `FT` will only
  really be used in interactive mode.
* Document synchronization is supported via hooks from
  ring.c and via Scintilla notifications.
* Currently, the LSP communication is based on blocking
  GIOChannels. This means that a misbehaving hanging
  server could "lock up" the entire editor (FIXME).
  Only on ncurses you can always kill the subprocess by
  pressing CTRL+C.
  We need helper functions in spawn.c to read and write
  with interruptions.
* The textDocument/didChange notification transmits
  not only all edits, but all files' contents as well
  during initial synchronization.
  Therefore it is optimized to write and JSON-escape
  data without copying them around in memory and without
  destroying the buffer gap.
* Use $SCITECO_LSP to configure the language server.
  You can also use `tee` to capture stdin and stdout.
  Perhaps $SCITECO_LSP should be saved in .teco_session,
  so you can change it between projects?
* $SCITECO_LSP_ROOT is used to point to the project's
  root directory. session.tes will set it up automatically.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* The main interface is the `FT` command.
  `FT` was an undocumented Video TECO command for etags/ctags lookups.
  I don't want to exactly copy its interface, though.
* `FT` allows looking up symbol names,
  definitions and references.
* ctags will be supported via ctags-lsp.
  LSP support is more powerful though and works without
  regenerating TAGS files all the time.
  The LSP will also allow you to customize auto-completions
  using SciTECO itself (i.e. by writing a language server
  in SciTECO).
* For multiple results, `FT$` can be used to cycle through
  results - this should mimic repeated `S$` or `N$`.
* `:FT...$` does a fuzzy search. IMHO it's not important
  to return a status integer instead. `FT` will only
  really be used in interactive mode.
* Document synchronization is supported via hooks from
  ring.c and via Scintilla notifications.
* Currently, the LSP communication is based on blocking
  GIOChannels. This means that a misbehaving hanging
  server could "lock up" the entire editor (FIXME).
  Only on ncurses you can always kill the subprocess by
  pressing CTRL+C.
  We need helper functions in spawn.c to read and write
  with interruptions.
* The textDocument/didChange notification transmits
  not only all edits, but all files' contents as well
  during initial synchronization.
  Therefore it is optimized to write and JSON-escape
  data without copying them around in memory and without
  destroying the buffer gap.
* Use $SCITECO_LSP to configure the language server.
  You can also use `tee` to capture stdin and stdout.
  Perhaps $SCITECO_LSP should be saved in .teco_session,
  so you can change it between projects?
* $SCITECO_LSP_ROOT is used to point to the project's
  root directory. session.tes will set it up automatically.
</pre>
</div>
</content>
</entry>
</feed>
