aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/interface-curses.cpp
AgeCommit message (Collapse)AuthorFilesLines
2015-03-14use g_strerror() instead of strerror() in interface-curses.cppRobin Haberkorn1-1/+1
2015-03-12improved ncurses batch mode initializationRobin Haberkorn1-21/+62
* 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-10avoid frequent info line redraws in Curses and GTK+ UIsRobin Haberkorn1-4/+9
* 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-10optimized Interface::info_update() implementationsRobin Haberkorn1-5/+5
* 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-09fixed displaying of control characters in the "info" line (and window title)Robin Haberkorn1-2/+16
* 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-07Curses UI: fixed translation of the backspace keyRobin Haberkorn1-2/+11
* 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 Haberkorn1-1/+1
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-02fixed function key handling on GTK UIRobin Haberkorn1-0/+6
* 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-01keep rubbed out command line for later re-insertion and massive Cmdline ↵Robin Haberkorn1-28/+105
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-02-11updated copyright to 2015Robin Haberkorn1-1/+1
2014-12-09Curses: support cycling through long lists of possible auto-completions and ↵Robin Haberkorn1-42/+67
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-11-21finally implemented the CLOSE and QUIT hooksRobin Haberkorn1-2/+22
the QUIT hook is actually not that trivial and required some architectural changes. First, the QUIT hook execution and any error that might occurr cannot always be attached to an existing error stack frame. Thereforce, to give a stack frame for QUIT hooks and to improve the readability of error traces for ED hooks in general, a special EDHookFrame is added to every ED hook execution error. Secondly, since QUIT hooks can themselves throw errors, we cannot run it from an atexit() handler. Instead it's always called manually before __successful__ program termination. An error in a QUIT hook will result in a failure return code nevertheless. Thirdly, errors in QUIT hooks should not prevent program termination (in interactive mode), therefore they are only invoked from main() and always in batch mode. I.e. if the interactive mode is terminated (EX$$), SciTECO will switch back to batch mode and run the QUIT hook there. This is also symmetric to program startup, which is always in batch mode. This means that Interface::event_loop() no longer runs indefinitely. If it returns, this signals that the interface shut down and batch mode may be restored by SciTECO.
2014-11-17renamed the "NCurses" UI to "Curses" internallyRobin Haberkorn1-0/+525
* does not change ./configure parameters You still have to specifiy --with-interface=ncurses for the Curses interface with default settings * the "NCurses" UI was used for many different Curses variants, so plain "Curses" is a better name.