aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ring.h
AgeCommit message (Collapse)AuthorFilesLines
2015-03-02minor optimization: no need to check for NULL when using C++ delete operatorRobin Haberkorn1-2/+1
2015-02-23implemented to undo stack memory limitingRobin Haberkorn1-2/+9
* 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-11updated copyright to 2015Robin Haberkorn1-1/+1
2014-11-24turn off Scintilla undo collection by default and fixed memleakRobin Haberkorn1-7/+15
* 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-24factored out file loading and saving into the View specialisation IOViewRobin Haberkorn1-38/+16
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-22allow setting the "*" register as an alternative to nEBRobin Haberkorn1-0/+5
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 Haberkorn1-0/+2
* 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 Haberkorn1-6/+0
* 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-20allow a current buffer if we're editing a Q-RegisterRobin Haberkorn1-1/+5
this eases handling of the "*" register
2014-11-17Make sure QRegister::view is properly initialized and cleaned upRobin Haberkorn1-0/+2
* 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-16cleaned up Scintilla document "updating"Robin Haberkorn1-7/+6
* 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-16first working version of the one-view-per-buffer designRobin Haberkorn1-10/+10
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-11added all of SciTECO's declarations to the "SciTECO" namespaceRobin Haberkorn1-4/+8
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-09current_doc_must_undo(): check for undo-necessity when operating on the ↵Robin Haberkorn1-0/+7
current document if the current document is a local q-register from a macro call, we must not generate undo tokens, since the local documents are discarded on macro termination.
2014-02-15updated Copyright to year 2014Robin Haberkorn1-1/+1
2014-02-15use GLib's GError information to yield errorsRobin Haberkorn1-1/+1
* results in better error messages, e.g. when opening files * the case that a file to be opened (EB) exists but is not readably is handled for the first time
2014-02-15removed most exception specifications: allow bad_allocs to propagateRobin Haberkorn1-5/+5
* specifications resulted in runtime errors (unexpected exception) when bad_alloc ocurred * specs should be used scarcely: only when the errors that may be thrown are all known and for documentary purposes
2013-03-18declare all global inter-dependant objects in main.cpp and get rid of ↵Robin Haberkorn1-0/+1
init_priority attribute * we cannot use weak symbols in MinGW, so we avoid init_priority for symbol initialization by compiling the empty definitions into sciteco-minimal but the real ones into sciteco (had to add new file symbols-minimal.cpp) * this fixes compilation/linking on LLVM Clang AND Dragonegg since their init_priority attribute is broken! this will likely be fixed in the near future but broken versions will be around for some time
2013-03-16common parent state for all file-name-expecting commands: fixes EM ↵Robin Haberkorn1-2/+2
tab-completions * StateExpectFile adds no functionality (currently), but is useful for checking state types
2013-02-22use typedef for SciTECO integers and make it configurable at configure timeRobin Haberkorn1-3/+3
* storage size should always be 64 (gint64) to aid macro portability * however, for performance reasons users compiling from source might explicitly compile with 32 bit integers
2013-02-22clean up QRegister vs. Buffer redundancies using TECODocument classRobin Haberkorn1-25/+11
* also encapsulates data properly (previously there were many public attributes to avoid permission issues) * new class also cares about saving/and restoring scroll state. now, buffer/q-reg edits and temporary accesses do not reset the scroll state anymore.
2013-02-08fixed ring.current/QRegisters::current corruptionRobin Haberkorn1-2/+2
occurs when rubbing out a switch from q-reg string or to q-reg string
2013-01-19updated copyright (2012-2013)Robin Haberkorn1-1/+1
2012-12-04added copyright notice to every source fileRobin Haberkorn1-0/+17
2012-12-04autoconf preparation: move everything into src/ subdirRobin Haberkorn1-0/+246