1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module vte.Terminal; 26 27 private import gdk.Cursor; 28 private import gdk.Event; 29 private import gdk.RGBA; 30 private import gio.Cancellable; 31 private import gio.OutputStream; 32 private import glib.ArrayG; 33 private import glib.ConstructionException; 34 private import glib.ErrorG; 35 private import glib.GException; 36 private import glib.MemorySlice; 37 private import glib.Regex; 38 private import glib.Str; 39 private import gobject.ObjectG; 40 private import gobject.Signals; 41 private import gtk.BuildableIF; 42 private import gtk.BuildableT; 43 private import gtk.ScrollableIF; 44 private import gtk.ScrollableT; 45 private import gtk.Widget; 46 private import gtk.Window; 47 private import pango.PgFontDescription; 48 private import std.algorithm; 49 private import vte.Pty; 50 private import vte.Regex : RegexVte = Regex; 51 private import vte.c.functions; 52 public import vte.c.types; 53 public import vtec.vtetypes; 54 55 56 /** */ 57 public class Terminal : Widget, ScrollableIF 58 { 59 /** the main Gtk struct */ 60 protected VteTerminal* vteTerminal; 61 62 /** Get the main Gtk struct */ 63 public VteTerminal* getTerminalStruct(bool transferOwnership = false) 64 { 65 if (transferOwnership) 66 ownedRef = false; 67 return vteTerminal; 68 } 69 70 /** the main Gtk struct as a void* */ 71 protected override void* getStruct() 72 { 73 return cast(void*)vteTerminal; 74 } 75 76 /** 77 * Sets our main struct and passes it to the parent class. 78 */ 79 public this (VteTerminal* vteTerminal, bool ownedRef = false) 80 { 81 this.vteTerminal = vteTerminal; 82 super(cast(GtkWidget*)vteTerminal, ownedRef); 83 } 84 85 // add the Scrollable capabilities 86 mixin ScrollableT!(VteTerminal); 87 88 89 /** */ 90 public static GType getType() 91 { 92 return vte_terminal_get_type(); 93 } 94 95 /** 96 * Creates a new terminal widget. 97 * 98 * Returns: a new #VteTerminal object 99 * 100 * Throws: ConstructionException GTK+ fails to create the object. 101 */ 102 public this() 103 { 104 auto p = vte_terminal_new(); 105 106 if(p is null) 107 { 108 throw new ConstructionException("null returned by new"); 109 } 110 111 this(cast(VteTerminal*) p); 112 } 113 114 /** 115 * Places the selected text in the terminal in the #GDK_SELECTION_CLIPBOARD 116 * selection. 117 * 118 * Deprecated: Use vte_terminal_copy_clipboard_format() with %VTE_FORMAT_TEXT 119 * instead. 120 */ 121 public void copyClipboard() 122 { 123 vte_terminal_copy_clipboard(vteTerminal); 124 } 125 126 /** 127 * Places the selected text in the terminal in the #GDK_SELECTION_CLIPBOARD 128 * selection in the form specified by @format. 129 * 130 * For all formats, the selection data (see #GtkSelectionData) will include the 131 * text targets (see gtk_target_list_add_text_targets() and 132 * gtk_selection_data_targets_includes_text()). For %VTE_FORMAT_HTML, 133 * the selection will also include the "text/html" target, which when requested, 134 * returns the HTML data in UTF-16 with a U+FEFF BYTE ORDER MARK character at 135 * the start. 136 * 137 * Params: 138 * format = a #VteFormat 139 * 140 * Since: 0.50 141 */ 142 public void copyClipboardFormat(VteFormat format) 143 { 144 vte_terminal_copy_clipboard_format(vteTerminal, format); 145 } 146 147 /** 148 * Places the selected text in the terminal in the #GDK_SELECTION_PRIMARY 149 * selection. 150 */ 151 public void copyPrimary() 152 { 153 vte_terminal_copy_primary(vteTerminal); 154 } 155 156 /** 157 * This function does nothing. 158 * 159 * Deprecated: Use vte_terminal_event_check_regex_simple() instead. 160 * 161 * Params: 162 * event = a #GdkEvent 163 * regexes = an array of #GRegex 164 * matchFlags = the #GRegexMatchFlags to use when matching the regexes 165 * matches = a location to store the matches 166 * 167 * Returns: %FALSE 168 * 169 * Since: 0.44 170 */ 171 public bool eventCheckGregexSimple(Event event, Regex[] regexes, GRegexMatchFlags matchFlags, string[] matches) 172 { 173 GRegex*[] regexesArray = new GRegex*[regexes.length]; 174 for ( int i = 0; i < regexes.length; i++ ) 175 { 176 regexesArray[i] = regexes[i].getRegexStruct(); 177 } 178 179 return vte_terminal_event_check_gregex_simple(vteTerminal, (event is null) ? null : event.getEventStruct(), regexesArray.ptr, cast(size_t)matches.length, matchFlags, Str.toStringzArray(matches)) != 0; 180 } 181 182 /** 183 * Checks each regex in @regexes if the text in and around the position of 184 * the event matches the regular expressions. If a match exists, the matched 185 * text is stored in @matches at the position of the regex in @regexes; otherwise 186 * %NULL is stored there. 187 * 188 * Params: 189 * event = a #GdkEvent 190 * regexes = an array of #VteRegex 191 * matchFlags = PCRE2 match flags, or 0 192 * matches = a location to store the matches 193 * 194 * Returns: %TRUE iff any of the regexes produced a match 195 * 196 * Since: 0.46 197 */ 198 public bool eventCheckRegexSimple(Event event, RegexVte[] regexes, uint matchFlags, string[] matches) 199 { 200 VteRegex*[] regexesArray = new VteRegex*[regexes.length]; 201 for ( int i = 0; i < regexes.length; i++ ) 202 { 203 regexesArray[i] = regexes[i].getRegexStruct(); 204 } 205 206 return vte_terminal_event_check_regex_simple(vteTerminal, (event is null) ? null : event.getEventStruct(), regexesArray.ptr, cast(size_t)matches.length, matchFlags, Str.toStringzArray(matches)) != 0; 207 } 208 209 /** 210 * Interprets @data as if it were data received from a child process. This 211 * can either be used to drive the terminal without a child process, or just 212 * to mess with your users. 213 * 214 * Params: 215 * data = a string in the terminal's current encoding 216 */ 217 public void feed(string data) 218 { 219 vte_terminal_feed(vteTerminal, Str.toStringz(data), cast(ptrdiff_t)data.length); 220 } 221 222 /** 223 * Sends a block of UTF-8 text to the child as if it were entered by the user 224 * at the keyboard. 225 * 226 * Params: 227 * text = data to send to the child 228 */ 229 public void feedChild(string text) 230 { 231 vte_terminal_feed_child(vteTerminal, Str.toStringz(text), cast(ptrdiff_t)text.length); 232 } 233 234 /** 235 * Sends a block of binary data to the child. 236 * 237 * Params: 238 * data = data to send to the child 239 */ 240 public void feedChildBinary(ubyte[] data) 241 { 242 vte_terminal_feed_child_binary(vteTerminal, data.ptr, cast(size_t)data.length); 243 } 244 245 /** 246 * Checks whether or not the terminal will attempt to draw bold text, 247 * either by using a bold font variant or by repainting text with a different 248 * offset. 249 * 250 * Returns: %TRUE if bolding is enabled, %FALSE if not 251 */ 252 public bool getAllowBold() 253 { 254 return vte_terminal_get_allow_bold(vteTerminal) != 0; 255 } 256 257 /** 258 * Checks whether or not hyperlinks (OSC 8 escape sequence) are allowed. 259 * 260 * Returns: %TRUE if hyperlinks are enabled, %FALSE if not 261 * 262 * Since: 0.50 263 */ 264 public bool getAllowHyperlink() 265 { 266 return vte_terminal_get_allow_hyperlink(vteTerminal) != 0; 267 } 268 269 /** 270 * Checks whether or not the terminal will beep when the child outputs the 271 * "bl" sequence. 272 * 273 * Returns: %TRUE if audible bell is enabled, %FALSE if not 274 */ 275 public bool getAudibleBell() 276 { 277 return vte_terminal_get_audible_bell(vteTerminal) != 0; 278 } 279 280 /** 281 * Checks whether the SGR 1 attribute also switches to the bright counterpart 282 * of the first 8 palette colors, in addition to making them bold (legacy behavior) 283 * or if SGR 1 only enables bold and leaves the color intact. 284 * 285 * Returns: %TRUE if bold also enables bright, %FALSE if not 286 * 287 * Since: 0.52 288 */ 289 public bool getBoldIsBright() 290 { 291 return vte_terminal_get_bold_is_bright(vteTerminal) != 0; 292 } 293 294 /** 295 * Returns: the terminal's cell height scale 296 * 297 * Since: 0.52 298 */ 299 public double getCellHeightScale() 300 { 301 return vte_terminal_get_cell_height_scale(vteTerminal); 302 } 303 304 /** 305 * Returns: the terminal's cell width scale 306 * 307 * Since: 0.52 308 */ 309 public double getCellWidthScale() 310 { 311 return vte_terminal_get_cell_width_scale(vteTerminal); 312 } 313 314 /** 315 * Returns: the height of a character cell 316 * 317 * Note that this method should rather be called vte_terminal_get_cell_height, 318 * because the return value takes cell-height-scale into account. 319 */ 320 public glong getCharHeight() 321 { 322 return vte_terminal_get_char_height(vteTerminal); 323 } 324 325 /** 326 * Returns: the width of a character cell 327 * 328 * Note that this method should rather be called vte_terminal_get_cell_width, 329 * because the return value takes cell-width-scale into account. 330 */ 331 public glong getCharWidth() 332 { 333 return vte_terminal_get_char_width(vteTerminal); 334 } 335 336 /** 337 * Returns whether ambiguous-width characters are narrow or wide when using 338 * the UTF-8 encoding (vte_terminal_set_encoding()). 339 * 340 * Returns: 1 if ambiguous-width characters are narrow, or 2 if they are wide 341 */ 342 public int getCjkAmbiguousWidth() 343 { 344 return vte_terminal_get_cjk_ambiguous_width(vteTerminal); 345 } 346 347 /** 348 * Returns: the number of columns 349 */ 350 public glong getColumnCount() 351 { 352 return vte_terminal_get_column_count(vteTerminal); 353 } 354 355 /** 356 * Returns: the URI of the current directory of the 357 * process running in the terminal, or %NULL 358 */ 359 public string getCurrentDirectoryUri() 360 { 361 return Str.toString(vte_terminal_get_current_directory_uri(vteTerminal)); 362 } 363 364 /** 365 * Returns: the URI of the current file the 366 * process running in the terminal is operating on, or %NULL if 367 * not set 368 */ 369 public string getCurrentFileUri() 370 { 371 return Str.toString(vte_terminal_get_current_file_uri(vteTerminal)); 372 } 373 374 /** 375 * Returns the currently set cursor blink mode. 376 * 377 * Returns: cursor blink mode. 378 */ 379 public VteCursorBlinkMode getCursorBlinkMode() 380 { 381 return vte_terminal_get_cursor_blink_mode(vteTerminal); 382 } 383 384 /** 385 * Reads the location of the insertion cursor and returns it. The row 386 * coordinate is absolute. 387 * 388 * Params: 389 * column = a location to store the column, or %NULL 390 * row = a location to store the row, or %NULL 391 */ 392 public void getCursorPosition(out glong column, out glong row) 393 { 394 vte_terminal_get_cursor_position(vteTerminal, &column, &row); 395 } 396 397 /** 398 * Returns the currently set cursor shape. 399 * 400 * Returns: cursor shape. 401 */ 402 public VteCursorShape getCursorShape() 403 { 404 return vte_terminal_get_cursor_shape(vteTerminal); 405 } 406 407 /** 408 * Determines the name of the encoding in which the terminal expects data to be 409 * encoded. 410 * 411 * Returns: the current encoding for the terminal 412 */ 413 public string getEncoding() 414 { 415 return Str.toString(vte_terminal_get_encoding(vteTerminal)); 416 } 417 418 /** 419 * Queries the terminal for information about the fonts which will be 420 * used to draw text in the terminal. The actual font takes the font scale 421 * into account, this is not reflected in the return value, the unscaled 422 * font is returned. 423 * 424 * Returns: a #PangoFontDescription describing the font the 425 * terminal uses to render text at the default font scale of 1.0. 426 */ 427 public PgFontDescription getFont() 428 { 429 auto p = vte_terminal_get_font(vteTerminal); 430 431 if(p is null) 432 { 433 return null; 434 } 435 436 return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p); 437 } 438 439 /** 440 * Returns: the terminal's font scale 441 */ 442 public double getFontScale() 443 { 444 return vte_terminal_get_font_scale(vteTerminal); 445 } 446 447 /** 448 * Fills in some @hints from @terminal's geometry. The hints 449 * filled are those covered by the %GDK_HINT_RESIZE_INC, 450 * %GDK_HINT_MIN_SIZE and %GDK_HINT_BASE_SIZE flags. 451 * 452 * See gtk_window_set_geometry_hints() for more information. 453 * 454 * @terminal must be realized (see gtk_widget_get_realized()). 455 * 456 * Params: 457 * hints = a #GdkGeometry to fill in 458 * minRows = the minimum number of rows to request 459 * minColumns = the minimum number of columns to request 460 */ 461 public void getGeometryHints(out GdkGeometry hints, int minRows, int minColumns) 462 { 463 vte_terminal_get_geometry_hints(vteTerminal, &hints, minRows, minColumns); 464 } 465 466 /** 467 * Checks if the terminal currently contains selected text. Note that this 468 * is different from determining if the terminal is the owner of any 469 * #GtkClipboard items. 470 * 471 * Returns: %TRUE if part of the text in the terminal is selected. 472 */ 473 public bool getHasSelection() 474 { 475 return vte_terminal_get_has_selection(vteTerminal) != 0; 476 } 477 478 /** 479 * Returns: the icon title 480 */ 481 public string getIconTitle() 482 { 483 return Str.toString(vte_terminal_get_icon_title(vteTerminal)); 484 } 485 486 /** 487 * Returns whether the terminal allow user input. 488 */ 489 public bool getInputEnabled() 490 { 491 return vte_terminal_get_input_enabled(vteTerminal) != 0; 492 } 493 494 /** 495 * Determines the value of the terminal's mouse autohide setting. When 496 * autohiding is enabled, the mouse cursor will be hidden when the user presses 497 * a key and shown when the user moves the mouse. This setting can be changed 498 * using vte_terminal_set_mouse_autohide(). 499 * 500 * Returns: %TRUE if autohiding is enabled, %FALSE if not 501 */ 502 public bool getMouseAutohide() 503 { 504 return vte_terminal_get_mouse_autohide(vteTerminal) != 0; 505 } 506 507 /** 508 * Returns the #VtePty of @terminal. 509 * 510 * Returns: a #VtePty, or %NULL 511 */ 512 public Pty getPty() 513 { 514 auto p = vte_terminal_get_pty(vteTerminal); 515 516 if(p is null) 517 { 518 return null; 519 } 520 521 return ObjectG.getDObject!(Pty)(cast(VtePty*) p); 522 } 523 524 /** 525 * Checks whether or not the terminal will rewrap its contents upon resize. 526 * 527 * Returns: %TRUE if rewrapping is enabled, %FALSE if not 528 */ 529 public bool getRewrapOnResize() 530 { 531 return vte_terminal_get_rewrap_on_resize(vteTerminal) != 0; 532 } 533 534 /** 535 * Returns: the number of rows 536 */ 537 public glong getRowCount() 538 { 539 return vte_terminal_get_row_count(vteTerminal); 540 } 541 542 /** 543 * Returns: whether or not the terminal will forcibly scroll to the bottom of 544 * the viewable history when the user presses a key. Modifier keys do not 545 * trigger this behavior. 546 * 547 * Since: 0.52 548 */ 549 public bool getScrollOnKeystroke() 550 { 551 return vte_terminal_get_scroll_on_keystroke(vteTerminal) != 0; 552 } 553 554 /** 555 * Returns: whether or not the terminal will forcibly scroll to the bottom of 556 * the viewable history when the new data is received from the child. 557 * 558 * Since: 0.52 559 */ 560 public bool getScrollOnOutput() 561 { 562 return vte_terminal_get_scroll_on_output(vteTerminal) != 0; 563 } 564 565 /** 566 * Returns: length of the scrollback buffer used by the terminal. 567 * A negative value means "infinite scrollback". 568 * 569 * Since: 0.52 570 */ 571 public glong getScrollbackLines() 572 { 573 return vte_terminal_get_scrollback_lines(vteTerminal); 574 } 575 576 /** 577 * Extracts a view of the visible part of the terminal. If @is_selected is not 578 * %NULL, characters will only be read if @is_selected returns %TRUE after being 579 * passed the column and row, respectively. A #VteCharAttributes structure 580 * is added to @attributes for each byte added to the returned string detailing 581 * the character's position, colors, and other characteristics. 582 * 583 * Params: 584 * isSelected = a #VteSelectionFunc callback 585 * userData = user data to be passed to the callback 586 * attributes = location for storing text attributes 587 * 588 * Returns: a newly allocated text string, or %NULL. 589 */ 590 public string getText(VteSelectionFunc isSelected, void* userData, out ArrayG attributes) 591 { 592 GArray* outattributes = sliceNew!GArray(); 593 594 auto retStr = vte_terminal_get_text(vteTerminal, isSelected, userData, outattributes); 595 596 attributes = new ArrayG(outattributes, true); 597 598 scope(exit) Str.freeString(retStr); 599 return Str.toString(retStr); 600 } 601 602 /** 603 * Checks whether or not the terminal will allow blinking text. 604 * 605 * Returns: the blinking setting 606 * 607 * Since: 0.52 608 */ 609 public VteTextBlinkMode getTextBlinkMode() 610 { 611 return vte_terminal_get_text_blink_mode(vteTerminal); 612 } 613 614 /** 615 * Extracts a view of the visible part of the terminal. If @is_selected is not 616 * %NULL, characters will only be read if @is_selected returns %TRUE after being 617 * passed the column and row, respectively. A #VteCharAttributes structure 618 * is added to @attributes for each byte added to the returned string detailing 619 * the character's position, colors, and other characteristics. This function 620 * differs from vte_terminal_get_text() in that trailing spaces at the end of 621 * lines are included. 622 * 623 * Params: 624 * isSelected = a #VteSelectionFunc callback 625 * userData = user data to be passed to the callback 626 * attributes = location for storing text attributes 627 * 628 * Returns: a newly allocated text string, or %NULL. 629 */ 630 public string getTextIncludeTrailingSpaces(VteSelectionFunc isSelected, void* userData, out ArrayG attributes) 631 { 632 GArray* outattributes = sliceNew!GArray(); 633 634 auto retStr = vte_terminal_get_text_include_trailing_spaces(vteTerminal, isSelected, userData, outattributes); 635 636 attributes = new ArrayG(outattributes, true); 637 638 scope(exit) Str.freeString(retStr); 639 return Str.toString(retStr); 640 } 641 642 /** 643 * Extracts a view of the visible part of the terminal. If @is_selected is not 644 * %NULL, characters will only be read if @is_selected returns %TRUE after being 645 * passed the column and row, respectively. A #VteCharAttributes structure 646 * is added to @attributes for each byte added to the returned string detailing 647 * the character's position, colors, and other characteristics. The 648 * entire scrollback buffer is scanned, so it is possible to read the entire 649 * contents of the buffer using this function. 650 * 651 * Params: 652 * startRow = first row to search for data 653 * startCol = first column to search for data 654 * endRow = last row to search for data 655 * endCol = last column to search for data 656 * isSelected = a #VteSelectionFunc callback 657 * userData = user data to be passed to the callback 658 * attributes = location for storing text attributes 659 * 660 * Returns: a newly allocated text string, or %NULL. 661 */ 662 public string getTextRange(glong startRow, glong startCol, glong endRow, glong endCol, VteSelectionFunc isSelected, void* userData, out ArrayG attributes) 663 { 664 GArray* outattributes = sliceNew!GArray(); 665 666 auto retStr = vte_terminal_get_text_range(vteTerminal, startRow, startCol, endRow, endCol, isSelected, userData, outattributes); 667 668 attributes = new ArrayG(outattributes, true); 669 670 scope(exit) Str.freeString(retStr); 671 return Str.toString(retStr); 672 } 673 674 /** 675 * Returns: the window title 676 */ 677 public string getWindowTitle() 678 { 679 return Str.toString(vte_terminal_get_window_title(vteTerminal)); 680 } 681 682 /** 683 * Returns the set of characters which will be considered parts of a word 684 * when doing word-wise selection, in addition to the default which only 685 * considers alphanumeric characters part of a word. 686 * 687 * If %NULL, a built-in set is used. 688 * 689 * Returns: a string, or %NULL 690 * 691 * Since: 0.40 692 */ 693 public string getWordCharExceptions() 694 { 695 return Str.toString(vte_terminal_get_word_char_exceptions(vteTerminal)); 696 } 697 698 /** 699 * Returns a nonempty string: the target of the explicit hyperlink (printed using the OSC 8 700 * escape sequence) at the position of the event, or %NULL. 701 * 702 * Proper use of the escape sequence should result in URI-encoded URIs with a proper scheme 703 * like "http://", "https://", "file://", "mailto:" etc. This is, however, not enforced by VTE. 704 * The caller must tolerate the returned string potentially not being a valid URI. 705 * 706 * Params: 707 * event = a #GdkEvent 708 * 709 * Returns: a newly allocated string containing the target of the hyperlink 710 * 711 * Since: 0.50 712 */ 713 public string hyperlinkCheckEvent(Event event) 714 { 715 auto retStr = vte_terminal_hyperlink_check_event(vteTerminal, (event is null) ? null : event.getEventStruct()); 716 717 scope(exit) Str.freeString(retStr); 718 return Str.toString(retStr); 719 } 720 721 /** 722 * Adds the regular expression @regex to the list of matching expressions. When the 723 * user moves the mouse cursor over a section of displayed text which matches 724 * this expression, the text will be highlighted. 725 * 726 * Deprecated: Use vte_terminal_match_add_regex() or vte_terminal_match_add_regex_full() instead. 727 * 728 * Params: 729 * gregex = a #GRegex 730 * gflags = the #GRegexMatchFlags to use when matching the regex 731 * 732 * Returns: an integer associated with this expression, or -1 if @gregex could not be 733 * transformed into a #VteRegex or @gflags were incompatible 734 */ 735 public int matchAddGregex(Regex gregex, GRegexMatchFlags gflags) 736 { 737 return vte_terminal_match_add_gregex(vteTerminal, (gregex is null) ? null : gregex.getRegexStruct(), gflags); 738 } 739 740 /** 741 * Adds the regular expression @regex to the list of matching expressions. When the 742 * user moves the mouse cursor over a section of displayed text which matches 743 * this expression, the text will be highlighted. 744 * 745 * Params: 746 * regex = a #VteRegex 747 * flags = PCRE2 match flags, or 0 748 * 749 * Returns: an integer associated with this expression 750 * 751 * Since: 0.46 752 */ 753 public int matchAddRegex(RegexVte regex, uint flags) 754 { 755 return vte_terminal_match_add_regex(vteTerminal, (regex is null) ? null : regex.getRegexStruct(), flags); 756 } 757 758 /** 759 * Checks if the text in and around the specified position matches any of the 760 * regular expressions previously set using vte_terminal_match_add(). If a 761 * match exists, the text string is returned and if @tag is not %NULL, the number 762 * associated with the matched regular expression will be stored in @tag. 763 * 764 * If more than one regular expression has been set with 765 * vte_terminal_match_add(), then expressions are checked in the order in 766 * which they were added. 767 * 768 * Deprecated: Use vte_terminal_match_check_event() instead. 769 * 770 * Params: 771 * column = the text column 772 * row = the text row 773 * tag = a location to store the tag, or %NULL 774 * 775 * Returns: a newly allocated string which matches one of the previously 776 * set regular expressions 777 */ 778 public string matchCheck(glong column, glong row, out int tag) 779 { 780 auto retStr = vte_terminal_match_check(vteTerminal, column, row, &tag); 781 782 scope(exit) Str.freeString(retStr); 783 return Str.toString(retStr); 784 } 785 786 /** 787 * Checks if the text in and around the position of the event matches any of the 788 * regular expressions previously set using vte_terminal_match_add(). If a 789 * match exists, the text string is returned and if @tag is not %NULL, the number 790 * associated with the matched regular expression will be stored in @tag. 791 * 792 * If more than one regular expression has been set with 793 * vte_terminal_match_add(), then expressions are checked in the order in 794 * which they were added. 795 * 796 * Params: 797 * event = a #GdkEvent 798 * tag = a location to store the tag, or %NULL 799 * 800 * Returns: a newly allocated string which matches one of the previously 801 * set regular expressions 802 */ 803 public string matchCheckEvent(Event event, out int tag) 804 { 805 auto retStr = vte_terminal_match_check_event(vteTerminal, (event is null) ? null : event.getEventStruct(), &tag); 806 807 scope(exit) Str.freeString(retStr); 808 return Str.toString(retStr); 809 } 810 811 /** 812 * Removes the regular expression which is associated with the given @tag from 813 * the list of expressions which the terminal will highlight when the user 814 * moves the mouse cursor over matching text. 815 * 816 * Params: 817 * tag = the tag of the regex to remove 818 */ 819 public void matchRemove(int tag) 820 { 821 vte_terminal_match_remove(vteTerminal, tag); 822 } 823 824 /** 825 * Clears the list of regular expressions the terminal uses to highlight text 826 * when the user moves the mouse cursor. 827 */ 828 public void matchRemoveAll() 829 { 830 vte_terminal_match_remove_all(vteTerminal); 831 } 832 833 /** 834 * Sets which cursor the terminal will use if the pointer is over the pattern 835 * specified by @tag. The terminal keeps a reference to @cursor. 836 * 837 * Deprecated: Use vte_terminal_match_set_cursor_type() or vte_terminal_match_set_cursor_named() instead. 838 * 839 * Params: 840 * tag = the tag of the regex which should use the specified cursor 841 * cursor = the #GdkCursor which the terminal should use when the pattern is 842 * highlighted, or %NULL to use the standard cursor 843 */ 844 public void matchSetCursor(int tag, Cursor cursor) 845 { 846 vte_terminal_match_set_cursor(vteTerminal, tag, (cursor is null) ? null : cursor.getCursorStruct()); 847 } 848 849 /** 850 * Sets which cursor the terminal will use if the pointer is over the pattern 851 * specified by @tag. 852 * 853 * Params: 854 * tag = the tag of the regex which should use the specified cursor 855 * cursorName = the name of the cursor 856 */ 857 public void matchSetCursorName(int tag, string cursorName) 858 { 859 vte_terminal_match_set_cursor_name(vteTerminal, tag, Str.toStringz(cursorName)); 860 } 861 862 /** 863 * Sets which cursor the terminal will use if the pointer is over the pattern 864 * specified by @tag. 865 * 866 * Params: 867 * tag = the tag of the regex which should use the specified cursor 868 * cursorType = a #GdkCursorType 869 */ 870 public void matchSetCursorType(int tag, GdkCursorType cursorType) 871 { 872 vte_terminal_match_set_cursor_type(vteTerminal, tag, cursorType); 873 } 874 875 /** 876 * Sends the contents of the #GDK_SELECTION_CLIPBOARD selection to the 877 * terminal's child. If necessary, the data is converted from UTF-8 to the 878 * terminal's current encoding. It's called on paste menu item, or when 879 * user presses Shift+Insert. 880 */ 881 public void pasteClipboard() 882 { 883 vte_terminal_paste_clipboard(vteTerminal); 884 } 885 886 /** 887 * Sends the contents of the #GDK_SELECTION_PRIMARY selection to the terminal's 888 * child. If necessary, the data is converted from UTF-8 to the terminal's 889 * current encoding. The terminal will call also paste the 890 * #GDK_SELECTION_PRIMARY selection when the user clicks with the the second 891 * mouse button. 892 */ 893 public void pastePrimary() 894 { 895 vte_terminal_paste_primary(vteTerminal); 896 } 897 898 /** 899 * Creates a new #VtePty, and sets the emulation property 900 * from #VteTerminal:emulation. 901 * 902 * See vte_pty_new() for more information. 903 * 904 * Params: 905 * flags = flags from #VtePtyFlags 906 * cancellable = a #GCancellable, or %NULL 907 * 908 * Returns: a new #VtePty 909 * 910 * Throws: GException on failure. 911 */ 912 public Pty ptyNewSync(VtePtyFlags flags, Cancellable cancellable) 913 { 914 GError* err = null; 915 916 auto p = vte_terminal_pty_new_sync(vteTerminal, flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err); 917 918 if (err !is null) 919 { 920 throw new GException( new ErrorG(err) ); 921 } 922 923 if(p is null) 924 { 925 return null; 926 } 927 928 return ObjectG.getDObject!(Pty)(cast(VtePty*) p, true); 929 } 930 931 /** 932 * Resets as much of the terminal's internal state as possible, discarding any 933 * unprocessed input data, resetting character attributes, cursor state, 934 * national character set state, status line, terminal modes (insert/delete), 935 * selection state, and encoding. 936 * 937 * Params: 938 * clearTabstops = whether to reset tabstops 939 * clearHistory = whether to empty the terminal's scrollback buffer 940 */ 941 public void reset(bool clearTabstops, bool clearHistory) 942 { 943 vte_terminal_reset(vteTerminal, clearTabstops, clearHistory); 944 } 945 946 /** 947 * Searches the next string matching the search regex set with 948 * vte_terminal_search_set_regex(). 949 * 950 * Returns: %TRUE if a match was found 951 */ 952 public bool searchFindNext() 953 { 954 return vte_terminal_search_find_next(vteTerminal) != 0; 955 } 956 957 /** 958 * Searches the previous string matching the search regex set with 959 * vte_terminal_search_set_regex(). 960 * 961 * Returns: %TRUE if a match was found 962 */ 963 public bool searchFindPrevious() 964 { 965 return vte_terminal_search_find_previous(vteTerminal) != 0; 966 } 967 968 /** 969 * 970 * 971 * Deprecated: use vte_terminal_search_get_regex() instead. 972 * 973 * Returns: %NULL 974 */ 975 public Regex searchGetGregex() 976 { 977 auto p = vte_terminal_search_get_gregex(vteTerminal); 978 979 if(p is null) 980 { 981 return null; 982 } 983 984 return new Regex(cast(GRegex*) p); 985 } 986 987 /** 988 * Returns: the search #VteRegex regex set in @terminal, or %NULL 989 * 990 * Since: 0.46 991 */ 992 public RegexVte searchGetRegex() 993 { 994 auto p = vte_terminal_search_get_regex(vteTerminal); 995 996 if(p is null) 997 { 998 return null; 999 } 1000 1001 return ObjectG.getDObject!(RegexVte)(cast(VteRegex*) p); 1002 } 1003 1004 /** 1005 * Returns: whether searching will wrap around 1006 */ 1007 public bool searchGetWrapAround() 1008 { 1009 return vte_terminal_search_get_wrap_around(vteTerminal) != 0; 1010 } 1011 1012 /** 1013 * Sets the #GRegex regex to search for. Unsets the search regex when passed %NULL. 1014 * 1015 * Deprecated: use vte_terminal_search_set_regex() instead. 1016 * 1017 * Params: 1018 * gregex = a #GRegex, or %NULL 1019 * gflags = flags from #GRegexMatchFlags 1020 */ 1021 public void searchSetGregex(Regex gregex, GRegexMatchFlags gflags) 1022 { 1023 vte_terminal_search_set_gregex(vteTerminal, (gregex is null) ? null : gregex.getRegexStruct(), gflags); 1024 } 1025 1026 /** 1027 * Sets the regex to search for. Unsets the search regex when passed %NULL. 1028 * 1029 * Params: 1030 * regex = a #VteRegex, or %NULL 1031 * flags = PCRE2 match flags, or 0 1032 * 1033 * Since: 0.46 1034 */ 1035 public void searchSetRegex(RegexVte regex, uint flags) 1036 { 1037 vte_terminal_search_set_regex(vteTerminal, (regex is null) ? null : regex.getRegexStruct(), flags); 1038 } 1039 1040 /** 1041 * Sets whether search should wrap around to the beginning of the 1042 * terminal content when reaching its end. 1043 * 1044 * Params: 1045 * wrapAround = whether search should wrap 1046 */ 1047 public void searchSetWrapAround(bool wrapAround) 1048 { 1049 vte_terminal_search_set_wrap_around(vteTerminal, wrapAround); 1050 } 1051 1052 /** 1053 * Selects all text within the terminal (including the scrollback buffer). 1054 */ 1055 public void selectAll() 1056 { 1057 vte_terminal_select_all(vteTerminal); 1058 } 1059 1060 /** 1061 * Controls whether or not the terminal will attempt to draw bold text, 1062 * either by using a bold font variant or by repainting text with a different 1063 * offset. 1064 * 1065 * Params: 1066 * allowBold = %TRUE if the terminal should attempt to draw bold text 1067 */ 1068 public void setAllowBold(bool allowBold) 1069 { 1070 vte_terminal_set_allow_bold(vteTerminal, allowBold); 1071 } 1072 1073 /** 1074 * Controls whether or not hyperlinks (OSC 8 escape sequence) are allowed. 1075 * 1076 * Params: 1077 * allowHyperlink = %TRUE if the terminal should allow hyperlinks 1078 * 1079 * Since: 0.50 1080 */ 1081 public void setAllowHyperlink(bool allowHyperlink) 1082 { 1083 vte_terminal_set_allow_hyperlink(vteTerminal, allowHyperlink); 1084 } 1085 1086 /** 1087 * Controls whether or not the terminal will beep when the child outputs the 1088 * "bl" sequence. 1089 * 1090 * Params: 1091 * isAudible = %TRUE if the terminal should beep 1092 */ 1093 public void setAudibleBell(bool isAudible) 1094 { 1095 vte_terminal_set_audible_bell(vteTerminal, isAudible); 1096 } 1097 1098 /** 1099 * Modifies the terminal's backspace key binding, which controls what 1100 * string or control sequence the terminal sends to its child when the user 1101 * presses the backspace key. 1102 * 1103 * Params: 1104 * binding = a #VteEraseBinding for the backspace key 1105 */ 1106 public void setBackspaceBinding(VteEraseBinding binding) 1107 { 1108 vte_terminal_set_backspace_binding(vteTerminal, binding); 1109 } 1110 1111 /** 1112 * Sets whether the SGR 1 attribute also switches to the bright counterpart 1113 * of the first 8 palette colors, in addition to making them bold (legacy behavior) 1114 * or if SGR 1 only enables bold and leaves the color intact. 1115 * 1116 * Params: 1117 * boldIsBright = %TRUE if bold should also enable bright 1118 * 1119 * Since: 0.52 1120 */ 1121 public void setBoldIsBright(bool boldIsBright) 1122 { 1123 vte_terminal_set_bold_is_bright(vteTerminal, boldIsBright); 1124 } 1125 1126 /** 1127 * Sets the terminal's cell height scale to @scale. 1128 * 1129 * This can be used to increase the line spacing. (The font's height is not affected.) 1130 * Valid values go from 1.0 (default) to 2.0 ("double spacing"). 1131 * 1132 * Params: 1133 * scale = the cell height scale 1134 * 1135 * Since: 0.52 1136 */ 1137 public void setCellHeightScale(double scale) 1138 { 1139 vte_terminal_set_cell_height_scale(vteTerminal, scale); 1140 } 1141 1142 /** 1143 * Sets the terminal's cell width scale to @scale. 1144 * 1145 * This can be used to increase the letter spacing. (The font's width is not affected.) 1146 * Valid values go from 1.0 (default) to 2.0. 1147 * 1148 * Params: 1149 * scale = the cell width scale 1150 * 1151 * Since: 0.52 1152 */ 1153 public void setCellWidthScale(double scale) 1154 { 1155 vte_terminal_set_cell_width_scale(vteTerminal, scale); 1156 } 1157 1158 /** 1159 * This setting controls whether ambiguous-width characters are narrow or wide 1160 * when using the UTF-8 encoding (vte_terminal_set_encoding()). In all other encodings, 1161 * the width of ambiguous-width characters is fixed. 1162 * 1163 * Params: 1164 * width = either 1 (narrow) or 2 (wide) 1165 */ 1166 public void setCjkAmbiguousWidth(int width) 1167 { 1168 vte_terminal_set_cjk_ambiguous_width(vteTerminal, width); 1169 } 1170 1171 /** 1172 * Sets whether to paint the background with the background colour. 1173 * The default is %TRUE. 1174 * 1175 * This function is rarely useful. One use for it is to add a background 1176 * image to the terminal. 1177 * 1178 * Since: 0.52 1179 */ 1180 public void setClearBackground(bool setting) 1181 { 1182 vte_terminal_set_clear_background(vteTerminal, setting); 1183 } 1184 1185 /** 1186 * Sets the background color for text which does not have a specific background 1187 * color assigned. Only has effect when no background image is set and when 1188 * the terminal is not transparent. 1189 * 1190 * Params: 1191 * background = the new background color 1192 */ 1193 public void setColorBackground(RGBA background) 1194 { 1195 vte_terminal_set_color_background(vteTerminal, (background is null) ? null : background.getRGBAStruct()); 1196 } 1197 1198 /** 1199 * Sets the color used to draw bold text in the default foreground color. 1200 * If @bold is %NULL then the default color is used. 1201 * 1202 * Params: 1203 * bold = the new bold color or %NULL 1204 */ 1205 public void setColorBold(RGBA bold) 1206 { 1207 vte_terminal_set_color_bold(vteTerminal, (bold is null) ? null : bold.getRGBAStruct()); 1208 } 1209 1210 /** 1211 * Sets the background color for text which is under the cursor. If %NULL, text 1212 * under the cursor will be drawn with foreground and background colors 1213 * reversed. 1214 * 1215 * Params: 1216 * cursorBackground = the new color to use for the text cursor, or %NULL 1217 */ 1218 public void setColorCursor(RGBA cursorBackground) 1219 { 1220 vte_terminal_set_color_cursor(vteTerminal, (cursorBackground is null) ? null : cursorBackground.getRGBAStruct()); 1221 } 1222 1223 /** 1224 * Sets the foreground color for text which is under the cursor. If %NULL, text 1225 * under the cursor will be drawn with foreground and background colors 1226 * reversed. 1227 * 1228 * Params: 1229 * cursorForeground = the new color to use for the text cursor, or %NULL 1230 * 1231 * Since: 0.44 1232 */ 1233 public void setColorCursorForeground(RGBA cursorForeground) 1234 { 1235 vte_terminal_set_color_cursor_foreground(vteTerminal, (cursorForeground is null) ? null : cursorForeground.getRGBAStruct()); 1236 } 1237 1238 /** 1239 * Sets the foreground color used to draw normal text. 1240 * 1241 * Params: 1242 * foreground = the new foreground color 1243 */ 1244 public void setColorForeground(RGBA foreground) 1245 { 1246 vte_terminal_set_color_foreground(vteTerminal, (foreground is null) ? null : foreground.getRGBAStruct()); 1247 } 1248 1249 /** 1250 * Sets the background color for text which is highlighted. If %NULL, 1251 * it is unset. If neither highlight background nor highlight foreground are set, 1252 * highlighted text (which is usually highlighted because it is selected) will 1253 * be drawn with foreground and background colors reversed. 1254 * 1255 * Params: 1256 * highlightBackground = the new color to use for highlighted text, or %NULL 1257 */ 1258 public void setColorHighlight(RGBA highlightBackground) 1259 { 1260 vte_terminal_set_color_highlight(vteTerminal, (highlightBackground is null) ? null : highlightBackground.getRGBAStruct()); 1261 } 1262 1263 /** 1264 * Sets the foreground color for text which is highlighted. If %NULL, 1265 * it is unset. If neither highlight background nor highlight foreground are set, 1266 * highlighted text (which is usually highlighted because it is selected) will 1267 * be drawn with foreground and background colors reversed. 1268 * 1269 * Params: 1270 * highlightForeground = the new color to use for highlighted text, or %NULL 1271 */ 1272 public void setColorHighlightForeground(RGBA highlightForeground) 1273 { 1274 vte_terminal_set_color_highlight_foreground(vteTerminal, (highlightForeground is null) ? null : highlightForeground.getRGBAStruct()); 1275 } 1276 1277 /** 1278 * @palette specifies the new values for the 256 palette colors: 8 standard colors, 1279 * their 8 bright counterparts, 6x6x6 color cube, and 24 grayscale colors. 1280 * Omitted entries will default to a hardcoded value. 1281 * 1282 * @palette_size must be 0, 8, 16, 232 or 256. 1283 * 1284 * If @foreground is %NULL and @palette_size is greater than 0, the new foreground 1285 * color is taken from @palette[7]. If @background is %NULL and @palette_size is 1286 * greater than 0, the new background color is taken from @palette[0]. 1287 * 1288 * Params: 1289 * foreground = the new foreground color, or %NULL 1290 * background = the new background color, or %NULL 1291 * palette = the color palette 1292 */ 1293 public void setColors(RGBA foreground, RGBA background, RGBA[] palette) 1294 { 1295 GdkRGBA[] paletteArray = new GdkRGBA[palette.length]; 1296 for ( int i = 0; i < palette.length; i++ ) 1297 { 1298 paletteArray[i] = *(palette[i].getRGBAStruct()); 1299 } 1300 1301 vte_terminal_set_colors(vteTerminal, (foreground is null) ? null : foreground.getRGBAStruct(), (background is null) ? null : background.getRGBAStruct(), paletteArray.ptr, cast(size_t)palette.length); 1302 } 1303 1304 /** 1305 * Sets whether or not the cursor will blink. Using %VTE_CURSOR_BLINK_SYSTEM 1306 * will use the #GtkSettings::gtk-cursor-blink setting. 1307 * 1308 * Params: 1309 * mode = the #VteCursorBlinkMode to use 1310 */ 1311 public void setCursorBlinkMode(VteCursorBlinkMode mode) 1312 { 1313 vte_terminal_set_cursor_blink_mode(vteTerminal, mode); 1314 } 1315 1316 /** 1317 * Sets the shape of the cursor drawn. 1318 * 1319 * Params: 1320 * shape = the #VteCursorShape to use 1321 */ 1322 public void setCursorShape(VteCursorShape shape) 1323 { 1324 vte_terminal_set_cursor_shape(vteTerminal, shape); 1325 } 1326 1327 /** 1328 * Reset the terminal palette to reasonable compiled-in default color. 1329 */ 1330 public void setDefaultColors() 1331 { 1332 vte_terminal_set_default_colors(vteTerminal); 1333 } 1334 1335 /** 1336 * Modifies the terminal's delete key binding, which controls what 1337 * string or control sequence the terminal sends to its child when the user 1338 * presses the delete key. 1339 * 1340 * Params: 1341 * binding = a #VteEraseBinding for the delete key 1342 */ 1343 public void setDeleteBinding(VteEraseBinding binding) 1344 { 1345 vte_terminal_set_delete_binding(vteTerminal, binding); 1346 } 1347 1348 /** 1349 * Changes the encoding the terminal will expect data from the child to 1350 * be encoded with. For certain terminal types, applications executing in the 1351 * terminal can change the encoding. If @codeset is %NULL, it uses "UTF-8". 1352 * 1353 * Params: 1354 * codeset = a valid #GIConv target, or %NULL to use UTF-8 1355 * 1356 * Returns: %TRUE if the encoding could be changed to the specified one, 1357 * or %FALSE with @error set to %G_CONVERT_ERROR_NO_CONVERSION. 1358 * 1359 * Throws: GException on failure. 1360 */ 1361 public bool setEncoding(string codeset) 1362 { 1363 GError* err = null; 1364 1365 auto p = vte_terminal_set_encoding(vteTerminal, Str.toStringz(codeset), &err) != 0; 1366 1367 if (err !is null) 1368 { 1369 throw new GException( new ErrorG(err) ); 1370 } 1371 1372 return p; 1373 } 1374 1375 /** 1376 * Sets the font used for rendering all text displayed by the terminal, 1377 * overriding any fonts set using gtk_widget_modify_font(). The terminal 1378 * will immediately attempt to load the desired font, retrieve its 1379 * metrics, and attempt to resize itself to keep the same number of rows 1380 * and columns. The font scale is applied to the specified font. 1381 * 1382 * Params: 1383 * fontDesc = a #PangoFontDescription for the desired font, or %NULL 1384 */ 1385 public void setFont(PgFontDescription fontDesc) 1386 { 1387 vte_terminal_set_font(vteTerminal, (fontDesc is null) ? null : fontDesc.getPgFontDescriptionStruct()); 1388 } 1389 1390 /** 1391 * Sets the terminal's font scale to @scale. 1392 * 1393 * Params: 1394 * scale = the font scale 1395 */ 1396 public void setFontScale(double scale) 1397 { 1398 vte_terminal_set_font_scale(vteTerminal, scale); 1399 } 1400 1401 /** 1402 * Sets @terminal as @window's geometry widget. See 1403 * gtk_window_set_geometry_hints() for more information. 1404 * 1405 * @terminal must be realized (see gtk_widget_get_realized()). 1406 * 1407 * Params: 1408 * window = a #GtkWindow 1409 */ 1410 public void setGeometryHintsForWindow(Window window) 1411 { 1412 vte_terminal_set_geometry_hints_for_window(vteTerminal, (window is null) ? null : window.getWindowStruct()); 1413 } 1414 1415 /** 1416 * Enables or disables user input. When user input is disabled, 1417 * the terminal's child will not receive any key press, or mouse button 1418 * press or motion events sent to it. 1419 * 1420 * Params: 1421 * enabled = whether to enable user input 1422 */ 1423 public void setInputEnabled(bool enabled) 1424 { 1425 vte_terminal_set_input_enabled(vteTerminal, enabled); 1426 } 1427 1428 /** 1429 * Changes the value of the terminal's mouse autohide setting. When autohiding 1430 * is enabled, the mouse cursor will be hidden when the user presses a key and 1431 * shown when the user moves the mouse. This setting can be read using 1432 * vte_terminal_get_mouse_autohide(). 1433 * 1434 * Params: 1435 * setting = whether the mouse pointer should autohide 1436 */ 1437 public void setMouseAutohide(bool setting) 1438 { 1439 vte_terminal_set_mouse_autohide(vteTerminal, setting); 1440 } 1441 1442 /** 1443 * Sets @pty as the PTY to use in @terminal. 1444 * Use %NULL to unset the PTY. 1445 * 1446 * Params: 1447 * pty = a #VtePty, or %NULL 1448 */ 1449 public void setPty(Pty pty) 1450 { 1451 vte_terminal_set_pty(vteTerminal, (pty is null) ? null : pty.getPtyStruct()); 1452 } 1453 1454 /** 1455 * Controls whether or not the terminal will rewrap its contents, including 1456 * the scrollback history, whenever the terminal's width changes. 1457 * 1458 * Params: 1459 * rewrap = %TRUE if the terminal should rewrap on resize 1460 */ 1461 public void setRewrapOnResize(bool rewrap) 1462 { 1463 vte_terminal_set_rewrap_on_resize(vteTerminal, rewrap); 1464 } 1465 1466 /** 1467 * Controls whether or not the terminal will forcibly scroll to the bottom of 1468 * the viewable history when the user presses a key. Modifier keys do not 1469 * trigger this behavior. 1470 * 1471 * Params: 1472 * scroll = whether the terminal should scroll on keystrokes 1473 */ 1474 public void setScrollOnKeystroke(bool scroll) 1475 { 1476 vte_terminal_set_scroll_on_keystroke(vteTerminal, scroll); 1477 } 1478 1479 /** 1480 * Controls whether or not the terminal will forcibly scroll to the bottom of 1481 * the viewable history when the new data is received from the child. 1482 * 1483 * Params: 1484 * scroll = whether the terminal should scroll on output 1485 */ 1486 public void setScrollOnOutput(bool scroll) 1487 { 1488 vte_terminal_set_scroll_on_output(vteTerminal, scroll); 1489 } 1490 1491 /** 1492 * Sets the length of the scrollback buffer used by the terminal. The size of 1493 * the scrollback buffer will be set to the larger of this value and the number 1494 * of visible rows the widget can display, so 0 can safely be used to disable 1495 * scrollback. 1496 * 1497 * A negative value means "infinite scrollback". 1498 * 1499 * Note that this setting only affects the normal screen buffer. 1500 * No scrollback is allowed on the alternate screen buffer. 1501 * 1502 * Params: 1503 * lines = the length of the history buffer 1504 */ 1505 public void setScrollbackLines(glong lines) 1506 { 1507 vte_terminal_set_scrollback_lines(vteTerminal, lines); 1508 } 1509 1510 /** 1511 * Attempts to change the terminal's size in terms of rows and columns. If 1512 * the attempt succeeds, the widget will resize itself to the proper size. 1513 * 1514 * Params: 1515 * columns = the desired number of columns 1516 * rows = the desired number of rows 1517 */ 1518 public void setSize(glong columns, glong rows) 1519 { 1520 vte_terminal_set_size(vteTerminal, columns, rows); 1521 } 1522 1523 /** 1524 * Controls whether or not the terminal will allow blinking text. 1525 * 1526 * Params: 1527 * textBlinkMode = the #VteTextBlinkMode to use 1528 * 1529 * Since: 0.52 1530 */ 1531 public void setTextBlinkMode(VteTextBlinkMode textBlinkMode) 1532 { 1533 vte_terminal_set_text_blink_mode(vteTerminal, textBlinkMode); 1534 } 1535 1536 /** 1537 * With this function you can provide a set of characters which will 1538 * be considered parts of a word when doing word-wise selection, in 1539 * addition to the default which only considers alphanumeric characters 1540 * part of a word. 1541 * 1542 * The characters in @exceptions must be non-alphanumeric, each character 1543 * must occur only once, and if @exceptions contains the character 1544 * U+002D HYPHEN-MINUS, it must be at the start of the string. 1545 * 1546 * Use %NULL to reset the set of exception characters to the default. 1547 * 1548 * Params: 1549 * exceptions = a string of ASCII punctuation characters, or %NULL 1550 * 1551 * Since: 0.40 1552 */ 1553 public void setWordCharExceptions(string exceptions) 1554 { 1555 vte_terminal_set_word_char_exceptions(vteTerminal, Str.toStringz(exceptions)); 1556 } 1557 1558 /** 1559 * A convenience function that wraps creating the #VtePty and spawning 1560 * the child process on it. See vte_pty_new_sync(), vte_pty_spawn_async(), 1561 * and vte_pty_spawn_finish() for more information. 1562 * 1563 * When the operation is finished successfully, @callback will be called 1564 * with the child #GPid, and a %NULL #GError. The child PID will already be 1565 * watched via vte_terminal_watch_child(). 1566 * 1567 * When the operation fails, @callback will be called with a -1 #GPid, 1568 * and a non-%NULL #GError containing the error information. 1569 * 1570 * Note that if @terminal has been destroyed before the operation is called, 1571 * @callback will be called with a %NULL @terminal; you must not do anything 1572 * in the callback besides freeing any resources associated with @user_data, 1573 * but taking care not to access the now-destroyed #VteTerminal. Note that 1574 * in this case, if spawning was successful, the child process will be aborted 1575 * automatically. 1576 * 1577 * Beginning with 0.52, sets PWD to @working_directory in order to preserve symlink components. 1578 * The caller should also make sure that symlinks were preserved while constructing the value of @working_directory, 1579 * e.g. by using vte_terminal_get_current_directory_uri(), g_get_current_dir() or get_current_dir_name(). 1580 * 1581 * Params: 1582 * ptyFlags = flags from #VtePtyFlags 1583 * workingDirectory = the name of a directory the command should start 1584 * in, or %NULL to use the current working directory 1585 * argv = child's argument vector 1586 * envv = a list of environment 1587 * variables to be added to the environment before starting the process, or %NULL 1588 * spawnFlags = flags from #GSpawnFlags 1589 * childSetup = an extra child setup function to run in the child just before exec(), or %NULL 1590 * childSetupData = user data for @child_setup, or %NULL 1591 * childSetupDataDestroy = a #GDestroyNotify for @child_setup_data, or %NULL 1592 * timeout = a timeout value in ms, or -1 to wait indefinitely 1593 * cancellable = a #GCancellable, or %NULL 1594 * callback = a #VteTerminalSpawnAsyncCallback, or %NULL 1595 * userData = user data for @callback, or %NULL 1596 * 1597 * Since: 0.48 1598 */ 1599 public void spawnAsync(VtePtyFlags ptyFlags, string workingDirectory, string[] argv, string[] envv, GSpawnFlags spawnFlags, GSpawnChildSetupFunc childSetup, void* childSetupData, GDestroyNotify childSetupDataDestroy, int timeout, Cancellable cancellable, VteTerminalSpawnAsyncCallback callback, void* userData) 1600 { 1601 vte_terminal_spawn_async(vteTerminal, ptyFlags, Str.toStringz(workingDirectory), Str.toStringzArray(argv), Str.toStringzArray(envv), spawnFlags, childSetup, childSetupData, childSetupDataDestroy, timeout, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData); 1602 } 1603 1604 /** 1605 * Starts the specified command under a newly-allocated controlling 1606 * pseudo-terminal. The @argv and @envv lists should be %NULL-terminated. 1607 * The "TERM" environment variable is automatically set to a default value, 1608 * but can be overridden from @envv. 1609 * @pty_flags controls logging the session to the specified system log files. 1610 * 1611 * Note that %G_SPAWN_DO_NOT_REAP_CHILD will always be added to @spawn_flags. 1612 * 1613 * Note that all open file descriptors will be closed in the child. If you want 1614 * to keep some file descriptor open for use in the child process, you need to 1615 * use a child setup function that unsets the FD_CLOEXEC flag on that file 1616 * descriptor. 1617 * 1618 * See vte_pty_new(), g_spawn_async() and vte_terminal_watch_child() for more information. 1619 * 1620 * Beginning with 0.52, sets PWD to @working_directory in order to preserve symlink components. 1621 * The caller should also make sure that symlinks were preserved while constructing the value of @working_directory, 1622 * e.g. by using vte_terminal_get_current_directory_uri(), g_get_current_dir() or get_current_dir_name(). 1623 * 1624 * Deprecated: Use vte_terminal_spawn_async() instead. 1625 * 1626 * Params: 1627 * ptyFlags = flags from #VtePtyFlags 1628 * workingDirectory = the name of a directory the command should start 1629 * in, or %NULL to use the current working directory 1630 * argv = child's argument vector 1631 * envv = a list of environment 1632 * variables to be added to the environment before starting the process, or %NULL 1633 * spawnFlags = flags from #GSpawnFlags 1634 * childSetup = an extra child setup function to run in the child just before exec(), or %NULL 1635 * childSetupData = user data for @child_setup 1636 * childPid = a location to store the child PID, or %NULL 1637 * cancellable = a #GCancellable, or %NULL 1638 * 1639 * Returns: %TRUE on success, or %FALSE on error with @error filled in 1640 * 1641 * Throws: GException on failure. 1642 */ 1643 public bool spawnSync(VtePtyFlags ptyFlags, string workingDirectory, string[] argv, string[] envv, GSpawnFlags spawnFlags, GSpawnChildSetupFunc childSetup, void* childSetupData, out GPid childPid, Cancellable cancellable) 1644 { 1645 GError* err = null; 1646 1647 auto p = vte_terminal_spawn_sync(vteTerminal, ptyFlags, Str.toStringz(workingDirectory), Str.toStringzArray(argv), Str.toStringzArray(envv), spawnFlags, childSetup, childSetupData, &childPid, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 1648 1649 if (err !is null) 1650 { 1651 throw new GException( new ErrorG(err) ); 1652 } 1653 1654 return p; 1655 } 1656 1657 /** 1658 * Clears the current selection. 1659 */ 1660 public void unselectAll() 1661 { 1662 vte_terminal_unselect_all(vteTerminal); 1663 } 1664 1665 /** 1666 * Watches @child_pid. When the process exists, the #VteTerminal::child-exited 1667 * signal will be called with the child's exit status. 1668 * 1669 * Prior to calling this function, a #VtePty must have been set in @terminal 1670 * using vte_terminal_set_pty(). 1671 * When the child exits, the terminal's #VtePty will be set to %NULL. 1672 * 1673 * Note: g_child_watch_add() or g_child_watch_add_full() must not have 1674 * been called for @child_pid, nor a #GSource for it been created with 1675 * g_child_watch_source_new(). 1676 * 1677 * Note: when using the g_spawn_async() family of functions, 1678 * the %G_SPAWN_DO_NOT_REAP_CHILD flag MUST have been passed. 1679 * 1680 * Params: 1681 * childPid = a #GPid 1682 */ 1683 public void watchChild(GPid childPid) 1684 { 1685 vte_terminal_watch_child(vteTerminal, childPid); 1686 } 1687 1688 /** 1689 * Write contents of the current contents of @terminal (including any 1690 * scrollback history) to @stream according to @flags. 1691 * 1692 * If @cancellable is not %NULL, then the operation can be cancelled by triggering 1693 * the cancellable object from another thread. If the operation was cancelled, 1694 * the error %G_IO_ERROR_CANCELLED will be returned in @error. 1695 * 1696 * This is a synchronous operation and will make the widget (and input 1697 * processing) during the write operation, which may take a long time 1698 * depending on scrollback history and @stream availability for writing. 1699 * 1700 * Params: 1701 * stream = a #GOutputStream to write to 1702 * flags = a set of #VteWriteFlags 1703 * cancellable = a #GCancellable object, or %NULL 1704 * 1705 * Returns: %TRUE on success, %FALSE if there was an error 1706 * 1707 * Throws: GException on failure. 1708 */ 1709 public bool writeContentsSync(OutputStream stream, VteWriteFlags flags, Cancellable cancellable) 1710 { 1711 GError* err = null; 1712 1713 auto p = vte_terminal_write_contents_sync(vteTerminal, (stream is null) ? null : stream.getOutputStreamStruct(), flags, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err) != 0; 1714 1715 if (err !is null) 1716 { 1717 throw new GException( new ErrorG(err) ); 1718 } 1719 1720 return p; 1721 } 1722 1723 /** 1724 * This signal is emitted when the a child sends a bell request to the 1725 * terminal. 1726 */ 1727 gulong addOnBell(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1728 { 1729 return Signals.connect(this, "bell", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1730 } 1731 1732 /** 1733 * Emitted whenever the cell size changes, e.g. due to a change in 1734 * font, font-scale or cell-width/height-scale. 1735 * 1736 * Note that this signal should rather be called "cell-size-changed". 1737 * 1738 * Params: 1739 * width = the new character cell width 1740 * height = the new character cell height 1741 */ 1742 gulong addOnCharSizeChanged(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1743 { 1744 return Signals.connect(this, "char-size-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1745 } 1746 1747 /** 1748 * This signal is emitted when the terminal detects that a child 1749 * watched using vte_terminal_watch_child() has exited. 1750 * 1751 * Params: 1752 * status = the child's exit status 1753 */ 1754 gulong addOnChildExited(void delegate(int, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1755 { 1756 return Signals.connect(this, "child-exited", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1757 } 1758 1759 /** 1760 * Emitted whenever the terminal receives input from the user and 1761 * prepares to send it to the child process. The signal is emitted even 1762 * when there is no child process. 1763 * 1764 * Params: 1765 * text = a string of text 1766 * size = the length of that string of text 1767 */ 1768 gulong addOnCommit(void delegate(string, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1769 { 1770 return Signals.connect(this, "commit", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1771 } 1772 1773 /** 1774 * Emitted whenever the visible appearance of the terminal has changed. 1775 * Used primarily by #VteTerminalAccessible. 1776 */ 1777 gulong addOnContentsChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1778 { 1779 return Signals.connect(this, "contents-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1780 } 1781 1782 /** 1783 * Emitted whenever vte_terminal_copy_clipboard() is called. 1784 */ 1785 gulong addOnCopyClipboard(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1786 { 1787 return Signals.connect(this, "copy-clipboard", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1788 } 1789 1790 /** 1791 * Emitted when the current directory URI is modified. 1792 */ 1793 gulong addOnCurrentDirectoryUriChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1794 { 1795 return Signals.connect(this, "current-directory-uri-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1796 } 1797 1798 /** 1799 * Emitted when the current file URI is modified. 1800 */ 1801 gulong addOnCurrentFileUriChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1802 { 1803 return Signals.connect(this, "current-file-uri-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1804 } 1805 1806 /** 1807 * Emitted whenever the cursor moves to a new character cell. Used 1808 * primarily by #VteTerminalAccessible. 1809 */ 1810 gulong addOnCursorMoved(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1811 { 1812 return Signals.connect(this, "cursor-moved", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1813 } 1814 1815 /** 1816 * Emitted when the user hits the '-' key while holding the Control key. 1817 */ 1818 gulong addOnDecreaseFontSize(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1819 { 1820 return Signals.connect(this, "decrease-font-size", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1821 } 1822 1823 /** 1824 * Emitted at the child application's request. 1825 */ 1826 gulong addOnDeiconifyWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1827 { 1828 return Signals.connect(this, "deiconify-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1829 } 1830 1831 /** 1832 * Emitted whenever the terminal's current encoding has changed, either 1833 * as a result of receiving a control sequence which toggled between the 1834 * local and UTF-8 encodings, or at the parent application's request. 1835 */ 1836 gulong addOnEncodingChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1837 { 1838 return Signals.connect(this, "encoding-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1839 } 1840 1841 /** 1842 * Emitted when the terminal receives an end-of-file from a child which 1843 * is running in the terminal. This signal is frequently (but not 1844 * always) emitted with a #VteTerminal::child-exited signal. 1845 */ 1846 gulong addOnEof(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1847 { 1848 return Signals.connect(this, "eof", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1849 } 1850 1851 /** 1852 * Emitted when the hovered hyperlink changes. 1853 * 1854 * @uri and @bbox are owned by VTE, must not be modified, and might 1855 * change after the signal handlers returns. 1856 * 1857 * The signal is not re-emitted when the bounding box changes for the 1858 * same hyperlink. This might change in a future VTE version without notice. 1859 * 1860 * Params: 1861 * uri = the nonempty target URI under the mouse, or NULL 1862 * bbox = the bounding box of the hyperlink anchor text, or NULL 1863 * 1864 * Since: 0.50 1865 */ 1866 gulong addOnHyperlinkHoverUriChanged(void delegate(string, GdkRectangle*, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1867 { 1868 return Signals.connect(this, "hyperlink-hover-uri-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1869 } 1870 1871 /** 1872 * Emitted when the terminal's %icon_title field is modified. 1873 */ 1874 gulong addOnIconTitleChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1875 { 1876 return Signals.connect(this, "icon-title-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1877 } 1878 1879 /** 1880 * Emitted at the child application's request. 1881 */ 1882 gulong addOnIconifyWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1883 { 1884 return Signals.connect(this, "iconify-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1885 } 1886 1887 /** 1888 * Emitted when the user hits the '+' key while holding the Control key. 1889 */ 1890 gulong addOnIncreaseFontSize(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1891 { 1892 return Signals.connect(this, "increase-font-size", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1893 } 1894 1895 /** 1896 * Emitted at the child application's request. 1897 */ 1898 gulong addOnLowerWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1899 { 1900 return Signals.connect(this, "lower-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1901 } 1902 1903 /** 1904 * Emitted at the child application's request. 1905 */ 1906 gulong addOnMaximizeWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1907 { 1908 return Signals.connect(this, "maximize-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1909 } 1910 1911 /** 1912 * Emitted at the child application's request. 1913 * 1914 * Params: 1915 * x = the terminal's desired location, X coordinate 1916 * y = the terminal's desired location, Y coordinate 1917 */ 1918 gulong addOnMoveWindow(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1919 { 1920 return Signals.connect(this, "move-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1921 } 1922 1923 /** 1924 * Emitted whenever vte_terminal_paste_clipboard() is called. 1925 */ 1926 gulong addOnPasteClipboard(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1927 { 1928 return Signals.connect(this, "paste-clipboard", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1929 } 1930 1931 /** 1932 * Emitted at the child application's request. 1933 */ 1934 gulong addOnRaiseWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1935 { 1936 return Signals.connect(this, "raise-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1937 } 1938 1939 /** 1940 * Emitted at the child application's request. 1941 */ 1942 gulong addOnRefreshWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1943 { 1944 return Signals.connect(this, "refresh-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1945 } 1946 1947 /** 1948 * Emitted at the child application's request. 1949 * 1950 * Params: 1951 * width = the desired number of columns 1952 * height = the desired number of rows 1953 */ 1954 gulong addOnResizeWindow(void delegate(uint, uint, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1955 { 1956 return Signals.connect(this, "resize-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1957 } 1958 1959 /** 1960 * Emitted at the child application's request. 1961 */ 1962 gulong addOnRestoreWindow(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1963 { 1964 return Signals.connect(this, "restore-window", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1965 } 1966 1967 /** 1968 * Emitted whenever the contents of terminal's selection changes. 1969 */ 1970 gulong addOnSelectionChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1971 { 1972 return Signals.connect(this, "selection-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1973 } 1974 1975 /** 1976 * An internal signal used for communication between the terminal and 1977 * its accessibility peer. May not be emitted under certain 1978 * circumstances. 1979 */ 1980 gulong addOnTextDeleted(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1981 { 1982 return Signals.connect(this, "text-deleted", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1983 } 1984 1985 /** 1986 * An internal signal used for communication between the terminal and 1987 * its accessibility peer. May not be emitted under certain 1988 * circumstances. 1989 */ 1990 gulong addOnTextInserted(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 1991 { 1992 return Signals.connect(this, "text-inserted", dlg, connectFlags ^ ConnectFlags.SWAPPED); 1993 } 1994 1995 /** 1996 * An internal signal used for communication between the terminal and 1997 * its accessibility peer. May not be emitted under certain 1998 * circumstances. 1999 */ 2000 gulong addOnTextModified(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2001 { 2002 return Signals.connect(this, "text-modified", dlg, connectFlags ^ ConnectFlags.SWAPPED); 2003 } 2004 2005 /** 2006 * An internal signal used for communication between the terminal and 2007 * its accessibility peer. May not be emitted under certain 2008 * circumstances. 2009 * 2010 * Params: 2011 * delta = the number of lines scrolled 2012 */ 2013 gulong addOnTextScrolled(void delegate(int, Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2014 { 2015 return Signals.connect(this, "text-scrolled", dlg, connectFlags ^ ConnectFlags.SWAPPED); 2016 } 2017 2018 /** 2019 * Emitted when the terminal's %window_title field is modified. 2020 */ 2021 gulong addOnWindowTitleChanged(void delegate(Terminal) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 2022 { 2023 return Signals.connect(this, "window-title-changed", dlg, connectFlags ^ ConnectFlags.SWAPPED); 2024 } 2025 2026 /** 2027 * Gets the user's shell, or %NULL. In the latter case, the 2028 * system default (usually "/bin/sh") should be used. 2029 * 2030 * Returns: a newly allocated string with the 2031 * user's shell, or %NULL 2032 */ 2033 public static string getUserShell() 2034 { 2035 auto retStr = vte_get_user_shell(); 2036 2037 scope(exit) Str.freeString(retStr); 2038 return Str.toString(retStr); 2039 } 2040 }