aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2015-03-07added hack for Windows to pause at the beginning of main() if DEBUG_PAUSE is ↵Robin Haberkorn1-0/+14
defined
2015-03-07canonicalize $SCITECOCONFIG and $SCITECOPATH variablesRobin Haberkorn1-1/+16
* this makes them absolute and also resolves links on Unix * macros can now assume the corresponding Q-regs to be absolute * Currently this does not make a big difference since the working directory of the SciTECO process cannot be changed. Once I implement a command to change the working dir, this is essential.
2015-03-07improved --help output and introduced PACKAGE_URL_DEV (for development home)Robin Haberkorn1-2/+13
* The PACKAGE_URL_DEV is also mentioned in --help output and sciteco(1)
2015-03-07fixed m,nXq for m > n: this properly throws an error nowRobin Haberkorn1-3/+3
2015-03-07changed save point file format to .teco-<n>-<filename>~Robin Haberkorn2-3/+3
* It is no longer possible to accidentally open save point files of the same or another SciTECO instance when typing something like EB*.cpp$ * The use of a trailing ~ is common among editors. These files will be recognized more easily as temporary by users. * People will often already have VCS ignore rules for files with trailing tilde. Therefore SciTECO savepoints will often be already ignored by VCS. * Since they still have a unique ".teco" prefix, they will not be confused by other programs as backup files. * Also mention in sciteco(1) that save point files are hidden on Windows.
2015-03-07fixed TAB completion of files in the current directory beginning with "."Robin Haberkorn1-9/+14
We used g_path_get_dirname() which does not always return strict prefixes of the input file name. For file names without directory, it returns "." (the current directory). This is useful for passing that directory to functions expecting a proper directory (like g_dir_open()) but was unsuitable for building file name candidates for autocompletion. Therefore, we tried to determine if the dirname is a prefix of the filename. This however failed for "hidden" file names beginning with dot. All in all it is easier to calculate our own directory name based on the previously calculated basename than to handle the current-directory case with g_path_get_dirname(). Now we'll get "" for the current directory, so we have to handle the empty-string-is-current-dir case.
2015-03-07Curses UI: fixed translation of the backspace keyRobin Haberkorn3-4/+13
* for historic reasons, the backspace key can be transmitted as ^H by the terminal. Some terminal emulators might do that - these are fixed by this commit. * Use CTL_KEY('H') instead of standard C '\b' as the former is less ambiguous given the confusion around the backspace character.
2015-03-07cleaned up usage of the escape control character: introduced CTL_KEY_ESC and ↵Robin Haberkorn6-14/+27
CTL_KEY_ESC_STR * the reason for the CTL_KEY() macro is to get the control character resulting from a CTRL+Key press -- at least this is how SciTECO presents these key presses. It is also a macro and may be resolved to a constant expression, so it can be used in switch-case statements. Sometimes it is clearer to use standard C escape sequences (like '\t'). * CTL_KEY('[') for escape is hard to read, so I always used '\x1B' which is even more cryptic.
2015-03-07fixed 0EB command to display all buffers in the ringRobin Haberkorn2-23/+24
* the popup resetting was done after character insertion, so typing 0EB would clear the popup immediately * the new implementation is functionally equivalent to the old pre-reinsertion-commandline-handling, by resetting the popup based on the immediate editing command before insertion
2015-03-03fixed double-free in Curses viewsRobin Haberkorn1-3/+6
* the Curses window associated with a Scinterm Scintilla view is INDEED deleted automatically by scintilla_delete() * The Scinterm documentation is WRONG on this. * This has been broken in the SciTECO code for a long time. Perhaps, for some obscure reason, this does not cause any problems on NCurses. It results in instant segfaults on MinGW/PDCurses though.
2015-03-02use g_assert_not_reached() instead of g_assert(false): works around Clang++ ↵Robin Haberkorn2-2/+2
warnings * Clang++ does not see that the PC will never go beyong g_assert(false), and so reports about possible unitialized variables
2015-03-02fixed re-insertion of incomplete commandsRobin Haberkorn1-1/+3
we are not guaranteed to reach the start parser state again if the command is not terminated on the rubbed out command line
2015-03-02fixed minor typos in <EC> documentationRobin Haberkorn1-2/+2
2015-03-02avoid warning about uninitialized variableRobin Haberkorn1-1/+1
2015-03-02removed last remaining "throw" specificationsRobin Haberkorn1-9/+6
* They are harmful. I removed most of them a long time ago but kept some for their documenting character. However, they will always result in additional checks (runtime penalty) when the corresponding functions get called and cannot ensure that only the declared exceptions are thrown at compile time.
2015-03-02minor optimization: no need to check for NULL when using C++ delete operatorRobin Haberkorn4-10/+5
2015-03-02fixed function key handling on GTK UIRobin Haberkorn2-1/+9
* we cannot prevent GTK from delivering the function key presses, as we can on Curses. Therefore Cmdline::fnmacro() checks again if function keys are enabled.
2015-03-02try hard to free heap memory after command-line termination using malloc_trim()Robin Haberkorn1-2/+13
* this is a Linux/glibc-only optimization
2015-03-02introduced the ^G immediate editing command for toggling the undo/redo mode ↵Robin Haberkorn2-88/+163
(also replaces ^T) * CTRL+G toggles the behaviour of the rubout (Backspace, ^W, ^U) commands: When the so called immediate editing command modifier is enabled/active, the rubout commands will do the opposite and insert from the rubbed out command line. This command is somewhat similar to Emacs' C-g command. * The CTRL+G command also replaces the ^T immediate editing command for auto-completing filenames in any string argument. Now the TAB key can be used for that purpose after activating the ^G modifier. ^T is a classic TECO command that will be supported sooner or later by SciTECO, so it's good to have it available directly.
2015-03-01keep rubbed out command line for later re-insertion and massive Cmdline ↵Robin Haberkorn15-295/+493
cleanup/refactoring * characters rubbed out are not totally removed from the command line, but only from the *effective* command line. * The rubbed out command line is displayed after the command line cursor. On Curses it is grey and underlined. * When characters are inserted that are on the rubbed out part of the command line, the cursor simply moves forward. NOTE: There's currently no immediate editing command for reinserting the next character/word from the rubbed out command line. * Characters resulting in errors are no longer simply discarded but rubbed out, so they will stay in the rubbed out part of the command line, reminding you which character caused the error. * Improved Cmdline formatting on Curses UI: * Asterisk is printed bold * Control characters are printed in REVERSE style, similar to what Scinterm does. The controll character formatting has thus been moved from macro_echo() in cmdline.cpp to the UI implementations. * Updated the GTK+ UI (UNTESTED): I did only, the most important API adaptions. The command line still does not use any colors. * Refactored entire command line handling: * The command line is now a class (Cmdline), and most functions in cmdline.cpp have been converted to methods. * Esp. process_edit_cmd() (now Cmdline::process_edit_cmd()) has been simplified. There is no longer the possibility of a buffer overflow because of static insertion buffer sizes * Cleaned up usage of the cmdline_pos variable (now Cmdline::pc) which is really a program counter that used a different origin as macro_pc which was really confusing. * The new Cmdline class is theoretically 8-bit clean. However all of this will change again when we introduce Scintilla views for the command line. * Added 8-bit clean (null-byte aware) versions of QRegisterData::set_string() and QRegisterData::append_string()
2015-03-01moved String helper functions from sciteco.h and main.cpp to ↵Robin Haberkorn11-72/+154
string-utils.cpp and string-utils.h * also improved performance of String::append() by using g_realloc() * added String::append() variant for non-null-terminated strings
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