aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2016-02-04Gtk UI: fixed segfaults because of unsynchronized ViewGtk destructionRobin Haberkorn2-12/+26
* this was worked around by using an idle watcher which can be registered thread-safe. * this workaround can be reverted once we're single-threaded again.
2016-02-03Gtk UI: automatically configure font of the command lineRobin Haberkorn2-15/+27
* This uses the font and size of STYLE_DEFAULT. * We cannot just pass the font down to the user CSS. There are no font variables in Gtk CSS. Therefore we configure the command line widget directly. This can still be overwritten by an user CSS. * Instead of using the deprecated gtk_widget_modify_font(), we generate CSS. Ugly, but still better than writing our own style provider. * Font setting is exposed to the user using a new optional Q-Reg "lexer.font". The numeric part is the point size multiplied with 100 (fractional point size). * Font setting in lexer.auto is skipped in Curses where it is irrelevant anyway to speed up startup. * Perhaps the "Monospace" font name is also a good default value instead of Courier? fixup
2016-02-03Gtk UI: popup will now overlay both the Scintilla view and message widgetsRobin Haberkorn2-8/+20
* this is what the Curses UI does for a long time now * the popup does NOT cover the info (header) line, as this would be inconsistent if the header is actually the window's title bar. This should perhaps be adapted in the Curses UI as well, so both UIs look more consistently. * removed unused InterfaceGtk attribute
2016-02-02Gtk UI: full color scheme supportRobin Haberkorn5-18/+173
* implemented by exporting the most important Scintilla STYLEs as CSS variables and defining named widgets for the main UI components. * ~/.teco_css will then apply the Scintilla styles to the Gtk UI. This file is also for additional tweaks, e.g. enabling translucency. * A fallback.css is provided which does just that and is able to apply the terminal.tes and solarized.tes color schemes. * Other important aspects of theming like font sizes and names have not yet been dealt with. (We may want to apply the corresponding Scintilla settings to some widgets...)
2016-02-02Gtk UI: added option --no-csd to disable client-side decorationsRobin Haberkorn2-11/+31
* many WMs like Unity or even Awesome WM have problems with client-side decorations. Awesome WM for instance does not allow us to move or resize floating windows with CSDs. Also, the added close button does not make sense for tiling window managers and since they usually never show window title bars, CSD brings no advantages at all on tiling window managers. * Other window managers might not support CSD at all. * There is AFAIK no way to detect whether CSDs will be possible or whether there will be glitches (see Awesome). * Added command line option --no-csd in the --help-gtk group. This can be added to desktop shortcuts etc. Later there might be better ways to configure stuff like that, e.g. when we add support for scripted UI customizations.
2016-02-02Gtk UI: added a GtkHeaderBar and install it as the window's title barRobin Haberkorn3-27/+99
* the header bar takes the role of the "info" line in the Curses UI. * even though the current file was already shown in the window title, this has certain disadvantages: * does not work well with decoration-less WMs like awesome. The file name is important information and should always be at the top of the window. The space in the task list of awesome is usually not even large enough to show the file name. * the title bar uses a canonicalized buffer/Q-Register name. For the header bar we can use custom renderings using Pango that highlight control characters just like the Curses UI does. This is currently not implemented. * An icon is now shown for the current file. This is the same icon fetching code that gtk-info-popup uses. We might want to move that code into a separate module, along with Pango rendering - Gob2 could just as well generate C++ code. * For Q-Registers, currently no icon is shown (FIXME). * Currently, the subtitle is used to indicate which type of document (buffer or q-register) is edited. This could be done using the icons only, in which case we can disable the subtitles and save screen space. * Client-side decorations are known to cause problems with some WMs and if using them fails, we end up with a titlebar and header bar. It is probably a good idea to make titlebar installation configurable, at least via a command-line switch (or perhaps ED flag?)
2016-02-02added gtk_info_popup_get_position_in_overlay() and workaround size ↵Robin Haberkorn2-26/+42
allocation issue * this is a callback for GtkOverlay's "get-child-position" signal that allocates a size to the popup. * cleaner than overwriting the size_allocate method and does not assume apriori that the popup is part of an overlay. * the popup was always allocated a few pixels too little height, resulting the GtkViewbox always scrolling. Actually it requests a few pixels too little. We now workaround that by adding a constant value to its natural height when allocating a position in the overlay. This is of course a non-portable hack.
2016-02-02gtk-info-popup: automatically hide the scrollbar if it would be insensitiveRobin Haberkorn1-3/+22
* it is currently never hidden since the popup will always be a few pixels too small to prevent scrolling. * makes the GTK popup behave more like the Curses one
2016-01-31CursesInfoPopup: separated the Curses popup widget from the rest of the UI codeRobin Haberkorn7-356/+514
* this has been prepared a long time ago * the popup widget does not in any way depend on the InterfaceCurses class and could be used elsewhere. * common and generic Curses drawing functions required by both the Curses UI and the CursesInfoPopup widget have been factored out into curses-utils.cpp (namespace Curses) * this improved the UI-logic separation and helped in making interface-curses.cpp smaller
2016-01-31added 16px, 32px and 256px versions of the SciTECO PNG iconRobin Haberkorn1-5/+21
* the GTK UI uses the first three resolutions for setting the window icon. * the 256px version will currently not be installed. It may however be used later when packaging for Ubuntu.
2016-01-31added Copyright to gtk-info-popup.gobRobin Haberkorn1-0/+17
2016-01-31interfaces have their own automake subdirectories and convenience libraries nowRobin Haberkorn11-59/+70
* use libtool convenience libraries as much as possible (for all static libraries except Scintilla) * improves separation of language and user interface implementations (e.g. the Gtk widgets are not interesting for the rest of SciTECO) * the Curses popup widget can now be factored out of interface-curses.cpp * some common CPPFLAGS are now defined by ./configure via AM_CPPFLAGS, so they don't have to be repeated in each submodule. * fixed building the Curses UI: GTK_FLOW_BOX_FALLBACK conditional must always be defined.
2016-01-31updated to Gtk+ 3 and revamped the Gtk interface's popup widgetRobin Haberkorn4-116/+251
* depend on Gtk+ 3.10. If necessary older versions should also be supportable. GtkOverlay was already introduced in v3.2 * A fallback for GtkFlowBox is compiled in if the Gtk installation is too old. This applies even to Ubuntu 14.04 which still runs Gtk v3.10. * the threading the Gtk UI is left as it is for the time being even though the synchronization mechanism has been deprecated. Alternative approaches have to be tried out and benchmarked. * Completely revamped the GtkInfoPopup widget. It is now as powerful as the Curses UI's popup widget. * A GtkOverlay is used instead of the top-level window hack in the Gtk2 version. * GtkFlowBox is used to lay out the columns of the popup. * I had to work around restrictions of GtkScrolledWindow by writing my own poor-mans scrolled window which handles size requests correctly. * The popup window no longer overflows the screen size, instead we scroll. * Scrolling pagewise is finally supported. Wraps at the end of a list just like the Curses UI. * Instead of using only two stock icons, we now use GIO to get file and directory icons for the current theme. This looks even better. * The GtkFlowBox allows selections which can be used for mouse interaction later. But this is not yet implemented. * Theming of the popup widget and command line is still not performed correctly.
2016-01-31made the fallback GtkFlowBox a stand-alone widget that can be built outside ↵Robin Haberkorn2-69/+23
of Gtk * it was necessary to remove the accessibility integration since I don't want to import a lot of bloat into the SciTECO codebase * Includes follow the guidelines of external Gtk code now * internationalization support has been removed * The "move-cursor" signal uses the generic marshaller now since we don't want to introduce genmarshal just for that signal (and it will never be called from a scripting language)
2016-01-31added GtkFlowbox imported from Gtk+ v3.12.2Robin Haberkorn2-0/+5021
* this is used as a fallback for installations with Gtk prior to v3.12
2016-01-28fixup: clarified :EX behaviour on modified unnamed filesRobin Haberkorn2-4/+8
* when the unnamed file was modified, :EW would just succeed discarding all changes to the unnamed file. * Instead now, :EX behaves like the EW$ command on each modified buffer including the unnamed file. * In other words, :EX will fail if there is a modified unnamed file * still refers to #4
2016-01-28added :EX (colon-modified EX): exits SciTECO saving all modified buffersRobin Haberkorn3-15/+41
* this allows you to exit and save only those buffers that are modified. This was not yet possible using macros, since there is currently no way to query the dirty state of buffers programmatically. * even if there was, the necessary key presses might be too much for some users. * the ability to save all modified buffers has been explicitly requested by an user in ticket #4. * the new behaviour is not compatible with classic TECO where EX would save the current file by default but provides a relatively short way to do just that. * updated the documentation: there was also one mistake regarding the boolean that EX accepts non-colon-modified.
2016-01-28use String::append() instead of g_strconcat()Robin Haberkorn2-11/+14
* it has been proven to be very efficient (at least on Linux/glibc)
2016-01-28fixed memory leaks in case of exceptions in StateExpectStringRobin Haberkorn1-3/+14
2016-01-28refactored pattern matching processing: fixes segfaults and memleaksRobin Haberkorn1-24/+141
* class2regexp() and pattern2regexp() now have clear semantics regarding how they scan over a pattern string * this bug has probably always been around * memory leaks could happen in case of exceptions because the pattern match conversion can itself yield errors. * now search commands also fail for definitely invalid pattern match constructs like unsupported ^Ex sequences. * added some documentation
2016-01-28updated copyright to 2016Robin Haberkorn41-41/+41
2015-12-30ncurses: use a default escape delay of 25msRobin Haberkorn1-0/+20
* this practically fixes the delay issues when using the escape key since 25ms is too short for humans to notice. Still it should be large enough for all practical terminal emulators and transmission speeds to get escape sequences transmitted. * If the escape delay turns out to be too short, it can still be overwritten using the (standard ncurses) $ESCDELAY environment variable. * fnkeys.tes will still provide the escape surrogate since the insert key will often be in a better possition on computer keyboards.
2015-10-14minor Clang and OS X compilation fixesRobin Haberkorn2-5/+5
* we cannot use G_N_ELEMENTS in attribute declarations with Clang unless declaring C++11. In this case, since the size of the orig_color_table is fixed anyway, the declaration was simply fixed. * some reordering was necessary in cmdline.cpp. This should not have any influence on GCC when optimizations are enabled. * Scintilla/Scinterm had to be updated as well.
2015-09-25avoid compiler warning in interface-curses.cppRobin Haberkorn1-0/+3
2015-09-25curses UI: fixed truncation of non-filename popup entriesRobin Haberkorn2-5/+24
2015-09-25curses UI: properly truncate q-register and file namesRobin Haberkorn2-80/+163
* format_str() will now automatically right-truncate strings (with formatted control characters) exceeding the window width (or provided maximum width of formatted characters). This means that Q-Register names in the info line are now properly truncated. * introduced format_filename() which takes care of canonicalizing control characters in a given filename and truncate the filename if necessary. Filenames are currently left-truncated since the file name proper and the directory containing it is more significant than the directory names closer to the root. On Windows, we make sure that the drive letter is not truncated. The truncation rules may have to be further tweaked later. This feature properly truncated file names in the info line and in the auto-completion popup.
2015-09-24cleaned up operator precedence codeRobin Haberkorn2-14/+19
* use small values for low precedence
2015-09-23different operators can have the same precedence nowRobin Haberkorn2-11/+26
* SciTECO now has the same operator precedence table as C. * It is numerically important whether different operators have the same precedence. E.g. "5*2/4" used to be evaluated by SciTECO as "5*(2/4)" since division had a higher precedence than multiplication. Within in real (!) numbers this would be the expected evaluation order. Users of other programming languages however would expect the expression to be evaluated as "(5*2)/4" which makes a numerical difference when working with integers. * Operator precedence has been implemented by encoding it into the enumeration values used to represent different operators. Calculating the precedence of a given operator can then be done very efficiently and elegantly (in our case using a plain right shift operation). * documentation updated. We use a precedence table now.
2015-07-28added full Haiku OS support (non x86_gcc2)Robin Haberkorn4-12/+21
* Haiku can be handled like UNIX in most respects since it is POSIX compliant, has a UNIX-like terminal emulator and uses ncurses. * still the Glib platform macro is G_OS_HAIKU instead of G_OS_UNIX, so the preprocessor conditionals had to be adapted. * the only functional difference between a Haiku and UNIX build is the default SCITECOCONFIG path. We use the config path returned by Glib instead of $HOME, so .teco_ini will be in ~/config/settings on Haiku. Other UNIX ports appear to use the same conventions. * Some Haiku-specific restrictions still apply: * Haiku's terminal is xterm-compatible, but only supports 8 colors. Therefore only the terminal.tes color scheme can be used and the terminal must be set up to "Use bright instead of bold text". * The terminal has artifacts. This appears to be a Haiku bug and affects other curses applications as well. * GTK is yet unsupported on Haiku, so there may never be a GUI port (unless someone writes a QT GUI for SciTECO). * SciTECO cannot be built with the legacy gcc2 used for BeOS compatibility on Haiku. This would require too many changes for an obsolete platform. BeOS and the x86_gcc2 platform of Haiku will therefore never be supported. The PPC and ARM platforms of Haiku should work but are untested. * a HaikuPorts recipe will be provided for the next regular SciTECO release. This should hopefully allow installation via HaikuDepot.
2015-07-27fixed fallback implementation of get_absolute_path() on misc platformsRobin Haberkorn2-13/+33
* the old implementation was totally broken, which was to be expected * we can at least provide a version that always returns an absolute path, even though it does not canonicalizes * fixes e.g. Haiku builds for the time being. Haiku however is mostly POSIX compliant and could be handled like UNIX. * simplified the UNIX implementation of get_absolute_path()
2015-07-27work around segfaults on HaikuRobin Haberkorn1-0/+9
* there appears to be a bug in Haiku's glib v2.38 g_main_context_unref(). However I could not find a fix in glib's log. * as a workaround, simply do not unref the main context. Memory is reclaimed after program termination anyway.
2015-07-22fixed operator precedence listRobin Haberkorn1-3/+3
* necessary since in SciTECO every operator has a different precedence. E.g. successive additions/subtractions cannot be evaluated from left to right (by their associativity). Perhaps this should be changed. * subtraction must have a higher precedence than addition, since (a+b)-c == a+(b-c) * division must have a higher precedence than multiplication since (a*b)/c == a*(b/c). This is not quite true for integer arithmetics. * this fixes expressions like 5-1+1 which were counterintuitively evaluated like 5-(1+1)
2015-07-15changed default popup background color and color schemesRobin Haberkorn1-2/+2
* use black on light white as the default popup colors (e.g. in --no-profile mode). this looks less annoying than black on light blue and is more often more readable (since light blue will be rendered quite dark often). It's no longer necessary to highlight the popup with (distinct) colors. Keeping the foreground black ensures that there's a brighter foreground color for bold entries in case the terminal does not support bold fonts. * the `terminal.tes` scheme keeps the default popup style. However since it uses white on black as the default colors, this will often still stand out from the message line (on 16 color terminals). * `solarized.tes` now uses a similar high-contrast popup style with either a bright or dark background. The foreground colors have been chosen so that bright variants exist for non-bold terminals - although these bright variants do not stand out very much.
2015-07-15Curses UI: revised popup area, with borders and a scroll bar; reduce flickeringRobin Haberkorn2-130/+258
* InterfaceCurses::Popup has been turned into a proper class. This made sense since it is more complicated now and allows us to isolate popup-related code. This will also ease moving the popup code as a widget into its own file later (it seems we will need subdirs per interface anyway). * the popup is now implemented using curses pads of which pages are copied into the popup window (to implement cycling through the list of entries). This simplifies things conceptually. * instead of a trailing ellipsis, scrollbars are shown if the popup area is too small to show all entries. This looks much better and consistent with regard to Scinterm's scrollbars. Also, the planned GTK+ popup widget rewrite will have scroll bars, too for cycling through the list of entries. Therefore, the popup window will now always be the same size when cycling. This also looks better. * Borders are drawn around the popup area. This makes sense since the popup area had to be colored distinctly just to be able to discern it from the rest of the UI (esp. the Scintilla view). Now, less annoying colors may be used by default or set up in color profiles while still maintaining good visibility. Also, with the borders added, the popup area looks more consistent when it covers the entire screen. * Entries that are too long to fit on the screen (e.g. long file names) are now truncated with a bold/underline ellipsis. * Use scintilla_noutrefresh() to refresh the Scintilla view. Since popups have to be refreshed __after__ the Scintilla view, this improves performance significantly and reduces flickering when displaying large popups.
2015-07-14fixed <nA> for n pointing to the buffer endRobin Haberkorn1-1/+5
* throws an error now instead of returning 0 * for <A> positions referring to the buffer end are invalid (unlike many other commands). * has been broken for a very long time (possibly always?)
2015-07-14fixed error message for Qq if <q> does not existRobin Haberkorn2-8/+33
* the problem comes from StateExpectQReg resetting the QRegMachine too early. StateExpectQReg(QREG_OPTIONAL) states cannot call machine.fail() in their got_register() callback. In other words, commands with both optional or required registers depending on runtime state cannot be modelled with StateExpectQReg. * instead we derive from State directly - most functionality is encapsulated in QRegSpecMachine anyway. * might also fix crashes on some systems.
2015-07-14curses UI: support terminal palette restoration on PDCurses/win32 and xtermRobin Haberkorn3-61/+141
* palette changes are persistent on PDCurses/win32, too. Fortunately, on this port we can reliably query the console palette. This is done ONLY on PDcurses/win32 since on other ports (notably ncurses), this can cause more harm than it helps. * support palette restoration on xterm by hardcoding the appropriate escape sequence. $TERM cannot be used to identify xterm, but looking at $XTERM_VERSION is sufficient hopefully.
2015-07-14support the CLOSE function key in PDCurses/win32aRobin Haberkorn1-1/+15
in other words, PDCurses/win32a now has programmable window-close behaviour.
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