Branch: refs/heads/master Author: Matthew Brush matt@geany.org Committer: Matthew Brush matt@geany.org Date: Tue, 09 Apr 2013 02:53:48 UTC Commit: d92fd537426ea466032e254db7cb227027b602af https://github.com/geany/geany-plugins/commit/d92fd537426ea466032e254db7cb22...
Log Message: ----------- MultiTerm: Implement the other config VTE properties
There was a bunch of VTE properties that were documented in the config file comments but I never got around to implementing them. The current implementation needs some re-factoring now since there's a lot of duplicated code and it could be greatly simplified.
Also remove comments about unimplemented cwd-tracking feature.
Modified Paths: -------------- multiterm/src/defconf.vala multiterm/src/shell-config.vala multiterm/src/terminal.vala
Modified: multiterm/src/defconf.vala 21 files changed, 8 insertions(+), 13 deletions(-) =================================================================== @@ -102,14 +102,6 @@ command= # Make the tab's label track the VTE title track_title=true
-# Save and restore the current working directory each close/open -track_cwd=true - -# Stores the CWD to change to on loading, blank for no change dir. -# If track_cwd is set to true, this value will be automatically updated -# otherwise this same value will be changed to each load. -terminal_cwd= - # Background color, foreground color and font for the VTE bg_color=#ffffff fg_color=#000000 @@ -130,17 +122,20 @@ font=Monospace 9 #cursor_shape=block
# Controls how erasing characters is handled, one of: -# auto, ascii_backspace, ascii_delete, delete_sequences, tty +# auto, ascii_backspace, ascii_delete, delete_sequence, tty #backspace_binding=auto
# Whether to hide the mouse pointer on key press if it's in the -# terminal window pointer_autohide=false +# terminal window +#pointer_autohide=false
# Scroll to the prompt at the bottom of the scrollback buffer on key -# press scroll_on_keystroke=true +# press +#scroll_on_keystroke=true
# Scroll to the bottom of the scrollback buffer when the child sends -# output scroll_on_output=false +# output +#scroll_on_output=false
# The number of lines to keep in the scrollback buffer #scrollback_lines=512 @@ -155,7 +150,7 @@ font=Monospace 9 # the word-chars characters as parts of words, and all other # characters as word separators. Ranges of characters can be # specified by separating them with a hyphen. -#word_chars= +word_chars=-A-Za-z0-9,./\?%&#:_
#=======================================================================
Modified: multiterm/src/shell-config.vala 226 files changed, 226 insertions(+), 0 deletions(-) =================================================================== @@ -19,6 +19,8 @@ * MA 02110-1301, USA. */
+using Vte; + namespace MultiTerm { public class ShellConfig @@ -121,5 +123,229 @@ namespace MultiTerm cfg.store_eventually(); } } + + public bool allow_bold + { + get + { + try { return kf.get_boolean(_section, "allow_bold"); } + catch (KeyFileError err) { return true; } + } + set + { + kf.set_boolean(_section, "allow_bold", value); + cfg.store_eventually(); + } + } + + public bool audible_bell + { + get + { + try { return kf.get_boolean(_section, "audible_bell"); } + catch (KeyFileError err) { return true; } + } + set + { + kf.set_boolean(_section, "audible_bell", value); + cfg.store_eventually(); + } + } + + public TerminalCursorBlinkMode cursor_blink_mode + { + get + { + try + { + string blink_mode = kf.get_string(_section, "cursor_blink_mode").down(); + if (blink_mode == "on" || blink_mode == "true") + return TerminalCursorBlinkMode.ON; + else if (blink_mode == "off" || blink_mode == "false") + return TerminalCursorBlinkMode.OFF; + else + return TerminalCursorBlinkMode.SYSTEM; + } + catch (KeyFileError err) { return TerminalCursorBlinkMode.SYSTEM; } + } + set + { + switch (value) + { + case TerminalCursorBlinkMode.ON: + kf.set_string(_section, "cursor_blink_mode", "on"); + break; + case TerminalCursorBlinkMode.OFF: + kf.set_string(_section, "cursor_blink_mode", "off"); + break; + default: + kf.set_string(_section, "cursor_blink_mode", "system"); + break; + } + cfg.store_eventually(); + } + } + + public TerminalCursorShape cursor_shape + { + get + { + try + { + string shape = kf.get_string(_section, "cursor_shape").down(); + if (shape == "ibeam") + return TerminalCursorShape.IBEAM; + else if (shape == "underline") + return TerminalCursorShape.UNDERLINE; + else + return TerminalCursorShape.BLOCK; + } + catch (KeyFileError err) { return TerminalCursorShape.BLOCK; } + } + set + { + switch (value) + { + case TerminalCursorShape.IBEAM: + kf.set_string(_section, "cursor_shape", "ibeam"); + break; + case TerminalCursorShape.UNDERLINE: + kf.set_string(_section, "cursor_shape", "underline"); + break; + default: + kf.set_string(_section, "cursor_shape", "block"); + break; + } + cfg.store_eventually(); + } + } + + public TerminalEraseBinding backspace_binding + { + get + { + try + { + string binding = kf.get_string(_section, "backspace_binding").down(); + if (binding == "ascii_backspace") + return TerminalEraseBinding.ASCII_BACKSPACE; + else if (binding == "ascii_delete") + return TerminalEraseBinding.ASCII_DELETE; + else if (binding == "delete_sequence") + return TerminalEraseBinding.DELETE_SEQUENCE; + else if (binding == "tty") + return TerminalEraseBinding.TTY; + else + return TerminalEraseBinding.AUTO; + } + catch (KeyFileError err) { return TerminalEraseBinding.AUTO; } + } + set + { + switch (value) + { + case TerminalEraseBinding.ASCII_BACKSPACE: + kf.set_string(_section, "backspace_binding", "ascii_backspace"); + break; + case TerminalEraseBinding.ASCII_DELETE: + kf.set_string(_section, "backspace_binding", "ascii_delete"); + break; + case TerminalEraseBinding.DELETE_SEQUENCE: + kf.set_string(_section, "backspace_binding", "delete_sequence"); + break; + case TerminalEraseBinding.TTY: + kf.set_string(_section, "backspace_binding", "tty"); + break; + default: + kf.set_string(_section, "backspace_binding", "auto"); + break; + } + cfg.store_eventually(); + } + } + + public bool pointer_autohide + { + get + { + try { return kf.get_boolean(_section, "pointer_autohide"); } + catch (KeyFileError err) { return false; } + } + set + { + kf.set_boolean(_section, "pointer_autohide", value); + cfg.store_eventually(); + } + } + + public bool scroll_on_keystroke + { + get + { + try { return kf.get_boolean(_section, "scroll_on_keystroke"); } + catch (KeyFileError err) { return true; } + } + set + { + kf.set_boolean(_section, "scroll_on_keystroke", value); + cfg.store_eventually(); + } + } + + public bool scroll_on_output + { + get + { + try { return kf.get_boolean(_section, "scroll_on_output"); } + catch (KeyFileError err) { return false; } + } + set + { + kf.set_boolean(_section, "scroll_on_output", value); + cfg.store_eventually(); + } + } + + public int scrollback_lines + { + get + { + try { return kf.get_integer(_section, "scrollback_lines"); } + catch (KeyFileError err) { return 512; } + } + set + { + kf.set_integer(_section, "scrollback_lines", value); + cfg.store_eventually(); + } + } + + public bool visible_bell + { + get + { + try { return kf.get_boolean(_section, "visible_bell"); } + catch (KeyFileError err) { return false; } + } + set + { + kf.set_boolean(_section, "visible_bell", value); + cfg.store_eventually(); + } + } + + public string word_chars + { + owned get + { + try { return kf.get_string(_section, "word_chars"); } + catch (KeyFileError err) { return ""; } + } + set + { + kf.set_string(_section, "word_chars", value); + cfg.store_eventually(); + } + } } }
Modified: multiterm/src/terminal.vala 28 files changed, 27 insertions(+), 1 deletions(-) =================================================================== @@ -130,7 +130,7 @@ namespace MultiTerm HBox hbox;
this.sh = sh; - if (this.sh.command.strip() == "") + if (this.sh.command.strip() == "") this.sh.command = "sh";
terminal = new Vte.Terminal(); @@ -151,9 +151,35 @@ namespace MultiTerm terminal.child_exited.connect(on_child_exited);
if (this.sh.cfg != null) + { terminal.set_font_from_string(this.sh.font); + terminal.set_allow_bold(this.sh.allow_bold); + terminal.set_audible_bell(this.sh.audible_bell); + terminal.set_cursor_blink_mode(this.sh.cursor_blink_mode); + terminal.set_cursor_shape(this.sh.cursor_shape); + terminal.set_backspace_binding(this.sh.backspace_binding); + terminal.set_mouse_autohide(this.sh.pointer_autohide); + terminal.set_scroll_on_keystroke(this.sh.scroll_on_keystroke); + terminal.set_scroll_on_output(this.sh.scroll_on_output); + terminal.set_scrollback_lines(this.sh.scrollback_lines); + terminal.set_visible_bell(this.sh.visible_bell); + terminal.set_word_chars(this.sh.word_chars); + } else + { terminal.set_font_from_string("Monospace 9"); + terminal.set_allow_bold(true); + terminal.set_audible_bell(true); + terminal.set_cursor_blink_mode(TerminalCursorBlinkMode.SYSTEM); + terminal.set_cursor_shape(TerminalCursorShape.BLOCK); + terminal.set_backspace_binding(TerminalEraseBinding.AUTO); + terminal.set_mouse_autohide(false); + terminal.set_scroll_on_keystroke(true); + terminal.set_scroll_on_output(false); + terminal.set_scrollback_lines(512); + terminal.set_visible_bell(false); + terminal.set_word_chars(""); + }
terminal.realize.connect(on_vte_realize); /* colors can only be set on realize (lame) */ run_command(this.sh.command);
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).