aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2015-07-14curses: fixed arithmetic error when window is smaller than 2 columnsRobin Haberkorn1-1/+2
2015-07-14programmable terminal color redefinition and theming SciTECO curses UI based ↵Robin Haberkorn5-106/+408
on Scintilla styles * The first 16 colors of the terminal palette can be redefined using the 3EJ property - with all restrictions that ncurses and UNIX terminals impose on us. It is still important to be able to redefine the palette for some color schemes like Solarized since it may be difficult for users to set up the terminal emulator's palette manually. Also when using PDCurses, setting the palette is port-specific or only possible using init_color(). In order to allow color redefinitions across all curses ports it makes sense if SciTECO gives access to the color initialization of curses even if it can guarantee very little about its semantics in general. * 3EJ is completely ignored for GTK+ * use the STYLE_DEFAULT of the current document to style the message line. Fg and bg colors are reversed to guarantee a good contrast to the Scintilla view. Errors are still hardcoded to a red background, warnings to yellow and info messages to green. This allows color-scheming more of SciTECO given that the red, yellow and green terminal colors are not changed fundamentally in the terminal's palette. * info line is now also styled using STYLE_DEFAULT (reverse colors). The Q-Register and buffer names are now written out using format_str() which means that control characters are written out in REVERSE just like in the command line. String::canonicalize_ctl() is still used to canonicalize window titles. * Command line is now modelled as a curses Pad and "blitted" to the command line window. This allowed simplification of the command line drawing code and introduction of format_str(). The command line is now styled according to STYLE_DEFAULT (original fg and bg colors). The rubbed-out part of the command line can now longer be shown in bold black - or even bold light black - since that is not visible in all color themes. Instead it is now only shown in bold. Command line theming problems will be gone once we use a Scintilla view for the command line. * The popup widget is now styled according to STYLE_CALLTIP. * This means that all relevant parts of SciTECO's user interface can now be themed. This allows the creation of themes that redefine the terminal palette radically (e.g. Solarized) and the creation of "bright" themes (e.g. Solarized/bright). * theming of the non-scintilla-view parts of SciTECO is currently unsupported on GTK+. The reason is that both the popup widget and command line widgets have to be rewritten completely in GTK+ and are work in progress, so adapting the current code would be a waste of time. * Added a manual section about the UI and theming.
2015-06-29make sure that we do not loose information when handling tecoBools by ↵Robin Haberkorn1-2/+2
implicit casts
2015-06-29<:Q> returns -1 for non-existent registers nowRobin Haberkorn4-30/+95
* added a new OPTIONAL behaviour for QRegSpecMachines * allows you to implement commands that have an optional Q-Register argument that should not be initialized if undefined. * Using QRegSpecMachine::fail() you may still check for existence of the register conditionally to emulate the QREG_REQUIRED behaviour. * Using :Q for checking for register existence makes sense, because usually you will want to check for both existence and non-emptyness as in :Qq">. So in this common case, you no longer have to keep in mind that the register may also be undefined. * This finally allows us to create arrays in the Q-Register tables without keeping a separate entry for the number of elements. E.g. an array.0 to array.N can be iterated like this: 0Ui <:Q[array.^E\i]:; ! work with element i ! %i>
2015-06-29MicroStateMachine::input() returns whether a result was set nowRobin Haberkorn9-114/+113
* this means that QRegSpecMachine::input() no longer has to return a dummy QRegister in parse-only mode. This saves an unnecessary QRegister table lookup and speeds up parsing. * QRegSpecMachine can now be easily extended to behave differently when returning a Q-Register, e.g. simply returning NULL if a register does not exist, or returning a register by prefix. This is important for some planned commands. * StateExpectQReg::got_register() now gets a QRegister *. It can theoretically be NULL - still we don't have to check for NULL in most cases since NULL is only passed in parse-only mode.
2015-06-27do not imply values for the "=" command but fail instead if argument is missingRobin Haberkorn1-1/+4
* this turned out to be a totally-useless and confusing feature. In general values should only be implied for commands if the advantages of implying values (i.e. if you will often want to imply a certain value) outweigh the reduced error checking. * this was one of the bugs discussed in #4.
2015-06-24disable all Scintilla margins by defaultRobin Haberkorn1-0/+6
* it makes little sense to keep Scintilla's default for new views which gives margin 1 (non-folding symbols) a fixed width of 16 pixels. The interpretation of this width is UI-dependant. * it is more consistent to disable all margins initially. this is also the minimalist setup shown when you run e.g. with --no-profile. * the default look of SciTECO will be more like classic TECOs. This is also what has been requested in #4. * sample.teco_ini does no longer have to disable margin 1 explicitly
2015-06-24added "^FCLOSE" function key macro and defined SIGTERM behaviourRobin Haberkorn5-32/+135
* ^FCLOSE is inserted when the "Close" key is pressed. It is used by the GTK+ UI to deliver window close requests and SIGTERM occurrences. (this replaces the "Break" key used before in the GTK+ UI). * The default action of ^FCLOSE is to quit SciTECO, therefore window closing is possible even in --no-profile mode for instance. * fixed a minor memleak in Cmdline::fnmacro() * added ^FCLOSE implementation to fnkeys.tes to insert EX. This currently has the disadvantage of overwriting the error message with syntax errors if there are modified buffers but it will at least not close the window if there are modified buffers. * SIGTERM will now be similar to SIGINT by default instead of terminating SciTECO right away. * the GTK+ UI handles SIGTERM by emulating the "close" key while still interrupting like SIGINT. * GTK+: SIGTERM and ^C will interrupt by sending SIGINT to the entire process group instead of simply setting `sigint_occurred`. This fixes interrupting EC and EG commands with long-running or hanging programs and is relevant to the solution of #4.
2015-06-24fixed SEGFAULTs in InterfaceCurses::vmsg()Robin Haberkorn2-8/+17
* both vmsg() and stdio_msg() behave like vprintf() are allowed to leave their `va_list` in an undefined state. * therefore when writing messages to stdio in addition to the message line, we have to copy the argument list. * fixes SEGFAULTs when trying to log any message (but this bug did not manifest on every test system)
2015-06-23fixed stdio message printing for strings longer than 255 charactersRobin Haberkorn1-7/+9
* there's no reason for formatting into a buffer of fixed length first, since all that is done to the format string is adding a prefix and suffix (line feed). * the new implementation should also be slightly faster.
2015-06-23the Scintilla caret should be non-blinking by defaultRobin Haberkorn1-0/+1
* now both Curses and GTK UIs start with a non-blinking block caret
2015-06-23fixed comment in interface-gtk.cppRobin Haberkorn1-4/+3
2015-06-23install PNG icon and use it to set GTK's window iconRobin Haberkorn2-1/+19
* it is installed into the package's data dir. It is always installed, even for Curses builds. This means when packaging for Debian, the icon could be part of the "sciteco-common" package. If there will ever be more GTK-specific files that need to be installed, this will probably change and the icon will be installed for GTK builds only and become part of the "sciteco-gtk" Debian package. * if the icon could not be loaded, we fail silently. * will not work with windows builds. On Windows, we should just use the icon resource linked into the binary rather than loading the image from file.
2015-06-23GTK UI: beep on errorRobin Haberkorn1-0/+3
* the Curses UI does that too
2015-06-23never show the horizontal scrollbar by defaultRobin Haberkorn1-0/+7
* the GTK UI shows the horizontal scrollbar by default, while Scinterm doesn't. Since showing them with Scintilla's default settings is ugly but setting them up properly is costly and should be decided by the user.
2015-06-23GTK UI: disable keyboard and mouse interaction with Scintilla viewsRobin Haberkorn1-0/+16
* this has long been broken in the GTK UI. It must not be possible to let Scintilla react to mouse and keyboard events since all side-effects on the buffer state must be via the SciTECO language.
2015-06-22major GTK UI rewrite: use a separate execution threadRobin Haberkorn2-45/+284
* the execution thread does not block the main thread (with the main loop). * therefore if SciTECO executes a long-running macro, the UI stays "responsive". * also this allows us to handle ^C interruptions. This is part of the solution to #4 for GTK+ UIs. * to speed up execution and avoid frequent UI redraws (now that we run concurrently, there are even more redraws), the view change is applied only after key presses. * also we freeze all UI updates on the view during SciTECO's key processing. * Closing the window, requests a graceful execution thread shut down. This may later be extended to allow programmable window close-behaviour using a special function key macro (e.g. mapped to the "Break" key).
2015-06-22fixed compilation of GTK+ UIRobin Haberkorn2-32/+34
2015-06-22disable PDCurses/win32a "function keys"Robin Haberkorn1-1/+25
* this fixes the CTRL+V command * PDC_set_function_key() may be used to implement a "shutdown" function key macro later on. * interruptions via CTRL+C are not (easily) possible in this port of PDCurses - similar to XCurses. However, I may ask the author if this is possible.
2015-06-22improved ncurses/win32 supportRobin Haberkorn1-16/+10
* CTRL+C interruptions are now possible. ncurses/win32 needs a noraw() (bug!?) and the console_ctrl_handler for this to work. * setting the window title is not possible on this port * stdio output can be redirected, even in interactive mode. Also, we can write to stdout/stderr even in interactive mode without disrupting the terminal. After endwin(), the user will see these messages (if they haven't been redirected). * there's one bug left: the Scintilla cursor is not drawn correctly at the end of lines. * part of the solution to #4
2015-06-22added XCurses supportRobin Haberkorn1-3/+36
* enabled via --with-interface=xcurses, so we can configure it automatically via xcurses-config. This also adds XCURSES_CFLAGS and XCURSES_LIBS. * The X11 window class name is set to "SciTECO". X11 resource overrides can currently not be set via sciteco's command line. The user may use .Xdefaults though. * interruptions via CTRL+C are currently not supported. Apparently, XCurses also does send SIGINT in cbreak() mode. An XCurses-specific hack would be cumbersome. * ~InterfaceCurses() should probably be rewritten. Curses cleanup should be completely in restore_batch() as the destructor may be called after Curses-cleanup handlers. E.g. isendwin() SEGFAULTs on XCurses when called from the destructor.
2015-06-22use WIN32_LEAN_AND_MEAN macro when including windows.hRobin Haberkorn2-12/+2
this avoids some problematic includes, so we no longer have to #undef interface. Also it should speed up building a bit.
2015-06-22fixed flickering in InterfaceCurses::set_window_title()Robin Haberkorn1-0/+15
* this was an issue at least in PDCurses/win32
2015-06-22fixed CTRL+C handling on PDCurses/win32 portRobin Haberkorn1-4/+67
* it now works as in the ncurses port: ^C during macro execution interrupts just as SIGINT does; else it is read as a character. * On Windows we need to register a special "console ctrl handler" which is the analogue to a signal handler. * It must be tested how ncurses/win32 and PDCurses/win32a behaves in this regard. PDCurses/win32a is still actively maintained, so we can also patch its source base. * See #4
2015-06-22major Curses UI revision: initialize curses as late as possibleRobin Haberkorn4-201/+275
* relies on a patched version of Scinterm that allows you to construct Scintilla objects, send messages etc. before Curses is initialized. The Scintilla and Scinterm submodules have been updated. * This once and for all fixes batch mode and stdio redirections in batch mode on all Curses platforms and operating systems. * Fixes the ^C-does-not-interrupt bug on ncurses/UNIX. See #4. * On ncurses/UNIX we will still do a newterm()-initialization. This allows us to keep stdout/stderr alone in case they are redirected. This effectively allows redirecting SciTECO's output into a file even in interactive mode. ncurses/UNIX now behaves like, e.g. PDCurses/win32a and GTK+ in this regard. * Curses environment variable handling fixed. The environment registers are exported into the process environment so that Curses environment variables can be set/modified by the SciTECO profile. * Use term.h for accessing terminfo now. Explained set_window_title() limitations. * fixed interruption via SIGINT. If the UI is waiting for user input, SIGINT is effectively ignored instead of letting the next character fail always. * Updated sciteco(1) and sciteco(7): More options, environment variables and signals documented. Also rewritten DESCRIPTION section (different modes of operation).
2015-06-14handle environment variables more consistentlyRobin Haberkorn7-32/+168
* the registers beginning with "$" are exported into sub-process environments. Therefore macros can now modify the environment (variables) of commands executed via EC/EG. A variable can be modified temporarily, e.g.: [[$FOO] ^U[$FOO]bar$ EC...$ ][$FOO] * SciTECO accesses the global environment registers instead of using g_getenv(). Therefore now, tilde-expansion will always use the current value of the "$HOME" register. Previously, both register and environment variable could diverge. * This effectively fully maps the process environment to a subset of Q-Registers beginning with "$". * This hasn't been implemented by mapping those registers to special implementations that updates the process environment directly, since g_setenv() is non-thread-safe on UNIX and we're expected to have threads soon - at least in the GTK+ UI.
2015-06-12support UNIX-shell-like tilde-expansions in file names and directoriesRobin Haberkorn11-66/+130
* expands to the value of $HOME (the env variable instead of the register which currently makes a slight difference). * supported for tab-completions * supported for all file-name accepting commands. The expansion is done centrally in StateExpectFile::done(). A new virtual method StateExpectFile::got_file() has been introduced to pass the expanded/processed file name to command implementations. * sciteco(7) has been updated: There is now a separate section on file name arguments and file name handling in SciTECO. This information is important but has been scattered across the document previously. * optimized is_glob_pattern() in glob.h
2015-06-03avoid compiler warning for giving field precision (non-null terminated ↵Robin Haberkorn1-1/+1
string formatting)
2015-06-02throw error when trying to set or append the string part of "*" and ↵Robin Haberkorn2-3/+26
appending to "$" * these operations are unsupported and there is no benefit in ignoring them silently. It only confused the user.
2015-06-02added <FG> command and special Q-Register "$" to set and get the current ↵Robin Haberkorn9-22/+316
working directory * FG stands for "Folder Go" * FG behaves similar to a Unix shell `cd`. Without arguments, it changes to the $HOME directory. * The $HOME directory was previously only used by $SCITECOCONFIG on Unix. Now it is documented on its own, since the HOME directory should also be configurable on Windows - e.g. to adapt SciTECO to a MinGW or Cygwin installation. HOME is initialized just like the other environment variables. This also means that now, the $HOME Q-Register is always defined and can be used by platform-agnostic macros. * FG uses a new kind of tab-completion: for directories only. It would be annoying to complete the FG command after every directory, so this tab-completion does not close the command automatically. Theoretically, it would be possible to close the command after completing a directory with no subdirectories, but this is not supported currently. * Filename arguments are no longer completed with " " if {} escaping is in place as this brings no benefit. Instead no completion character is inserted for this escape mode. * "$" was mapped to the current directory to support an elegant way to insert/get the current directory. Also this allows the idiom "[$ FG...new_dir...$ ]$" for changing the current directory temporarily. * The Q-Register stack was extended to support restoring the string part of special Q-Registers (that overwrite the default functionality) when using the "[$" and "]$" commands. * fixed minor typos (american spelling)
2015-05-29Modified ^W in string (and file name) arguments: ensure that we always rub ↵Robin Haberkorn2-5/+23
out beyond empty arguments * it was annoying not to be able to rub out anything with ^W if the current string argument was empty. * Now, the special file name and string argument handling for ^W is effective only if the current argument is non-empty, else we fall back to the rub-out-command behaviour. * So now, if you press ^W in a string argument, it is rubbed out until empty and on the next ^W press, the entire command will be rubbed out.
2015-05-29support specialized ^W immediate editing command in file name argumentsRobin Haberkorn1-4/+26
* the rubout/reinsert-word behaviour of misc. string arguments is suboptimal for file name arguments as it depends on Scintilla's word characters. By default, the directory separators are not considered word characters, but this could be changed by the user. * The behaviour of ^W in file name arguments is now fixed and independant from the Scintilla configuration: It always rubs out or re-inserts one hierarchy level of the file name.
2015-05-25restrict globbing in the EB command to regular files.Robin Haberkorn1-2/+2
As SciTECO can only edit regular files (or symlinks to regular files), we can exclude directories from the list of files matched by <EB> glob patterns.
2015-05-25extended <EN> command and used it to optimize "lexer.test..." macrosRobin Haberkorn3-41/+246
* EN may now be used for matching file names (similar to fnmatch(3)). This is used to check the current buffers file extension in the lexer configuration macros instead of using expensive Q-Register manipulations. This halves the overall startup time - it is now acceptable even with the current amount of lexer configurations. * EN may now be used for checking file types. session.tes has been simplified. * BREAKS macro portability (EN now has 2 string arguments). * The Globber class has been extended to allow filtering of glob results by file type.
2015-03-18fixed compiling on G++ v4.4: It needs a more verbose syntax when calling ↵Robin Haberkorn1-2/+1
template base class constructors * v4.4 is still officially supported by SciTECO (see INSTALL) * Ubuntu Lucid appears to use v4.4 by default and lucid is till supported by PPA. So this should fix building SciTECO in its PPA for Ubuntu Lucid.
2015-03-18ncurses: fixed batch mode initialization for unset or broken $TERMRobin Haberkorn1-10/+56
* If TERM is set but wrong, it might still fail. Errors are reported now. * If $TERM is unset or empty, we refuse to start the interactive mode. Unfortunately, we cannot easily let curses decide this since newterm() does not work as expected. * However this solution should be quite good: Either $TERM is empty - then batch mode will work but not interactive mode. Or it is not empty, then it is checked by the first call to newterm() when initializing batch mode. The chance of starting up interactive mode with a wrong $TERM or in head-less environments is now quite low. * This is most likely responsible for the PPA build issues.
2015-03-17fixed invalid memory accesses in the expression stack and reworked ↵Robin Haberkorn5-83/+98
expression stack this was probably a regression from d94b18819ad4ee3237c46ad43a962d0121f0c3fe and should not be in v0.5. The return value of Expressions::find_op() must always be checked since it might not find the operator, returning 0 (it used to be 0). A zero index pointed to uninitialized memory - in the worst case it pointed to invalid memory resulting in segfaults. Too large indices were also not handled. This was probably responsible for recent PPA build issues. Valgrind/memcheck reports this error but I misread it as a bogus warning. I took the opportunity to clean up the ValueStack implementation and made it more robust by adding a few assertions. ValueStacks now grow from large to small addresses (like stack data structures usually do). This means, there is no need to work with negative indices into the stack pointer. To reduce the potential for invalid stack accesses, stack indices are now unsigned and have origin 0. Previously, all indices < 1 were faulty but weren't checked. Also, I added some minor optimizations.
2015-03-17support for ncurses/win32Robin Haberkorn1-3/+15
Unfortunately, I cannot really test this curses port since it is not supported by Windows 2000 (missing AttachConsole() API) and it does not run very well in Wine. Under Wine, it does not require the LINES and COLS variable to be set. However, endwin() and the refresh later on result in a very unusable state of operation. I cannot currently check whether this is true on Windows XP or later.
2015-03-17always enable ^G modifier after tab completion in ^G mode.Robin Haberkorn1-0/+3
If there was a rubbed out command line and you tab completed a file name in a string argument (TAB in ^G mode), the immediate editing modifier was automatically reset. This still happens if nothing could be tab completed and you type a few characters and try to complete again (since ^G mode will be reset). If this feature is used often, the user should perhaps define a function key as ^G^I^G.
2015-03-16implemented function key masking (context-sensitive function key macros)Robin Haberkorn1-4/+26
* fnkeys.tes has been updated to enable the command line editing macros (cursor keys, etc.) only in the "start" state. This avoids the annoying effect of inserting the macros into string arguments where they have no effect and must be rubbed out again.
2015-03-16clarify comment of why newterm() cannot be used on PDCursesRobin Haberkorn1-4/+6
2015-03-16fixed curses prog-mode reinitializationRobin Haberkorn1-4/+11
when SciTECO interactive mode is started, the curses prog mode is restored automatically. Therefore it should already be set up correctly (after SciTECO batch mode initialization). This fixes console glitches on MinGW/PDCurses. partial revert of commit 4dced2
2015-03-16documented the automatic EOL translation featureRobin Haberkorn2-3/+20
2015-03-16implemented automatic EOL translation supportRobin Haberkorn12-127/+584
* activated via bit 4 of the ED flag (enabled by default) * automatic EOL guessing on file loading and translation to LFs. * works with files that have inconsistent EOL sequences. * automatic translation to original EOL sequences on file saving * works with inconsistent EOL sequences in the buffer. This should usually not happen if the file was read in with automatic EOL translation enabled. * also works with the EC and EG commands * performance is OK, depending on the file being translated. When reading files with UNIX EOLs, the overhead is minimal typically-sized files. For DOS EOLs the overhead is larger but still acceptable. * Return (line feed) is now an immediate editing command. This centralizes EOL sequence insertion. Later, other features like auto-indent could be added to the editing command. * get_eol() has been moved to main.cpp (now called get_eol_seq() * Warn if file ownership could not be preserved when saving files. * IOView has been almost completely rewritten based on GIOChannels. The EOL translation code is also in IOView.
2015-03-16added EL command for setting/getting the EOL modeRobin Haberkorn2-0/+101
2015-03-16when initializing ncurses, make sure that the output stream is fully bufferedRobin Haberkorn1-0/+1
2015-03-16also set window title on ncurses, by querying terminfo capabilitiesRobin Haberkorn2-3/+64
2015-03-14use g_strerror() instead of strerror() in interface-curses.cppRobin Haberkorn1-1/+1
2015-03-12improved ncurses batch mode initializationRobin Haberkorn2-22/+65
* I now understand better why the old initialization worked ;-) By not calling initscr(), we could prevent some terminal setup and screen clearing usually performed which would interfere with with having a clean stdout stream. However the Curses screen was still basically attached to the terminal. * That's why there was screen flickering in urxvt when calling sciteco (even in batch mode). Also that's why calling batch-mode SciTECO did not work from other Curses programs (including SciTECO). * The new implementation directs Curses at /dev/null, so it will completely stay away from /dev/tty. * /dev/tty is associated with the Curses screen only when the interactive mode is initialized. This works elegantly via freopen() - there's no need to create a new Curses screen. * This does currently not work on PDCurses where the batch mode will still initscr() followed by endwin(). I should investigate how newterm() behaves there - especially on Windows.
2015-03-11Curses UI: beep() on errorRobin Haberkorn1-0/+3