aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
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
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.