aboutsummaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)AuthorFilesLines
2016-11-01simplify bootstrap.am and avoid warning about GNU make $(shell) functionRobin Haberkorn1-4/+8
* the `date` utility is now invoked by SciTECO which avoids automake warnings because of $(shell). The command line should work on Windows as well when SciTECO executes using cmd.exe (hopefully).
2016-11-01updated TODORobin Haberkorn1-0/+42
2016-08-19added test group for SciTECO's EOL normalisation featureRobin Haberkorn5-0/+21
2016-08-19Integrated clipboard supportRobin Haberkorn20-441/+1460
* mapped to different registers beginning with "~" * on supported platforms accessing the clipboard is as easy as X~ or G~. Naturally this also allows clipboards to be pasted in string arguments/insertions (^EQ~). * Currently, Gtk+, PDCurses and ncurses/XTerm are supported. For XTerm clipboard support, users must set 0,256ED to enable it since we cannot check for XTerm window ops programmatically (at least without libX11). * When clipboard regs exist, the clipboard can also be deemed functional. This allows macros to fall back to xclip(1) if necessary. * EOL handling has been moved into a new file eol.c and eol.h. EOL translation no longer depends on GIOChannels but can be memory-backed as well.
2016-08-19updated README: mention some more design features of SciTECORobin Haberkorn1-2/+16
2016-06-04added ^E@ string building characterRobin Haberkorn3-11/+42
* allows expansion of Q-Register contents with UNIX shell quoting * This especially improves the usefulness of the EC/EG commands as we can reliably determine that a TECO string (ie. Q-Register) will end up as a single argument to the spawned process. A previous workaround was to enclose ^EQ in quotes, but it does not work e.g. if the register contains the wrong kind of quotes or other magic shell characters. * NOTE: In order to be absolutely sure about the runtime behaviour of EC plus ^E@, you will have to enable UNIX98 shell emulation in portable macros.
2016-04-06updated Scintilla to v3.6.4 and Scinterm to v1.7Robin Haberkorn2-2/+2
* the Github mirrors contain crucial patches not yet contributed upstream, so people will currently rely on my Github mirror repositories in order to build SciTECO
2016-04-05session.tes: save and restore the working directory as part of the sessionRobin Haberkorn1-3/+11
* turned out to be a very handy feature * can be turned off by setting register `session.savedir` to false * also fixed the line endings in .teco_session files to line-feed (ie. native)
2016-03-25fixed rubout and reinsertion of the loop end command (>)Robin Haberkorn1-2/+11
* the loop counter wasn't properly restored when rubbing out the loop end command, so when it was reinserted again, it would still be 1 (since that's the abortion criteria) and no additional loop iteration was performed. * simple test case: Try typing 5<%a> then rubout and reinsert ">". * Fixed by saving the loop counter before modifying it. There are arguably more efficient ways to do this like only creating one undo token at the end of the loop -- but that would require storing the initial loop counter in the LoopContext and would generally be more tricky. * The case of infinite loops has been optimized in interactive mode: Since the loop counter never actually changes, we do not have to create an undo token per loop iteration.
2016-02-24EG and EC use $SHELL and $COMSPEC as the default command interpreters nowRobin Haberkorn3-17/+43
* The default command interpreter will thus be inherited from the operating system. In the case of UNIX from the user's passwd entry. E.g. if bash is used, bash extensions can be used immediately if flag 128 is not set in the ED flags. * On DOS-like systems there are also alternative interpreters (e.g. 4NT, 4OS2) that are configurable now. * At least on UNIX with $SHELL it is not guaranteed that the interpreter supports the standard command line arguments like "-c". If they don't, this will cause problems with EC. Since $SHELL is mapped to a Q-Register, it can however always be easily customized for SciTECO sessions in the user's .teco_ini.
2016-02-19fixed Objective C++ lexing: it is now handled by cpp.tesRobin Haberkorn2-11/+14
* the *.mm extension is for Objective C++. Therefore cpp.tes should be responsible. * Objective C keywords have been added to lexer.c.basekeywords. It does not hurt adding them to all C descendants.
2016-02-18replace custom Gob2 check with GOB2_CHECK() from gob2.m4Robin Haberkorn2-4/+60
* Allows us to check for the Gob2 version at ./configure time * this file ships with Gob2 installations, so in most cases it could be found without shipping it with SciTECO. * Autoconf is built such that source distributions will contain all additional external macros compiled in aclocal.m4. * However if somebody builds from Git, he/she would still expect the ./configure checks to produce meaningful results even if not all dependencies are installed properly. It therefore seems to be good practice to include all external M4 macros (gob2.m4) as a fallback with the source tree. * /usr/share/aclocal contains many more useful m4 macros. However since we can depend on pkg-config e.g. for finding Gtk+ and Glib, I won't use those macros as else I would have to bundle them to achieve the same kind of ./configure robustness.
2016-02-17added lexing support for Gob2 (GObject Builder)Robin Haberkorn2-0/+37
* this assumes that Gob2 produces plain-C output (no C++ keywords are added) and all Gob keywords are real keywords - even though they might be used in function bodies or %{ %} enclosed blocks.
2016-02-17The "cpp" lexer configuration has been split into "c.tes" and "cpp.tes"Robin Haberkorn3-23/+64
* The keyword list is too different in C when compared to C++. The many additional keywords are annoying when editing plain C files. * Underscored C99 and C11 keywords (like _Bool) have been added to the "c.tes" lexer configuration. The C++ language does not contain these keywords. However, C has stdbool.h to define bool which is part of standard C++. * Therefore a macro "lexer.c.basekeywords" has been defined for all languages __directly__ derived (more or less supersets) of C. It contains most of the C99/C11 standard header shortcuts. * Objective C lexing is set up by c.tes since Objective C is a relatively strict superset of C. All Objective C keywords are handled by c.tes. Since they begin with "@", this should not cause problems when editing plain C files.
2016-02-17simplified "lexer.test..." macros using the $$ return commandRobin Haberkorn43-194/+194
* this is slightly more efficient than using repeated conditionals * the last :EN does not require a conditional, as its return value can simply be forwarded. * even without $$, this could have been done easier using a once-only loop and breaking out of the loop if :EN fails using :;. The last :EN result is still stored in QReg "_". * :EN could also be used to match header lines if lexer.tes would leave the first line (header line) in some Q-Reg, like the local .[header]. However, repeated :ENs would be necessary as globbing currently does not support {...,...} expansions. Since sooner or later, the header line must be evaluated for some lexer.set macro, this is probably more efficient than the current solution using SciTECO patterns and [lexer.checkheader] could be removed as well.
2016-02-16distribution helper script: let it be preprocessed/substituted by AutoconfRobin Haberkorn3-24/+28
* makes sense since it already extracted information from ./configure that is usually substituted. * it already had to be run from a configured build directory * it required the source tree directory, which had to be overwritten on the Make command line when using an out-of-source build dir. This is no longer necessary. * It is still a stand-alone Makefile to keep it isolated from the main build system, although it could certainly be translated to Automake. * the generated file will now be called distribute.mk to signify that it is a Makefile.
2016-02-16minor ./distribute fixRobin Haberkorn1-2/+2
2016-02-16fixed function key macros and command reinsertion after ^[Robin Haberkorn2-2/+13
* one would expect function key macros masked for the start state to work after ^[ ($), but since it has its own state now, this was broken since f08187e454f56954b41d95615ca2e370ba19667e. * Similarily command reinsertion would reinsert too much after $, since the parser wouldn't be in the "real" start state. * The "escape" state should be handled like the start state (where new commands can begin) from the perspective of the user -- the difference is not even documented, it's an implementation detail.
2016-02-16finally added Autotest suiteRobin Haberkorn7-9/+71
* Autotest ships with Autoconf, so it's available already and relatively easy to integrate into an Autotools package. * This is attached to `make check` using some Automake magic. * The test suite will only call the built SciTECO for the time being. But using tests/Makefile.am, custom programs could be easily built. * Since it uses the target sciteco, it cannot work in cross-compile environments. * The test suite tests/testsuite.at should be used for regression tests at least: Whenever there is a bug, a test case should be added to testsuite.at. Later this might be split up into multiple includes for regressions other tests.
2016-02-16commented on why $SCITECO_BOOTSTRAP is used in doc/Makefile.amRobin Haberkorn1-0/+6
2016-02-16implemented ^C commandRobin Haberkorn5-14/+49
* acts like exit(3) -- ie. the program is terminated immediately but the quit hook (aka SciTECO's atexit() handlers) will still run. * for "compatibility" with classic TECOs. Can also be used as a shorter variant of "-EX$$" but working from every macro level. * disallowed in interactive mode to avoid typing it accidentally.
2016-02-15updated sciteco(7): command line termination, aggregating loops etc.Robin Haberkorn1-18/+69
2016-02-15updated TODORobin Haberkorn1-13/+16
2016-02-15revised looping implementation, aggregating loops, sane $$ semantics, some ↵Robin Haberkorn8-150/+311
optimizationa and additional checks * undo tokens emitted by the expression stack no longer waste memory by pointing to the stack implementation. This uses some ugly C++ constant template arguments but saves 4 or 8 byte per undo token depending on the architecture. * Round braces are counted now and the return command $$ will use this information to discard all non-relevant brace levels. * It is an error to close a brace when none have been opened. * The bracing rules are still very liberal, allowing you to close braces in macros belonging to a higher call frame or leave them open at the end of a macro. While this is technically possible, it is perhaps a good idea to stricten these rules in some future release. * Loops no longer (ab)use the expression stack to store program counters and loop counters. This removes flow control from the responsibility of the expression stack which is much safer now since we can control where we jump to. This also eased implemented proper semantics for $$. * It is an error to leave loops open at the end of a macro or trying to close a loop opened in the caller of the macro. Similarily it is only possible to close a loop from the current invocation frame. This means it is now impossible to accidentally jump to invalid PCs. * Even though loop context stacks could be attached directly to the macro invocation frame, this would be inefficient. Instead there's a loop frame pointer now that is part of the invocation frame. All frames will reuse the same stack structure. * Loops are automatically discarded when returning using $$. * Special aggregating forms of the loop start (":<") and loop end (":>") commands are possible now and have been implemented. This improves SciTECO's capability as a stack-oriented language. It is no longer necessary to write recursive macros to generate stack values of arbitrary length dynamically or to process them. * All expression and loop stacks are still fixed-size. It may be a good idea to implement dynamic resizing (TODO). * Added some G_UNLIKELYs to Execute::macro(). Should improve the branch prediction of modern CPUs. * Local Q-Register tables are allocated on the stack now instead of on the heap (the bulk of a table is stored on the heap anyway). Should improve performance of macro invocations. * Document that "F<" will jump to the beginning of the macro if there is no loop. This is not in standard TECO, but I consider it a useful feature.
2016-02-15implemented <$$> command for returning from a macroRobin Haberkorn7-83/+163
* <$$> is faster than jumping to the end of the macro and enables shorter code for returning values from macros. * this also replaces $$ as an immediate editing command. In other words, command line termination is an ordinary command now. The old behaviour was similar to what classic TECO did. Classic TECO however had no choice than to track key presses directly for command line termination as it did not keep track about the parser state as input was typed. This led to some glitches in the language. For instance "FS$$" would terminate the command line, unless the second escape was typed after backspace, etc. This behaviour is not worth copying and SciTECO did a better job than that by making sure that at least the second escape is only effective if it is not part of language syntax. This still lead to some undesirable cases like "ES...$$$" that would terminate the command line unexpectedly. To terminate the command line after something like "FS$$", you will now have to type "FS$$$$". * As it is a regular command now - just executed immediately - and its properties stay close to the macro return behaviour, command line termination may now not always be performed when $$ is typed even as a standalone command. E.g. "Ofoo$ !bar!$$ !foo!Obar$" will curiously terminate the command line now. * This also means that macros can finally terminate command lines by using the command line editing commands ({ and }) to insert $$ into the command line macro. This is also of interest for function key macros. * This implementation showed some serious shortcoming in SciTECO's current parser that yet have to be fixed. E.g. the macro "@^Ua{<$$>}" is currently unsafe since loops abuse the expression stack for storing their state and $$ does not touch the expression stack. Calling "Ma>" would actually continue the loop jumping to the beginning of the command line since program counters referring to the macro A will be reused! This cannot be easily solved by checking for loop termination since being able to return that way from loops is a useful feature. This is a problem even without loops and $$, e.g. as in "@^Ua{1,2,3(4,5} Ma)". Instead, a kind of expression stack frame pointer must be added to macro invocation stack frames, pointing to the beginning of the expression stack for the current frame. At the end of macros or on return, the stack contents of corresponding to the frame can be discarded while preserving the immediate arguments at the time of the return or end-of-macro. This would stabilize SciTECO's macro semantics. * When a top-level macro returns in batch mode, it would be a good idea to use the last argument to calculate the process return code, so it can be set by SciTECO scripts (TODO).
2016-02-15lexer library: avoid unnecessary argument discards after SETLEXERLANGUAGERobin Haberkorn69-69/+69
* causes problems with the $$ command implemented * was already fixed in scite2co.lua but the existing code was manually updated and generated with an earlier version of scite2co.lua
2016-02-15fixed segfaults due to missing undo restoration QReg argument variablesRobin Haberkorn1-4/+4
* test case: "@^Ua{eq.a$}Ma" and rubbing out until "}", reinserting it * this means that probably a lot of rubout/reinsertion cases were broken
2016-02-11minor Doxygen comment fixesRobin Haberkorn2-3/+3
2016-02-11updated Doxyfile: added new source directories; exclude gtkflowbox.c and use ↵Robin Haberkorn1-6/+6
SciTECO logo
2016-02-11updated Doxyfile.in: doxygen -u Doxyfile.inRobin Haberkorn1-913/+1424
2016-02-11pass user/maintainer provided CXXFLAGS to the Scintilla build processRobin Haberkorn5-7/+22
* Usually, Scintilla will now be built with -O2 * this can improve performance significantly over the standard Scintilla -Os (up to 10%). * this also allows link-time-optimizing both Scintilla and SciTECO (which are linked statically) by adding -flto to CFLAGS, CXXFLAGS and LDFLAGS. Link-time-optimization will both reduce the total binary size and improve performance slightly since scintilla_send_message() can be inlined. An -O3 optimized Scintilla when linked with LTO results in an only 300kb larger SciTECO binary. * the highest possible optimization thus requires the following maintainer flags on the ./configure command line: CFLAGS="-O3 -mtune=native -march=native -flto" CXXFLAGS="-O3 -mtune=native -march=native -flto" LDFLAGS="-flto" * Windows and Debian builds use link-time-optimization now. On Windows - where we link in everything statically - building the dependant libraries with -flto could improve performance even more. * Debian builds respect the default hardening flags of the build server now. This should ensure that SciTECO is built for the correct architecture at the recommended optimization level etc.
2016-02-11optimized command execution in batch mode, during macro calls, loops etc.Robin Haberkorn3-39/+78
* SciTECO commands are implemented with immediate execution in mind. Those commands that do need to execute immediately while a string command is entered, can do so using StateExpectString::process(). For simplicity, the parser just assumed that every input character should result in immediate execution (if the command supports it of course). * This lead to unnecessarily slow execution of commands like <I> or <S> in batch mode. E.g. a search was always repeated for every character of the pattern - a N character pattern could result in N searches instead of one. Also in interactive mode when executing a macro or repeating commands in a loop, immediate processing of string arguments is unnecessary and results in superfluous undo tokens. * These cases are all optimized now by being informed about the necessity of providing immediate feedback via State::refresh(). This is used by StateExpectString to defer calling process() as long as possible. * For states extending StateExpectString, there is no change since they can already process arbitrarily long strings. The optimization is hidden in StateExpectString. * some allocations are now also avoided in StateExpectString::custom().
2016-02-10added String::toupper(): minor optimizationRobin Haberkorn4-15/+27
* This is one of the most called functions (although a cheap one), so having our own inline implementation speeds up things. Benchmarks have shown that parsing is sped up by at least 4%.
2016-02-10avoid unnecessary undo token allocations in batch mode: greatly speeds up ↵Robin Haberkorn15-40/+80
batch mode * by using variadic templates, UndoStack::push() is now responsible for allocating undo tokens. This is avoided in batch mode. * The old UndoStack::push(UndoToken *) method has been made private to avoid confusion around UndoStack's API. The old UndoStack::push() no longer needs to handle !undo.enabled, but at least asserts on it. * C++11 support is now required, so variadic templates can be used. This could have also been done using manual undo.enabled checks; or using multiple versions of the template with different numbers of template arguments. The latter could be done if we one day have to support a non-C++11 compiler. However since we're depending on GCC 4.4, variadic template use should be OK. Clang supports it since v2.9. * Sometimes, undo token pushing passed ownership of some memory to the undo token. The old behaviour was relied on to reclaim the memory even in batch mode -- the undo token was always deleted. To avoid leaks or repeated manual undo.enabled checking, another method UndoStack::push_own() had to be introduced that makes sure that an undo token is always created. In batch mode (!undo.enabled), this will however create the object on the stack which is much cheaper than using `new`. * Having to know which kind of undo token is to be pushed (taking ownership or not) is inconvenient. It may be better to add static methods to the UndoToken classes that can take care of reclaiming memory. * Benchmarking certain SciTECO scripts have shown 50% (!!!) speed increases at the highest possible optimization level (-O3 -mtune=native -march=native).
2016-02-07Gtk UI: use GtkCanonicalizedLabels and many styling improvementsRobin Haberkorn4-34/+127
* the canonicalized labels are used in title bars and popups * title labels and popup labels are selectable. The latter only makes sense as long as there is no mouse support for selecting popup entries. * message bar labels are selectable * title bars can be styled according to the current document type (.info-qregister and .info-buffer classes) * .dirty has been introduced for dirty buffers. This way, dirty buffer file names can be printed in italics without hardcoding that behaviour. It can be customized in the user CSS. * The style of highlighted popup entries is now themeable as well using the .highlight style class.
2016-02-07added GtkCanonicalizedLabel: a label for displaying SciTECO stringsRobin Haberkorn2-3/+233
* those strings can contain control characters * the canonicalized label will automatically escape the non-printable characters according to the same mapping used elsewhere and shows them in "reverse" video. * reverse video is hard to achieve in Gtk, esp. for Pango versions that don't support transparent foregrounds * the current implementation does not need dedicated styling for reverse video characters; but this may be an option in order to get it right even on older Gtk versions
2016-02-06updated TODORobin Haberkorn1-2/+15
2016-02-04Gtk UI: refactored fallback.css - use one section per UI componentRobin Haberkorn1-13/+12
2016-02-04Gtk UI: --no-csd in the main option group now, so it shows up in --helpRobin Haberkorn1-1/+2
2016-02-04Gtk UI: fixed segfaults because of unsynchronized ViewGtk destructionRobin Haberkorn2-12/+26
* this was worked around by using an idle watcher which can be registered thread-safe. * this workaround can be reverted once we're single-threaded again.
2016-02-04updated Scintilla submodule: fixed threading/deadlocks in Gdk earlier than 3.6Robin Haberkorn1-0/+0
* I fixed up the earlier commit a2b4a4cf4dfe7f7d72eeea566290f9ec51be7dbb. * For Gdk >= 3.6 there are no functional improvements/fixes. However older Scintilla Gtk builds would have been broken by the last Scintilla patch. This is of course important when contributing the patch to the Scintilla community.
2016-02-03Gtk UI: automatically configure font of the command lineRobin Haberkorn4-15/+35
* This uses the font and size of STYLE_DEFAULT. * We cannot just pass the font down to the user CSS. There are no font variables in Gtk CSS. Therefore we configure the command line widget directly. This can still be overwritten by an user CSS. * Instead of using the deprecated gtk_widget_modify_font(), we generate CSS. Ugly, but still better than writing our own style provider. * Font setting is exposed to the user using a new optional Q-Reg "lexer.font". The numeric part is the point size multiplied with 100 (fractional point size). * Font setting in lexer.auto is skipped in Curses where it is irrelevant anyway to speed up startup. * Perhaps the "Monospace" font name is also a good default value instead of Courier? fixup
2016-02-03Gtk UI: popup will now overlay both the Scintilla view and message widgetsRobin Haberkorn2-8/+20
* this is what the Curses UI does for a long time now * the popup does NOT cover the info (header) line, as this would be inconsistent if the header is actually the window's title bar. This should perhaps be adapted in the Curses UI as well, so both UIs look more consistently. * removed unused InterfaceGtk attribute
2016-02-02Gtk UI: full color scheme supportRobin Haberkorn7-18/+234
* implemented by exporting the most important Scintilla STYLEs as CSS variables and defining named widgets for the main UI components. * ~/.teco_css will then apply the Scintilla styles to the Gtk UI. This file is also for additional tweaks, e.g. enabling translucency. * A fallback.css is provided which does just that and is able to apply the terminal.tes and solarized.tes color schemes. * Other important aspects of theming like font sizes and names have not yet been dealt with. (We may want to apply the corresponding Scintilla settings to some widgets...)
2016-02-02Gtk UI: added option --no-csd to disable client-side decorationsRobin Haberkorn2-11/+31
* many WMs like Unity or even Awesome WM have problems with client-side decorations. Awesome WM for instance does not allow us to move or resize floating windows with CSDs. Also, the added close button does not make sense for tiling window managers and since they usually never show window title bars, CSD brings no advantages at all on tiling window managers. * Other window managers might not support CSD at all. * There is AFAIK no way to detect whether CSDs will be possible or whether there will be glitches (see Awesome). * Added command line option --no-csd in the --help-gtk group. This can be added to desktop shortcuts etc. Later there might be better ways to configure stuff like that, e.g. when we add support for scripted UI customizations.
2016-02-02Gtk UI: added a GtkHeaderBar and install it as the window's title barRobin Haberkorn3-27/+99
* the header bar takes the role of the "info" line in the Curses UI. * even though the current file was already shown in the window title, this has certain disadvantages: * does not work well with decoration-less WMs like awesome. The file name is important information and should always be at the top of the window. The space in the task list of awesome is usually not even large enough to show the file name. * the title bar uses a canonicalized buffer/Q-Register name. For the header bar we can use custom renderings using Pango that highlight control characters just like the Curses UI does. This is currently not implemented. * An icon is now shown for the current file. This is the same icon fetching code that gtk-info-popup uses. We might want to move that code into a separate module, along with Pango rendering - Gob2 could just as well generate C++ code. * For Q-Registers, currently no icon is shown (FIXME). * Currently, the subtitle is used to indicate which type of document (buffer or q-register) is edited. This could be done using the icons only, in which case we can disable the subtitles and save screen space. * Client-side decorations are known to cause problems with some WMs and if using them fails, we end up with a titlebar and header bar. It is probably a good idea to make titlebar installation configurable, at least via a command-line switch (or perhaps ED flag?)
2016-02-02added gtk_info_popup_get_position_in_overlay() and workaround size ↵Robin Haberkorn2-26/+42
allocation issue * this is a callback for GtkOverlay's "get-child-position" signal that allocates a size to the popup. * cleaner than overwriting the size_allocate method and does not assume apriori that the popup is part of an overlay. * the popup was always allocated a few pixels too little height, resulting the GtkViewbox always scrolling. Actually it requests a few pixels too little. We now workaround that by adding a constant value to its natural height when allocating a position in the overlay. This is of course a non-portable hack.
2016-02-02gtk-info-popup: automatically hide the scrollbar if it would be insensitiveRobin Haberkorn1-3/+22
* it is currently never hidden since the popup will always be a few pixels too small to prevent scrolling. * makes the GTK popup behave more like the Curses one
2016-02-01updated Scintilla: fixed crashes due to concurrent Scintilla usageRobin Haberkorn1-0/+0
* this fixes the Gtk interface which often crashed because of memory corruptions * When moving away from gdk_threads_enter()/_leave() this will no longer be necessary. However the fix may be relevant for other people and should be sent upstream.
2016-01-31CursesInfoPopup: separated the Curses popup widget from the rest of the UI codeRobin Haberkorn7-356/+514
* this has been prepared a long time ago * the popup widget does not in any way depend on the InterfaceCurses class and could be used elsewhere. * common and generic Curses drawing functions required by both the Curses UI and the CursesInfoPopup widget have been factored out into curses-utils.cpp (namespace Curses) * this improved the UI-logic separation and helped in making interface-curses.cpp smaller