aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
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
2015-03-11fixed weird colors in rubbed-out command line on PDCurses/win32Robin Haberkorn1-13/+35
2015-03-10added SciTECO icon and compile it into Windows binariesRobin Haberkorn2-0/+12
* sciteco.ico contains a 16 color 16px, a 255 color 32px and a true color 48px version of the icon. The first ones are good for legacy Windows versions like 2000, while the latter one should be preferred by Windows >= 7. * Also added the 48px version as a PNG for Linux. But it is not installed currently, as there is no standardized place for it and it wouldn't do much good in /usr/share/sciteco.
2015-03-10added --no-profile command line optionRobin Haberkorn1-2/+9
2015-03-10added the <"I> conditional for checking a directory separatorRobin Haberkorn1-0/+4
* It is still useful to have this in macros since you may want to work with non-normalized file names. For instance, env variables (including $SCITECOPATH and $SCITECOCONFIG) may (and will probably) include backward-slash separators on Windows
2015-03-10always normalize directory separators to "/" in the "*" Q-RegisterRobin Haberkorn1-4/+23
* on Windows, this register contained backward slashes. This means that macros working with that register had to cope with both forward and backward slashes. * The file names are still displayed in the native style by the UI * This approach also has disadvantages: What if the user wants to insert the current file name somewhere where "\" is expected? However, this seems to be an unlikely case and the use can still replace the "/" with "\" again. * Avoid some virtual method calls in QRegisterBufferInfo
2015-03-10added ./configure --enable-static-executables optionRobin Haberkorn1-0/+5
* This adds the -all-static libtool option and can be used to link a static sciteco binary (or at least link in as few as possible dynamic libraries) * Esp. useful on MinGW to link in all dependant libraries (glib, libintl, libiconv, libpdcurses, ...) statically. A static .exe is much smaller than a dynamically linked plus all the DLLs and is easier to relocate. * This does not guarantee that ALL libraries are linked in dynamically. E.g. on MinGW, the sciteco.exe will still link to MSVCRT and the Windows system DLLs, but they already ship with Windows. * On MinGW, even a static build will still require the gspawn-win32-helper-console.exe which is used by glib to implement g_spawn with redirection. We cannot get around that. * It would be better to let this be decided by the package builder using the standard env variables like LDFLAGS. However, this does not seem to work well with libtool. It IS possible to define LDFLAGS="-all-static" when calling make but this approach sucks.
2015-03-10avoid frequent info line redraws in Curses and GTK+ UIsRobin Haberkorn3-20/+38
* it is now redrawn once after each key press, even if the info line has not changed. * This is because Interface::update_info() is called very often in interactive mode, so it makes more sense to redraw it after user interaction (where even unnecessary delays are not noticed so easily), than thousands of times in a macro. * This is especially important since InterfaceCurses::update_info() now also sets the Window title on PDCurses - this is a very costly operation. * The same optimization was applied to InterfaceGtk where it is probably greatly responsible for the sluggishness of the UI. The GTK+ changes are currently UNTESTED.
2015-03-10simplified and optimized filename_complete()Robin Haberkorn1-54/+31
* dirname and basename calculations can be done easier with the new file_get_dirname_len() * platform-dependant derive_dir_separator() function has been removed
2015-03-10dirname length calculation moved from glob.cpp to file_get_dirname_len() in ↵Robin Haberkorn2-5/+27
ioview.h this function is very useful in other places as well (e.g. command line tab completion)
2015-03-10optimized Interface::info_update() implementationsRobin Haberkorn2-15/+17
* use g_strconcat() instead of g_strdup_printf() * InterfaceGtk::info_update() now longer has an arbitrary 255 byte limit on the length of the info line.
2015-03-10fixed globbing (EN command) for pattern without directory and on WindowsRobin Haberkorn1-9/+28
* Globbing without directory (e.g. EN*.cpp$) introduced a "./" into the expanded file names. It no longer does that. * The expanded file names will have the exact same directory component (if any) as the glob pattern. So on Windows, the directory separators in the list of expanded files is exactly as the user requested. * Also fixes lexers.tes on Windows because the script assumes forward slashes.
2015-03-09fixed displaying of control characters in the "info" line (and window title)Robin Haberkorn4-4/+60
* this relied on Curses' control character drawing on Curses. However it treats tab and line feed differently than other control characters, so registers like "^Mfoo" could not be displayed properly. Even if we can configure Curses to display them correctly, we need a "canonicalized", flat form of strings for other purposes (like setting window titles. This is form is different from the formatting used for command lines which may change anyway once we introduce Scintilla mini buffers. * therefore String::canonicalize_ctl() was introduced * also set window title on PDCurses
2015-03-07fixed crashes on PDCurses/win32 when SciTECO terminates before ↵Robin Haberkorn1-1/+2
Interface::main() was called esp. fixes command line --help on PDCurses/win32
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