aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2015-02-23implemented to undo stack memory limitingRobin Haberkorn10-33/+238
* acts as a safe-guard against uninterrupted infinite loops or other operations that are costly to undo in interactive mode. If we're out of memory, it is usually too late to react properly. This implementation tries to avoid OOMs due to SciTECO behaviour. We cannot fully exclude the chance of an OOM error. * The undo stack size is only approximated using the UndoToken::get_size() method. Other ways to measure the exact amount of allocated heap (including size fields in every heap object or using sbrk(0) and similar) are either costly in terms of memory or platform-specific. This implementation does not need any additional memory per heap object or undo token but exploits the fact that undo tokens are virtual already. The size of an undo token is determined at compile time. * Default memory limit of 500mb should be OK for most people. * The current limit can be queried with "2EJ" and set with <x>,2EJ. This also works interactively (a bit tricky!) * Limiting can be disabled. In this case, undo token processing is a bit faster. * closes #3
2015-02-21throw error instead of assertion when loop is closed (>) or continued (F>) ↵Robin Haberkorn1-2/+9
without a corresponding loop start (<) * assertions were introduced very early when there was no proper error handling in SciTECO. However it points to a macro programming error instead of a SciTECO programming error and should not crash the editor. * Perhaps it would be best to check for this kind of "syntax" error also in parse-only modes. This is not done currently. * part of the solution to issue #3
2015-02-21fixed assertion in search.cppRobin Haberkorn1-1/+1
2015-02-19fixup: work around Scintilla drawing bug also when undoing Q-Reg editRobin Haberkorn1-0/+8
2015-02-19work around Scintilla character representation drawing bugRobin Haberkorn1-0/+16
* since SCI_SETDOCPOINTER resets character representations (should probably be submitted as a bug to Scintilla) we have to reset the representations each time we load a q-register into the q-reg view. * since the SCI_SETREPRESENTION call does not do any redrawing (and it would be very slow if it did), the lines with control characters were laid out wrong (too much spaces). This happened when editing a q-reg or the command-line. * Since it is not obvious how to fix Scintilla's behaviour here, we work around the issue by temporarily disabling the layout cache.
2015-02-14updated Scintilla submodule: fixed tab stop calculation on CursesRobin Haberkorn8-10/+10
* also did some whitespace cleanup in SciTECO now that tabs are displayed properly
2015-02-11updated copyright to 2015Robin Haberkorn39-39/+39
2015-02-11implemented support for different indention stylesRobin Haberkorn3-22/+92
* the ^I command was altered to insert indention characters rather than plain tabs always. * The <TAB> immediate editing command was added for all insertion arguments (I, ^I but also FR and FS) * documentation was extended for a discussion of indention
2014-12-15fixup: the spawn context's GError must not be memory-managed by the state objectRobin Haberkorn1-4/+0
this is because ownership of the GError may be passed to GlibError()
2014-12-15always free glib's GError structuresRobin Haberkorn3-2/+17
* when throwing GlibError(), this is taken care of automatically. * fixes a memleak since there may be resources associated with the GError.
2014-12-15add workaround for missing g_spawn_check_exit_status() in libglib v2.33 and ↵Robin Haberkorn1-0/+41
earlier * Debian 7 is still at libglib v2.33 and since it should be supported, I reimplemented the missing function (UNIX-only). * This workaround can be removed once libglib v2.34 becomes common place. Closes #2
2014-12-15fixed remaining reference to register "0" in the documentationRobin Haberkorn1-1/+1
2014-12-15fixed globbing of non-existing directoriesRobin Haberkorn1-0/+4
* for non-existing directories, NULL was passed to g_dir_read_name(). This resulted in Glib errors being printed to stdout/stderr. * this was broken in commit 427c9d
2014-12-09support filename auto completions with forward-slash directory separators on ↵Robin Haberkorn1-4/+52
Windows * this is actually UNTESTED on Windows
2014-12-09Curses: support cycling through long lists of possible auto-completions and ↵Robin Haberkorn5-67/+153
optimized screen refreshing/redrawing * pressing e.g. TAB when the popup is showing a list of auto-completions will show the next page, eventually beginning at the first one again. * do not redraw curses windows in the UI methods directly. this resulted in flickering during command-line editing macros and ordinary macro calls because the physical screen was updated immediately. Instead, window refreshing and updated is done centrally in event_loop_iter() only after a key has been processed. Also we use wnoutrefresh() and doupdate() to send as little to the terminal (emulator) as possible.
2014-12-08Curses: fixed formatting of popup windowsRobin Haberkorn1-24/+20
* simplified code * fixed spurious empty lines in the popup which truncated file names/tokens that would otherwise be displayed * fixed memleak when freeing the popup entry list
2014-12-08do not show possible completions for hidden files and directoriesRobin Haberkorn3-11/+52
* added platform-dependant file_is_visible() function
2014-11-24implemented pQq and :Qq commandsRobin Haberkorn3-25/+115
2014-11-24introduced $SCITECOCONFIG env variable, and set different default for ↵Robin Haberkorn2-28/+37
$SCITECOPATH on Windows * $SCITECOCONFIG has been introduced, so have a macro-accessible location for the profile, buffer session etc. This is set to the program dir on Windows. That way, the config files will be found, regardless of the current working dir, but it may also be set up for Unix-like environments on Windows. * $SCITECOPATH defaults to the program dir + "/lib" now on Windows. * The default profile is now always called ".teco_ini". Also on Windows. Platform differences like this would need to be documented. * The sample teco.ini has been renamed to "sample.teco_ini" for clarity
2014-11-24use RBTree::RBEntry instead of only RBEntryRobin Haberkorn1-1/+1
minor change that fixes Doxygen-generated documentation
2014-11-24turn off Scintilla undo collection by default and fixed memleakRobin Haberkorn6-10/+45
* in batch mode, Scintilla undo actions are simply leaked memory * Since we have more than one Scintilla view now, we must empty the undo buffer of all scintilla views when a command line is committed ($$)
2014-11-24Q-Register loading and saving using the IOView classRobin Haberkorn6-25/+95
* EW can save Q-Registers now * the new E% may be used to save a q-register without making it the current document
2014-11-24factored out file loading and saving into the View specialisation IOViewRobin Haberkorn5-380/+467
this will allow us to use the same algorithms for loading and saving Q-Registers (from/to file). * Saving with EW when a Q-Reg is edited has been fixed (was broken earlier) * SciTECO save point files are now named .teco-X-BASENAME When using IOView for Q-Regs, there will be no way to sensible count the save points. Each write of a Q-Reg may be to another file. Therefore, we number save-points globally. If the sequence of writes has to be reconstructed manually, one can still look at the save point files' modification dates * give more informative error messages when saving a file fails
2014-11-22added EI as non-string-building variant of IRobin Haberkorn2-7/+30
this is analoguous to EU as the string-build equivalent of ^U.
2014-11-22added variant of the ^U command with string building: the EU commandRobin Haberkorn3-7/+45
it became apparent, that something like this is very useful, when constructing the contents of a q-register without editing it. I have decided against introducing another modifier for toggling string building. Most commands have string building enabled and it doesn't hurt. For the few exceptions, an alternative variant can be introduced.
2014-11-22allow setting the "*" register as an alternative to nEBRobin Haberkorn3-13/+23
this is more consistent with SciTECO's idea of abstract registers and allows the currend buffer to be saved on the Q-Register stack. This allows the idiom: [* ! ...change current buffer... ! ]*
2014-11-22added EJ command: return runtime propertiesRobin Haberkorn3-0/+74
* main motivation is to have a way of getting the number of buffers in the ring. "EJ" or "1EJ" will do that. This simplifies macros that will have to iterate all the buffers. They no longer have to close the existing buffers to do that. * "0EJ" will get the current user interface. This is useful to select a different color scheme in the startup profile depending on the UI, for instance.
2014-11-22added globbing command ENRobin Haberkorn7-38/+231
* implements the same globbing as the EB command already did * uses Globber helper class that behaves more like UNIX glob(). glib only has a glob-style pattern matcher. * The Globber class may be extended later to provide more UNIX-like globbing. * lexer.tes has been updated to make use of globbing. Now, lexers can be automatically loaded and registered at startup. To install a new lexer, it's sufficient to copy a file to the lexers/ directory.
2014-11-22fixed document parameters when editing local q-registers (must_undo)Robin Haberkorn1-1/+6
2014-11-21updated documentation on ED (buffer editing) hooksRobin Haberkorn1-1/+2
2014-11-21finally implemented the CLOSE and QUIT hooksRobin Haberkorn8-44/+151
the QUIT hook is actually not that trivial and required some architectural changes. First, the QUIT hook execution and any error that might occurr cannot always be attached to an existing error stack frame. Thereforce, to give a stack frame for QUIT hooks and to improve the readability of error traces for ED hooks in general, a special EDHookFrame is added to every ED hook execution error. Secondly, since QUIT hooks can themselves throw errors, we cannot run it from an atexit() handler. Instead it's always called manually before __successful__ program termination. An error in a QUIT hook will result in a failure return code nevertheless. Thirdly, errors in QUIT hooks should not prevent program termination (in interactive mode), therefore they are only invoked from main() and always in batch mode. I.e. if the interactive mode is terminated (EX$$), SciTECO will switch back to batch mode and run the QUIT hook there. This is also symmetric to program startup, which is always in batch mode. This means that Interface::event_loop() no longer runs indefinitely. If it returns, this signals that the interface shut down and batch mode may be restored by SciTECO.
2014-11-20renamed ED hook register to "ED" and protect ED hook executionsRobin Haberkorn1-1/+22
SciTECO commands usually only take parameters from the stack that they need. Without protecting the ED hook execution with brace operators, additional arguments not consumed by the hook-dispatching command are passed into the ED hook invocation. Also an ED hook macro could leave additional values on the expression stack (by accident). All of this may lead to undefined behaviour if ED hooks are involved.
2014-11-20simplified attaching errors to a position in a macroRobin Haberkorn2-7/+11
introduced Error::set_coord()
2014-11-20Throw error when a macro terminates while a local q-reg is edited.Robin Haberkorn3-15/+53
This is only a problem if the macro created the local Q-Register table (i.e. not when called with ":M") but resulted in segfaults. Since we do not want to save in a Q-Reg whether it is local (and that wouldn't suffice anyway), we do it in the Q-Register table cleanup. The corresponding QRegisterTable::clear() must be called explicitly, since the RBTree::clear() called on destruction does not and cannot throw errors. If QRegisterTable::clear() has been called successfully, the default object destructor will not do much. If it has thrown an error, the destructor will clean up the remaining Q-Registers.
2014-11-20throw error when macro returns with an unterminated commandRobin Haberkorn1-0/+13
it was not possible to inherit the parser state of the last command in a macro. However, it was possible to exit the macro when its last command was not properly terminated. There is no useful conscious application of this behaviour. * If something like an uncomplete E-Command was last in the macro, there was absolutely no effect. However this points to a macro programming error. * If the last command started a string parameter but did not terminate it, the command might be (partially) executed. However the State's done() method wasn't called, which means that some commands will not execute at all. Again there's no useful application of this. When on the other hand, the last command was not terminated by accident, this was not reported to the user.
2014-11-20allow a current buffer if we're editing a Q-RegisterRobin Haberkorn5-16/+23
this eases handling of the "*" register
2014-11-17renamed the "NCurses" UI to "Curses" internallyRobin Haberkorn4-41/+41
* does not change ./configure parameters You still have to specifiy --with-interface=ncurses for the Curses interface with default settings * the "NCurses" UI was used for many different Curses variants, so plain "Curses" is a better name.
2014-11-17Make sure QRegister::view is properly initialized and cleaned upRobin Haberkorn12-79/+99
* it must be initialized after the UI (Interface::main), so I added a View::initialize() function * the old initialize() method was renamed to setup() * use a global instance of QRegister::view so it is guaranteed to be destroyed only after any QRegisters that could still need it * Document API adapted to work with ViewCurrent references
2014-11-17simplified (User) Interface APIRobin Haberkorn3-53/+15
Both UIs have a current_view, so this field, the ssm(), undo_ssm() and get_current_view() methods can be refactored into the Interface base class
2014-11-17updated GTK user interface to API changesRobin Haberkorn2-43/+143
it now works as good (or bad) as it did before. * fixed entering of the Escape character
2014-11-16cleaned up Scintilla document "updating"Robin Haberkorn5-75/+58
* allowed me to remove some obscure global functions and methods like QRegister::update_string(). * Document updating is concentrated in qregisters.cpp now * also fixes some bugs introduced earlier, like undo tokens being generated for non-undo registers (resulting in segfaults on rubout)
2014-11-16rewritten View and Interface base classes using the Curiously Recurring ↵Robin Haberkorn9-114/+237
Template Pattern. * without the one-view-per-buffer designs, many Scintilla send message (SSM) calls could be inlined * with the new design, this was no longer possible using the abstract base classes. the CRT pattern allows inlining again but introduces a strange level of code obscurity. * tests suggest that at high optimization levels, the one-view-per-buffer design and the CRT pattern reduces typical macro runtimes by 30% (e.g. for symbols-extract.tes). * only updated the NCurses UI for the time being
2014-11-16avoid saving interface instance in UndoTokenInfoUpdate by implementing its ↵Robin Haberkorn1-13/+22
run() method later in interface.h
2014-11-16first working version of the one-view-per-buffer designRobin Haberkorn18-252/+475
The user interface provides a Scintilla view abstraction and every buffer is based on a view. All Q-Register strings use a single dedicated view to save memory and initialization time when using many string registers. * this means we can finally implement a working lexer configuration and it only has to be done once when the buffer is first added to the ring. It is unnecessary to magically restore the lexer styles upon rubout of EB (very hard to implement anyway). It is also not necessary to rerun the lexer configuration macro upon rubout which would be hard to reconcile with SciTECO's basic design since every side-effect should be attached to a character. * this means that opening buffers is slightly slower now because of the view initialization * on the other hand, macros with many string q-reg operations are faster now, since the document must no longer be changed on the buffer's view and restored later on. * also now we can make a difference between editing a document in a view and changing the current view, which reduces UI calls * the Document class has been retained as an abstraction about Scintilla documents, used by QRegister Strings. It had to be made virtual, so the view on which the document is created can be specified by a virtual function. There is no additional space overhead for Documents.
2014-11-14added ^# (XOR) operatorRobin Haberkorn3-1/+10
also changed precedence of + operator (higher than minus). the effects of this should be minimal
2014-11-14fixed number formatting for radix > 10Robin Haberkorn1-1/+1
this fixes the "\" command and ^E\ string building characters
2014-11-11refactored SciTECO runtime errors: moved from parser.cpp to error.cppRobin Haberkorn14-293/+375
* the GError expection has been renamed to GlibError, to avoid nameclashes when working from the SciTECO namespace
2014-11-11added all of SciTECO's declarations to the "SciTECO" namespaceRobin Haberkorn33-74/+208
normally, since SciTECO is not a library, this is not strictly necessary since every library should use proper name prefixes or namespaces for all global declarations to avoid name clashes. However * you cannot always rely on that * Scintilla does violate the practice of using prefixes or namespaces. The public APIs are OK, but it does define global functions/methods, e.g. for "Document" that clashed with SciTECO's "TECODocument" class at link-time. Scintilla can put its definitions in a namespace, but this feature cannot be easily enabled without patching Scintilla. * a "SciTECO" namespace will be necessary if "SciTECO" is ever to be turned into a library. Even if this library will have only a C-linkage API, it must ensure it doesn't clutter the global namespace. So the old "TECODocument" class was renamed back to "Document" (SciTECO::Document).
2014-11-10extended ^U command: allow setting and appending of strings and characters fromRobin Haberkorn2-5/+61
the expression stack now it's more like standard TECO's ^U command
2014-11-10clarified conditions when <;> should yield an errorRobin Haberkorn1-2/+11