From b37826b98482476ef595f1283a76039ee1ef0cba Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Mon, 30 Dec 2024 12:56:10 +0900 Subject: [PATCH 1/3] Properly encode pasted text containing newlines --- source/gx/tilix/terminal/terminal.d | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/source/gx/tilix/terminal/terminal.d b/source/gx/tilix/terminal/terminal.d index 01f920866..afafb28c8 100644 --- a/source/gx/tilix/terminal/terminal.d +++ b/source/gx/tilix/terminal/terminal.d @@ -1447,7 +1447,7 @@ private: dialog.showAll(); if (dialog.run() == ResponseType.APPLY) { pasteText = dialog.text; - vte.feedChild(pasteText[0 .. $]); + this.pasteText(pasteText[0 .. $]); if (gsProfile.getBoolean(SETTINGS_PROFILE_SCROLL_ON_INPUT_KEY)) { scrollToBottom(); } @@ -1488,9 +1488,9 @@ private: if (gsSettings.getBoolean(SETTINGS_STRIP_FIRST_COMMENT_CHAR_ON_PASTE_KEY) && pasteText.length > 0 && (pasteText[0] == '#' || pasteText[0] == '$')) { pasteText = pasteText[1 .. $]; - vte.feedChild(pasteText); + this.pasteText(pasteText); } else if (stripTrailingWhitespace) { - vte.feedChild(pasteText); + this.pasteText(pasteText); } else if (source == GDK_SELECTION_CLIPBOARD) { vte.pasteClipboard(); } else { @@ -2633,6 +2633,17 @@ private: } } + void pasteText(string text) { + // It is better to use vte.pasteText(text), but a GtkD version that + // contains vte.pasteText(text) has not yet been released. The current + // lateset version GtkD 3.10.0 does not have this interface. We + // instead need to manually convert the newlines or implement the + // bracketed paste mode. We use the simple newline conversion here. + // When the next version of GtkD is released, the following line should + // be replaced with "vte.pasteText(text);". + vte.feedChild(text.replace("\n", "\r")); + } + void showInfoBarMessage(string message) { TerminalInfoBar ibRelaunch = new TerminalInfoBar(); ibRelaunch.addOnResponse(delegate(int response, InfoBar ib) { From 9635921342586c536879b7f67f3762f57216a3b6 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Tue, 31 Dec 2024 15:51:34 +0900 Subject: [PATCH 2/3] Update to GtkD 3.11.0 * We switch to specify "GtkAlign" instead of its alias "Align". We have been referencing "gtk.c.types.Align" by "Align". However, gtk-d (GtkD) 3.11.0 added "vte.c.types.Align", which made "Align" ambiguous. --- dub.json | 6 +- dub.selections.json | 2 +- source/gx/tilix/bookmark/bmeditor.d | 2 +- source/gx/tilix/closedialog.d | 2 +- source/gx/tilix/customtitle.d | 6 +- source/gx/tilix/prefeditor/advdialog.d | 2 +- source/gx/tilix/prefeditor/common.d | 14 ++-- source/gx/tilix/prefeditor/prefdialog.d | 30 ++++----- source/gx/tilix/prefeditor/profileeditor.d | 76 +++++++++++----------- source/gx/tilix/session.d | 4 +- source/gx/tilix/sidebar.d | 10 +-- source/gx/tilix/terminal/advpaste.d | 2 +- source/gx/tilix/terminal/layout.d | 10 +-- source/gx/tilix/terminal/password.d | 8 +-- source/gx/tilix/terminal/search.d | 6 +- source/gx/tilix/terminal/terminal.d | 8 +-- 16 files changed, 94 insertions(+), 94 deletions(-) diff --git a/dub.json b/dub.json index 45f6e0c6a..bebf2ff31 100644 --- a/dub.json +++ b/dub.json @@ -7,10 +7,10 @@ "dflags-ldc": ["-disable-linker-strip-dead","-link-defaultlib-shared=false"], "dependencies": { "gtk-d:gtkd": { - "version": "3.10.0" + "version": "3.11.0" }, "gtk-d:vte": { - "version": "3.10.0" + "version": "3.11.0" } }, "buildTypes": { @@ -50,4 +50,4 @@ "versions": ["StdLoggerDisableTrace"] } ] -} \ No newline at end of file +} diff --git a/dub.selections.json b/dub.selections.json index fd7260a76..a43c280db 100644 --- a/dub.selections.json +++ b/dub.selections.json @@ -1,6 +1,6 @@ { "fileVersion": 1, "versions": { - "gtk-d": "3.10.0" + "gtk-d": "3.11.0" } } diff --git a/source/gx/tilix/bookmark/bmeditor.d b/source/gx/tilix/bookmark/bmeditor.d index db3b8652a..7d9deca8f 100644 --- a/source/gx/tilix/bookmark/bmeditor.d +++ b/source/gx/tilix/bookmark/bmeditor.d @@ -217,7 +217,7 @@ protected: Label createLabel(string text) { Label result = new Label(text); - result.setHalign(Align.END); + result.setHalign(GtkAlign.END); return result; } diff --git a/source/gx/tilix/closedialog.d b/source/gx/tilix/closedialog.d index 44f402bf4..bddb2489a 100644 --- a/source/gx/tilix/closedialog.d +++ b/source/gx/tilix/closedialog.d @@ -91,7 +91,7 @@ private: Box box = new Box(Orientation.VERTICAL, 6); Label lbl = new Label("There are processes still running as shown below, close anyway?"); - lbl.setHalign(Align.START); + lbl.setHalign(GtkAlign.START); lbl.setMarginBottom(6); box.add(lbl); diff --git a/source/gx/tilix/customtitle.d b/source/gx/tilix/customtitle.d index d803bb3d2..aca96ee95 100644 --- a/source/gx/tilix/customtitle.d +++ b/source/gx/tilix/customtitle.d @@ -62,17 +62,17 @@ private: bool controlRequired; void createUI() { - setHalign(Align.FILL); + setHalign(GtkAlign.FILL); lblTitle = new Label(_(APPLICATION_NAME)); - lblTitle.setHalign(Align.CENTER); + lblTitle.setHalign(GtkAlign.CENTER); lblTitle.getStyleContext().addClass("title"); lblTitle.setEllipsize(PangoEllipsizeMode.START); eb = new EventBox(); eb.addOnButtonPress(&onButtonPress); eb.addOnButtonRelease(&onButtonRelease); eb.add(lblTitle); - eb.setHalign(Align.FILL); + eb.setHalign(GtkAlign.FILL); addNamed(eb, PAGE_LABEL); eTitle = new Entry(); diff --git a/source/gx/tilix/prefeditor/advdialog.d b/source/gx/tilix/prefeditor/advdialog.d index 512c499ee..8232e9484 100644 --- a/source/gx/tilix/prefeditor/advdialog.d +++ b/source/gx/tilix/prefeditor/advdialog.d @@ -381,7 +381,7 @@ private: Label createErrorLabel() { Label lblErrors = new Label(""); - lblErrors.setHalign(Align.START); + lblErrors.setHalign(GtkAlign.START); lblErrors.setMarginTop(12); lblErrors.getStyleContext().addClass("tilix-error"); lblErrors.setNoShowAll(true); diff --git a/source/gx/tilix/prefeditor/common.d b/source/gx/tilix/prefeditor/common.d index 5ade16b9a..86fb363b4 100644 --- a/source/gx/tilix/prefeditor/common.d +++ b/source/gx/tilix/prefeditor/common.d @@ -36,7 +36,7 @@ void createAdvancedUI(Grid grid, ref uint row, GSettings delegate() scb, bool sh // Custom Links Section Label lblCustomLinks = new Label(format("%s", _("Custom Links"))); lblCustomLinks.setUseMarkup(true); - lblCustomLinks.setHalign(Align.START); + lblCustomLinks.setHalign(GtkAlign.START); grid.attach(lblCustomLinks, 0, row, 3, 1); row++; @@ -44,8 +44,8 @@ void createAdvancedUI(Grid grid, ref uint row, GSettings delegate() scb, bool sh grid.attach(createDescriptionLabel(customLinksDescription), 0, row, 2, 1); Button btnEditLink = new Button(_("Edit")); - btnEditLink.setHalign(Align.FILL); - btnEditLink.setValign(Align.CENTER); + btnEditLink.setHalign(GtkAlign.FILL); + btnEditLink.setValign(GtkAlign.CENTER); btnEditLink.addOnClicked(delegate(Button) { GSettings gs = scb(); @@ -66,7 +66,7 @@ void createAdvancedUI(Grid grid, ref uint row, GSettings delegate() scb, bool sh // Triggers Section Label lblTriggers = new Label(format("%s", _("Triggers"))); lblTriggers.setUseMarkup(true); - lblTriggers.setHalign(Align.START); + lblTriggers.setHalign(GtkAlign.START); lblTriggers.setMarginTop(12); grid.attach(lblTriggers, 0, row, 3, 1); row++; @@ -75,8 +75,8 @@ void createAdvancedUI(Grid grid, ref uint row, GSettings delegate() scb, bool sh grid.attach(createDescriptionLabel(triggersDescription), 0, row, 2, 1); Button btnEditTriggers = new Button(_("Edit")); - btnEditTriggers.setHalign(Align.FILL); - btnEditTriggers.setValign(Align.CENTER); + btnEditTriggers.setHalign(GtkAlign.FILL); + btnEditTriggers.setValign(GtkAlign.CENTER); btnEditTriggers.addOnClicked(delegate(Button) { GSettings gs = scb(); @@ -102,7 +102,7 @@ Label createDescriptionLabel(string desc) { lblDescription.setUseMarkup(true); lblDescription.setSensitive(false); lblDescription.setLineWrap(true); - lblDescription.setHalign(Align.START); + lblDescription.setHalign(GtkAlign.START); if (Version.checkVersion(3, 16, 0).length == 0) { lblDescription.setXalign(0.0); } diff --git a/source/gx/tilix/prefeditor/prefdialog.d b/source/gx/tilix/prefeditor/prefdialog.d index 80260451e..25d30cb87 100644 --- a/source/gx/tilix/prefeditor/prefdialog.d +++ b/source/gx/tilix/prefeditor/prefdialog.d @@ -282,7 +282,7 @@ private: bProfileTitle.add(new Separator(Orientation.HORIZONTAL)); Label lblProfileTitle = new Label(format("%s",_("Profiles"))); lblProfileTitle.setUseMarkup(true); - lblProfileTitle.setHalign(Align.START); + lblProfileTitle.setHalign(GtkAlign.START); lblProfileTitle.setSensitive(false); setAllMargins(row, 6); bProfileTitle.add(lblProfileTitle); @@ -480,7 +480,7 @@ public: _title = title; Label label = new Label(_(name)); - label.setHalign(Align.START); + label.setHalign(GtkAlign.START); setAllMargins(label, 6); add(label); } @@ -515,7 +515,7 @@ private: setAllMargins(box, 6); lblName = new Label(profile.name); - lblName.setHalign(Align.START); + lblName.setHalign(GtkAlign.START); box.packStart(lblName, true, true, 2); MenuButton btnMenu = new MenuButton(); @@ -635,7 +635,7 @@ private: setMarginBottom(18); Label lblEncoding = new Label(_("Encodings showing in menu:")); - lblEncoding.setHalign(Align.START); + lblEncoding.setHalign(GtkAlign.START); add(lblEncoding); string[] menuEncodings = gsSettings.getStrv(SETTINGS_ENCODINGS_KEY); @@ -1176,7 +1176,7 @@ class AppearancePreferences: Box { bWindowStyle.add(cbWindowStyle); Label lblRestart = new Label(_("Window restart required")); - lblRestart.setHalign(Align.START); + lblRestart.setHalign(GtkAlign.START); lblRestart.setSensitive(false); bWindowStyle.add(lblRestart); @@ -1256,7 +1256,7 @@ class AppearancePreferences: Box { //Session Name Label lblSessionName = new Label(_("Default session name")); - lblSessionName.setHalign(Align.END); + lblSessionName.setHalign(GtkAlign.END); grid.attach(lblSessionName, 0, row, 1, 1); Entry eSessionName = new Entry(); @@ -1271,7 +1271,7 @@ class AppearancePreferences: Box { //Application Title Label lblAppTitle = new Label(_("Application title")); - lblAppTitle.setHalign(Align.END); + lblAppTitle.setHalign(GtkAlign.END); grid.attach(lblAppTitle, 0, row, 1, 1); Entry eAppTitle = new Entry(); @@ -1347,7 +1347,7 @@ private: Label lblSize = new Label(format("%s", _("Size"))); lblSize.setUseMarkup(true); - lblSize.setHalign(Align.START); + lblSize.setHalign(GtkAlign.START); add(lblSize); Grid grid = new Grid(); @@ -1360,7 +1360,7 @@ private: Scale sHeight = new Scale(Orientation.HORIZONTAL, 10, 90, 10); sHeight.setValuePos(GtkPositionType.RIGHT); sHeight.setHexpand(true); - sHeight.setHalign(Align.FILL); + sHeight.setHalign(GtkAlign.FILL); bh.bind(SETTINGS_QUAKE_HEIGHT_PERCENT_KEY, sHeight.getAdjustment(), "value", GSettingsBindFlags.DEFAULT); grid.attach(sHeight, 1, row, 1, 1); row++; @@ -1371,7 +1371,7 @@ private: Scale sWidth = new Scale(Orientation.HORIZONTAL, 10, 100, 10); sWidth.setValuePos(GtkPositionType.RIGHT); sWidth.setHexpand(true); - sWidth.setHalign(Align.FILL); + sWidth.setHalign(GtkAlign.FILL); bh.bind(SETTINGS_QUAKE_WIDTH_PERCENT_KEY, sWidth.getAdjustment(), "value", GSettingsBindFlags.DEFAULT); grid.attach(sWidth, 1, row, 1, 1); row++; @@ -1402,7 +1402,7 @@ private: Label lblOptions = new Label(format("%s", _("Options"))); lblOptions.setUseMarkup(true); - lblOptions.setHalign(Align.START); + lblOptions.setHalign(GtkAlign.START); add(lblOptions); Box bContent = new Box(Orientation.VERTICAL, 6); @@ -1532,7 +1532,7 @@ private: Label lblBehavior = new Label(format("%s", _("Behavior"))); lblBehavior.setUseMarkup(true); - lblBehavior.setHalign(Align.START); + lblBehavior.setHalign(GtkAlign.START); add(lblBehavior); //Prompt on new session @@ -1591,7 +1591,7 @@ private: Box bNewInstance = new Box(Orientation.HORIZONTAL, 6); Label lblNewInstance = new Label(_("On new instance")); - lblNewInstance.setHalign(Align.END); + lblNewInstance.setHalign(GtkAlign.END); bNewInstance.add(lblNewInstance); ComboBox cbNewInstance = createNameValueCombo([_("New Window"), _("New Session"), _("Split Right"), _("Split Down"), _("Focus Window")], SETTINGS_NEW_INSTANCE_MODE_VALUES); bh.bind(SETTINGS_NEW_INSTANCE_MODE_KEY, cbNewInstance, "active-id", GSettingsBindFlags.DEFAULT); @@ -1601,7 +1601,7 @@ private: // *********** Clipboard Options Label lblClipboard = new Label(format("%s", _("Clipboard"))); lblClipboard.setUseMarkup(true); - lblClipboard.setHalign(Align.START); + lblClipboard.setHalign(GtkAlign.START); add(lblClipboard); //Advacned paste is default @@ -1653,7 +1653,7 @@ private: void createUI() { setAllMargins(this, 18); Grid grid = new Grid(); - grid.setHalign(Align.FILL); + grid.setHalign(GtkAlign.FILL); grid.setColumnSpacing(12); grid.setRowSpacing(6); diff --git a/source/gx/tilix/prefeditor/profileeditor.d b/source/gx/tilix/prefeditor/profileeditor.d index 21d6bbd67..b9ba48384 100644 --- a/source/gx/tilix/prefeditor/profileeditor.d +++ b/source/gx/tilix/prefeditor/profileeditor.d @@ -215,7 +215,7 @@ protected: //Profile Name Label lblName = new Label(_("Profile name")); - lblName.setHalign(Align.END); + lblName.setHalign(GtkAlign.END); grid.attach(lblName, 0, row, 1, 1); Entry eName = new Entry(); // Catch and pass name changes up to preferences dialog @@ -232,14 +232,14 @@ protected: row++; //Profile ID lblId = new Label(""); - // lblId.setHalign(Align.START); + // lblId.setHalign(GtkAlign.START); // lblId.setSensitive(false); // grid.attach(lblId, 1, row, 1, 1); // row++; //Terminal Title Label lblTerminalTitle = new Label(_("Terminal title")); - lblTerminalTitle.setHalign(Align.END); + lblTerminalTitle.setHalign(GtkAlign.END); grid.attach(lblTerminalTitle, 0, row, 1, 1); Entry eTerminalTitle = new Entry(); eTerminalTitle.setHexpand(true); @@ -253,14 +253,14 @@ protected: Label lblTextTitle = new Label(format("%s", _("Text Appearance"))); lblTextTitle.setUseMarkup(true); - lblTextTitle.setHalign(Align.START); + lblTextTitle.setHalign(GtkAlign.START); lblTextTitle.setMarginTop(6); grid.attach(lblTextTitle, 0, row, 2, 1); row++; //Terminal Size Label lblSize = new Label(_("Terminal size")); - lblSize.setHalign(Align.END); + lblSize.setHalign(GtkAlign.END); grid.attach(lblSize, 0, row, 1, 1); SpinButton sbColumn = new SpinButton(16, 511, 1); bh.bind(SETTINGS_PROFILE_SIZE_COLUMNS_KEY, sbColumn, "value", GSettingsBindFlags.DEFAULT); @@ -299,7 +299,7 @@ protected: //Terminal Spacing if (checkVTEVersion(VTE_VERSION_CELL_SCALE)) { Label lblSpacing = new Label(_("Cell spacing")); - lblSpacing.setHalign(Align.END); + lblSpacing.setHalign(GtkAlign.END); grid.attach(lblSpacing, 0, row, 1, 1); SpinButton sbWidthSpacing = new SpinButton(1.0, 2.0, 0.1); bh.bind(SETTINGS_PROFILE_CELL_WIDTH_SCALE_KEY, sbWidthSpacing, "value", GSettingsBindFlags.DEFAULT); @@ -345,7 +345,7 @@ protected: if (isVTEBackgroundDrawEnabled()) { Label lblMargin = new Label(_("Margin")); - lblMargin.setHalign(Align.END); + lblMargin.setHalign(GtkAlign.END); grid.attach(lblMargin, 0, row, 1, 1); SpinButton sbMargin = new SpinButton(0.0, 256.0, 4); bh.bind(SETTINGS_PROFILE_MARGIN_KEY, sbMargin, "value", GSettingsBindFlags.DEFAULT); @@ -356,7 +356,7 @@ protected: if (checkVTEVersion(VTE_VERSION_TEXT_BLINK_MODE)) { //Text Blink Mode Label lblTextBlinkMode = new Label(_("Text blink mode")); - lblTextBlinkMode.setHalign(Align.END); + lblTextBlinkMode.setHalign(GtkAlign.END); grid.attach(lblTextBlinkMode, 0, row, 1, 1); ComboBox cbTextBlinkMode = createNameValueCombo([_("Never"), _("Focused"), _("Unfocused"), _("Always")], SETTINGS_PROFILE_TEXT_BLINK_MODE_VALUES); bh.bind(SETTINGS_PROFILE_TEXT_BLINK_MODE_KEY, cbTextBlinkMode, "active-id", GSettingsBindFlags.DEFAULT); @@ -378,7 +378,7 @@ protected: //Custom Font Label lblCustomFont = new Label(_("Custom font")); - lblCustomFont.setHalign(Align.END); + lblCustomFont.setHalign(GtkAlign.END); grid.attach(lblCustomFont, 0, row, 1, 1); @@ -399,7 +399,7 @@ protected: //Select-by-word-chars Label lblSelectByWordChars = new Label(_("Word-wise select chars")); - lblSelectByWordChars.setHalign(Align.END); + lblSelectByWordChars.setHalign(GtkAlign.END); grid.attach(lblSelectByWordChars, 0, row, 1, 1); Entry eSelectByWordChars = new Entry(); bh.bind(SETTINGS_PROFILE_WORD_WISE_SELECT_CHARS_KEY, eSelectByWordChars, "text", GSettingsBindFlags.DEFAULT); @@ -408,14 +408,14 @@ protected: Label lblCursorTitle = new Label(format("%s", _("Cursor"))); lblCursorTitle.setUseMarkup(true); - lblCursorTitle.setHalign(Align.START); + lblCursorTitle.setHalign(GtkAlign.START); lblCursorTitle.setMarginTop(6); grid.attach(lblCursorTitle, 0, row, 2, 1); row++; //Cursor Shape Label lblCursorShape = new Label(_("Cursor")); - lblCursorShape.setHalign(Align.END); + lblCursorShape.setHalign(GtkAlign.END); grid.attach(lblCursorShape, 0, row, 1, 1); ComboBox cbCursorShape = createNameValueCombo([_("Block"), _("IBeam"), _("Underline")], [SETTINGS_PROFILE_CURSOR_SHAPE_BLOCK_VALUE, SETTINGS_PROFILE_CURSOR_SHAPE_IBEAM_VALUE, SETTINGS_PROFILE_CURSOR_SHAPE_UNDERLINE_VALUE]); @@ -426,7 +426,7 @@ protected: //Cursor Blink Mode Label lblCursorBlinkMode = new Label(_("Cursor blink mode")); - lblCursorBlinkMode.setHalign(Align.END); + lblCursorBlinkMode.setHalign(GtkAlign.END); grid.attach(lblCursorBlinkMode, 0, row, 1, 1); ComboBox cbCursorBlinkMode = createNameValueCombo([_("System"), _("On"), _("Off")], SETTINGS_PROFILE_CURSOR_BLINK_MODE_VALUES); bh.bind(SETTINGS_PROFILE_CURSOR_BLINK_MODE_KEY, cbCursorBlinkMode, "active-id", GSettingsBindFlags.DEFAULT); @@ -436,13 +436,13 @@ protected: Label lblNotifyTitle = new Label(format("%s", _("Notification"))); lblNotifyTitle.setMarginTop(6); lblNotifyTitle.setUseMarkup(true); - lblNotifyTitle.setHalign(Align.START); + lblNotifyTitle.setHalign(GtkAlign.START); grid.attach(lblNotifyTitle, 0, row, 2, 1); row++; //Terminal Bell Label lblBell = new Label(_("Terminal bell")); - lblBell.setHalign(Align.END); + lblBell.setHalign(GtkAlign.END); grid.attach(lblBell, 0, row, 1, 1); ComboBox cbBell = createNameValueCombo([_("None"), _("Sound"), _("Icon"), _("Icon and sound")], SETTINGS_PROFILE_TERMINAL_BELL_VALUES); bh.bind(SETTINGS_PROFILE_TERMINAL_BELL_KEY, cbBell, "active-id", GSettingsBindFlags.DEFAULT); @@ -512,7 +512,7 @@ private: int row = 0; Label lblScheme = new Label(format("%s", _("Color scheme"))); lblScheme.setUseMarkup(true); - lblScheme.setHalign(Align.END); + lblScheme.setHalign(GtkAlign.END); grid.attach(lblScheme, 0, row, 1, 1); cbScheme = new ComboBoxText(false); @@ -521,7 +521,7 @@ private: cbScheme.append(scheme.id, scheme.name); } cbScheme.append("custom", _("Custom")); - cbScheme.setHalign(Align.FILL); + cbScheme.setHalign(GtkAlign.FILL); cbScheme.setHexpand(true); schemeOnChangedHandle = cbScheme.addOnChanged(delegate(ComboBoxText cb) { if (cb.getActive >= 0) { @@ -537,7 +537,7 @@ private: btnExport.addOnClicked(&exportColorScheme); Box bScheme = new Box(Orientation.HORIZONTAL, 6); - bScheme.setHalign(Align.FILL); + bScheme.setHalign(GtkAlign.FILL); bScheme.setHexpand(true); bScheme.add(cbScheme); bScheme.add(btnExport); @@ -547,16 +547,16 @@ private: Label lblPalette = new Label(format("%s", _("Color palette"))); lblPalette.setUseMarkup(true); - lblPalette.setHalign(Align.END); - lblPalette.setValign(Align.START); + lblPalette.setHalign(GtkAlign.END); + lblPalette.setValign(GtkAlign.START); grid.attach(lblPalette, 0, row, 1, 1); grid.attach(createColorGrid(row), 1, row, 1, 1); row++; Label lblOptions = new Label(format("%s", _("Options"))); lblOptions.setUseMarkup(true); - lblOptions.setValign(Align.START); - lblOptions.setHalign(Align.END); + lblOptions.setValign(GtkAlign.START); + lblOptions.setHalign(GtkAlign.END); grid.attach(lblOptions, 0, row, 1, 1); grid.attach(createOptions(), 1, row, 1, 1); row++; @@ -590,28 +590,28 @@ private: GSettings gsSettings = new GSettings(SETTINGS_ID); if (gsSettings.getBoolean(SETTINGS_ENABLE_TRANSPARENCY_KEY)) { Label lblTransparent = new Label(_("Transparency")); - lblTransparent.setHalign(Align.END); + lblTransparent.setHalign(GtkAlign.END); lblTransparent.setHexpand(false); gSliders.attach(lblTransparent, 0, row, 1, 1); Scale sTransparent = new Scale(Orientation.HORIZONTAL, 0, 100, 10); sTransparent.setDrawValue(false); sTransparent.setHexpand(true); - sTransparent.setHalign(Align.FILL); + sTransparent.setHalign(GtkAlign.FILL); bh.bind(SETTINGS_PROFILE_BG_TRANSPARENCY_KEY, sTransparent.getAdjustment(), "value", GSettingsBindFlags.DEFAULT); gSliders.attach(sTransparent, 1, row, 1, 1); row++; } Label lblDim = new Label(_("Unfocused dim")); - lblDim.setHalign(Align.END); + lblDim.setHalign(GtkAlign.END); lblDim.setHexpand(false); gSliders.attach(lblDim, 0, row, 1, 1); Scale sDim = new Scale(Orientation.HORIZONTAL, 0, 100, 10); sDim.setDrawValue(false); sDim.setHexpand(true); - sDim.setHalign(Align.FILL); + sDim.setHalign(GtkAlign.FILL); bh.bind(SETTINGS_PROFILE_DIM_TRANSPARENCY_KEY, sDim.getAdjustment(), "value", GSettingsBindFlags.DEFAULT); gSliders.attach(sDim, 1, row, 1, 1); @@ -631,7 +631,7 @@ private: bh.bind(sensitiveKey, result, "sensitive", GSettingsBindFlags.GET | GSettingsBindFlags.NO_SENSITIVITY); } result.setTitle(title); - result.setHalign(Align.START); + result.setHalign(GtkAlign.START); result.addOnColorSet(delegate(ColorButton cb) { if (!blockColorUpdates) { setCustomScheme(); @@ -1067,7 +1067,7 @@ private: int row = 0; Label lblBackspace = new Label(_("Backspace key generates")); - lblBackspace.setHalign(Align.END); + lblBackspace.setHalign(GtkAlign.END); grid.attach(lblBackspace, 0, row, 1, 1); ComboBox cbBackspace = createNameValueCombo([_("Automatic"), _("Control-H"), _("ASCII DEL"), _("Escape sequence"), _("TTY")], SETTINGS_PROFILE_ERASE_BINDING_VALUES); bh.bind(SETTINGS_PROFILE_BACKSPACE_BINDING_KEY, cbBackspace, "active-id", GSettingsBindFlags.DEFAULT); @@ -1076,7 +1076,7 @@ private: row++; Label lblDelete = new Label(_("Delete key generates")); - lblDelete.setHalign(Align.END); + lblDelete.setHalign(GtkAlign.END); grid.attach(lblDelete, 0, row, 1, 1); ComboBox cbDelete = createNameValueCombo([_("Automatic"), _("Control-H"), _("ASCII DEL"), _("Escape sequence"), _("TTY")], SETTINGS_PROFILE_ERASE_BINDING_VALUES); bh.bind(SETTINGS_PROFILE_DELETE_BINDING_KEY, cbDelete, "active-id", GSettingsBindFlags.DEFAULT); @@ -1085,7 +1085,7 @@ private: row++; Label lblEncoding = new Label(_("Encoding")); - lblEncoding.setHalign(Align.END); + lblEncoding.setHalign(GtkAlign.END); grid.attach(lblEncoding, 0, row, 1, 1); string[] key, value; key.length = encodings.length; @@ -1100,7 +1100,7 @@ private: row++; Label lblCJK = new Label(_("Ambiguous-width characters")); - lblCJK.setHalign(Align.END); + lblCJK.setHalign(GtkAlign.END); grid.attach(lblCJK, 0, row, 1, 1); ComboBox cbCJK = createNameValueCombo([_("Narrow"), _("Wide")], SETTINGS_PROFILE_CJK_WIDTH_VALUES); bh.bind(SETTINGS_PROFILE_CJK_WIDTH_KEY, cbCJK, "active-id", GSettingsBindFlags.DEFAULT); @@ -1173,7 +1173,7 @@ class BadgePage: ProfilePage { //Badge text Label lblBadge = new Label(_("Badge")); - lblBadge.setHalign(Align.END); + lblBadge.setHalign(GtkAlign.END); grid.attach(lblBadge, 0, row, 1, 1); Entry eBadge = new Entry(); eBadge.setHexpand(true); @@ -1187,7 +1187,7 @@ class BadgePage: ProfilePage { //Badge Position Label lblBadgePosition = new Label(_("Badge position")); - lblBadgePosition.setHalign(Align.END); + lblBadgePosition.setHalign(GtkAlign.END); grid.attach(lblBadgePosition, 0, row, 1, 1); ComboBox cbBadgePosition = createNameValueCombo([_("Northwest"), _("Northeast"), _("Southwest"), _("Southeast")], SETTINGS_QUADRANT_VALUES); @@ -1197,7 +1197,7 @@ class BadgePage: ProfilePage { //Custom Font Label lblCustomFont = new Label(_("Custom font")); - lblCustomFont.setHalign(Align.END); + lblCustomFont.setHalign(GtkAlign.END); grid.attach(lblCustomFont, 0, row, 1, 1); @@ -1248,7 +1248,7 @@ private: //Notify silence threshold Label lblSilenceTitle = new Label(format("%s", _("Notify New Activity"))); lblSilenceTitle.setUseMarkup(true); - lblSilenceTitle.setHalign(Align.START); + lblSilenceTitle.setHalign(GtkAlign.START); lblSilenceTitle.setMarginTop(12); grid.attach(lblSilenceTitle, 0, row, 3, 1); row++; @@ -1268,7 +1268,7 @@ private: // Profile Switching Label lblProfileSwitching = new Label(format("%s", _("Automatic Profile Switching"))); lblProfileSwitching.setUseMarkup(true); - lblProfileSwitching.setHalign(Align.START); + lblProfileSwitching.setHalign(GtkAlign.START); lblProfileSwitching.setMarginTop(12); grid.attach(lblProfileSwitching, 0, row, 3, 1); row++; @@ -1361,7 +1361,7 @@ private: uint row = 0; Label lblSilence = new Label(_("Enable by default")); - lblSilence.setHalign(Align.END); + lblSilence.setHalign(GtkAlign.END); grid.attach(lblSilence, 0, row, 1, 1); CheckButton cbSilence = new CheckButton(); @@ -1370,7 +1370,7 @@ private: row++; Label lblSilenceDesc = new Label(_("Threshold for continuous silence")); - lblSilenceDesc.setHalign(Align.END); + lblSilenceDesc.setHalign(GtkAlign.END); grid.attach(lblSilenceDesc, 0, row, 1, 1); Box bSilence = new Box(Orientation.HORIZONTAL, 4); diff --git a/source/gx/tilix/session.d b/source/gx/tilix/session.d index 840c0a94c..93a4a127b 100644 --- a/source/gx/tilix/session.d +++ b/source/gx/tilix/session.d @@ -1571,7 +1571,7 @@ private: Label label = new Label(format("%s", _("Name"))); label.setUseMarkup(true); - label.setHalign(Align.END); + label.setHalign(GtkAlign.END); grid.attach(label, 0, 0, 1, 1); eName = new Entry(); @@ -1582,7 +1582,7 @@ private: label = new Label(format("%s", _("Profile"))); label.setUseMarkup(true); - label.setHalign(Align.END); + label.setHalign(GtkAlign.END); grid.attach(label, 0, 1, 1, 1); ProfileInfo[] profiles = prfMgr.getProfiles(); diff --git a/source/gx/tilix/sidebar.d b/source/gx/tilix/sidebar.d index 5b14b9eb8..2330f5ac0 100644 --- a/source/gx/tilix/sidebar.d +++ b/source/gx/tilix/sidebar.d @@ -276,10 +276,10 @@ private: void setSidebarPosition() { if (gsSettings.getBoolean(SETTINGS_SIDEBAR_RIGHT)) { setTransitionType(RevealerTransitionType.SLIDE_LEFT); - setHalign(Align.END); + setHalign(GtkAlign.END); } else { setTransitionType(RevealerTransitionType.SLIDE_RIGHT); - setHalign(Align.START); + setHalign(GtkAlign.START); } } @@ -300,7 +300,7 @@ public: setHexpand(false); setVexpand(true); - setValign(Align.FILL); + setValign(GtkAlign.FILL); setSidebarPosition(); lbSessions = new ListBox(); @@ -524,7 +524,7 @@ private: lblName.setMarginLeft(2); lblName.setMarginRight(2); lblName.setEllipsize(PangoEllipsizeMode.END); - lblName.setHalign(Align.CENTER); + lblName.setHalign(GtkAlign.CENTER); lblName.setHexpand(true); lblName.setSensitive(false); lblName.getStyleContext().addClass("tilix-session-name"); @@ -534,7 +534,7 @@ private: grid.attach(b, 1, 2, 1, 1); lblIndex = new Label(format("%d", 0)); - lblIndex.setValign(Align.END); + lblIndex.setValign(GtkAlign.END); lblIndex.setVexpand(false); setAllMargins(lblIndex, 4); lblIndex.setWidthChars(2); diff --git a/source/gx/tilix/terminal/advpaste.d b/source/gx/tilix/terminal/advpaste.d index 77ddccada..e111bf114 100644 --- a/source/gx/tilix/terminal/advpaste.d +++ b/source/gx/tilix/terminal/advpaste.d @@ -95,7 +95,7 @@ private: Label lblTransform = new Label(format("%s", _("Transform"))); lblTransform.setUseMarkup(true); - lblTransform.setHalign(Align.START); + lblTransform.setHalign(GtkAlign.START); lblTransform.setMarginTop(6); b.add(lblTransform); diff --git a/source/gx/tilix/terminal/layout.d b/source/gx/tilix/terminal/layout.d index b575ee1c1..65358adc3 100644 --- a/source/gx/tilix/terminal/layout.d +++ b/source/gx/tilix/terminal/layout.d @@ -47,12 +47,12 @@ public: Label lblActive = new Label(format("%s", _("Active"))); lblActive.setUseMarkup(true); - lblActive.setHalign(Align.START); + lblActive.setHalign(GtkAlign.START); grid.attach(lblActive, 0, row, 2, 1); row++; Label lblTitle = new Label(_("Title")); - lblTitle.setHalign(Align.END); + lblTitle.setHalign(GtkAlign.END); grid.attach(lblTitle, 0, row, 1, 1); eTitle = new Entry(); eTitle.setWidthChars(20); @@ -66,7 +66,7 @@ public: if (checkVTEFeature(TerminalFeature.DISABLE_BACKGROUND_DRAW)) { Label lblBadge = new Label(_("Badge")); - lblBadge.setHalign(Align.END); + lblBadge.setHalign(GtkAlign.END); grid.attach(lblBadge, 0, row, 1, 1); eBadge = new Entry(); eBadge.setHexpand(true); @@ -81,13 +81,13 @@ public: Label lblLoad = new Label(format("%s", _("Session Load"))); lblLoad.setUseMarkup(true); - lblLoad.setHalign(Align.START); + lblLoad.setHalign(GtkAlign.START); lblLoad.setMarginTop(6); grid.attach(lblLoad, 0, row, 2, 1); row++; Label lblCommand = new Label(_("Command")); - lblCommand.setHalign(Align.END); + lblCommand.setHalign(GtkAlign.END); grid.attach(lblCommand, 0, row, 1, 1); eCommand = new Entry(); diff --git a/source/gx/tilix/terminal/password.d b/source/gx/tilix/terminal/password.d index 42bb9d15a..9dc2bca47 100644 --- a/source/gx/tilix/terminal/password.d +++ b/source/gx/tilix/terminal/password.d @@ -429,7 +429,7 @@ private: int row = 0; // Name (i.e. Label in libsecret parlance) lblName = new Label(_("Name")); - lblName.setHalign(Align.END); + lblName.setHalign(GtkAlign.END); grid.attach(lblName, 0, row, 1, 1); eLabel = new Entry(); eLabel.setWidthChars(40); @@ -439,7 +439,7 @@ private: //Password lblPassword = new Label(_("Password")); - lblPassword.setHalign(Align.END); + lblPassword.setHalign(GtkAlign.END); grid.attach(lblPassword, 0, row, 1, 1); ePassword = new Entry(); ePassword.setVisibility(false); @@ -449,7 +449,7 @@ private: //Confirm Password lblRepeatPwd = new Label(_("Confirm Password")); - lblRepeatPwd.setHalign(Align.END); + lblRepeatPwd.setHalign(GtkAlign.END); grid.attach(lblRepeatPwd, 0, row, 1, 1); eConfirmPassword = new Entry(); eConfirmPassword.setVisibility(false); @@ -460,7 +460,7 @@ private: lblMatch = new Label("Password does not match confirmation"); lblMatch.setSensitive(false); lblMatch.setNoShowAll(true); - lblMatch.setHalign(Align.CENTER); + lblMatch.setHalign(GtkAlign.CENTER); grid.attach(lblMatch, 1, row, 1, 1); with (getContentArea()) { diff --git a/source/gx/tilix/terminal/search.d b/source/gx/tilix/terminal/search.d index 32702427a..132263157 100644 --- a/source/gx/tilix/terminal/search.d +++ b/source/gx/tilix/terminal/search.d @@ -79,11 +79,11 @@ private: setHexpand(true); setVexpand(false); - setHalign(Align.FILL); - setValign(Align.START); + setHalign(GtkAlign.FILL); + setValign(GtkAlign.START); Box bSearch = new Box(Orientation.HORIZONTAL, 6); - bSearch.setHalign(Align.CENTER); + bSearch.setHalign(GtkAlign.CENTER); bSearch.setMarginLeft(4); bSearch.setMarginRight(4); bSearch.setMarginTop(4); diff --git a/source/gx/tilix/terminal/terminal.d b/source/gx/tilix/terminal/terminal.d index afafb28c8..3d5f28266 100644 --- a/source/gx/tilix/terminal/terminal.d +++ b/source/gx/tilix/terminal/terminal.d @@ -4284,9 +4284,9 @@ public: super([_("Relaunch")], [ResponseType.OK]); lblPrompt = new Label(""); getContentArea().packStart(lblPrompt, true, true, 0); - lblPrompt.setHalign(Align.START); - setHalign(Align.FILL); - setValign(Align.START); + lblPrompt.setHalign(GtkAlign.START); + setHalign(GtkAlign.FILL); + setValign(GtkAlign.START); trace("Infobar created"); addOnMap(delegate(Widget) { setDefaultResponse(ResponseType.OK); @@ -4332,7 +4332,7 @@ public: Label lblCmd = new Label(SimpleXML.markupEscapeText(cmd, cmd.length)); lblCmd.setUseMarkup(true); - lblCmd.setHalign(Align.START); + lblCmd.setHalign(GtkAlign.START); lblCmd.setEllipsize(PangoEllipsizeMode.END); if (count(cmd,"\n") > 6) { From 70781c8c4d6e9d41fe9c18b27e21b794beb696c9 Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Wed, 1 Jan 2025 22:46:24 +0900 Subject: [PATCH 3/3] Use "vte.Terminal.pasteText" to send pasted text --- source/gx/tilix/terminal/terminal.d | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/source/gx/tilix/terminal/terminal.d b/source/gx/tilix/terminal/terminal.d index 3d5f28266..8f8db71ed 100644 --- a/source/gx/tilix/terminal/terminal.d +++ b/source/gx/tilix/terminal/terminal.d @@ -1447,7 +1447,7 @@ private: dialog.showAll(); if (dialog.run() == ResponseType.APPLY) { pasteText = dialog.text; - this.pasteText(pasteText[0 .. $]); + vte.pasteText(pasteText[0 .. $]); if (gsProfile.getBoolean(SETTINGS_PROFILE_SCROLL_ON_INPUT_KEY)) { scrollToBottom(); } @@ -1488,9 +1488,9 @@ private: if (gsSettings.getBoolean(SETTINGS_STRIP_FIRST_COMMENT_CHAR_ON_PASTE_KEY) && pasteText.length > 0 && (pasteText[0] == '#' || pasteText[0] == '$')) { pasteText = pasteText[1 .. $]; - this.pasteText(pasteText); + vte.pasteText(pasteText); } else if (stripTrailingWhitespace) { - this.pasteText(pasteText); + vte.pasteText(pasteText); } else if (source == GDK_SELECTION_CLIPBOARD) { vte.pasteClipboard(); } else { @@ -2633,17 +2633,6 @@ private: } } - void pasteText(string text) { - // It is better to use vte.pasteText(text), but a GtkD version that - // contains vte.pasteText(text) has not yet been released. The current - // lateset version GtkD 3.10.0 does not have this interface. We - // instead need to manually convert the newlines or implement the - // bracketed paste mode. We use the simple newline conversion here. - // When the next version of GtkD is released, the following line should - // be replaced with "vte.pasteText(text);". - vte.feedChild(text.replace("\n", "\r")); - } - void showInfoBarMessage(string message) { TerminalInfoBar ibRelaunch = new TerminalInfoBar(); ibRelaunch.addOnResponse(delegate(int response, InfoBar ib) {