-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert CTRL+Backspace to CTRL+? #2231
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,17 @@ | |
<value nick='tty' value='4'/> | ||
</enum> | ||
|
||
<enum id='com.gexperts.Tilix.EraseControl'> | ||
<value nick='none' value='0'/> | ||
<value nick='control-h' value='1'/> | ||
<value nick='control-w' value='2'/> | ||
<value nick='control-?' value='3'/> | ||
<value nick='ascii-backspace' value='4'/> | ||
<value nick='ascii-delete' value='5'/> | ||
<value nick='delete-sequence' value='6'/> | ||
<value nick='tty' value='7'/> | ||
</enum> | ||
|
||
<enum id='com.gexperts.Tilix.ExitAction'> | ||
<value nick='close' value='0'/> | ||
<value nick='restart' value='1'/> | ||
|
@@ -749,6 +760,10 @@ | |
<default>'narrow'</default> | ||
<summary>Whether ambiguous-width characters are narrow or wide when using UTF-8 encoding</summary> | ||
</key> | ||
<key name="ctrl-backspace" enum="com.gexperts.Tilix.EraseControl"> | ||
<default>'none'</default> | ||
<summary>Makes the terminal threat "Control+Backspace" as different control instead of "Backspace". May be used as a shortcut for removing deleting a word instead of a character.</summary> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "threat" should be a typo of "treat". "removing deleting" should also be a typo. |
||
</key> | ||
<!-- Terminal Title --> | ||
<key name="terminal-title" type="s"> | ||
<default>'${id}: ${title}'</default> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1044,6 +1044,34 @@ private: | |
vteHandlers ~= vte.addOnKeyPress(delegate(Event event, Widget widget) { | ||
if (vte is null) return false; | ||
|
||
// If control-backspace is registered, convert it to control-*, which is | ||
// used interchangeably in some terminal emulators, | ||
// often for removing a word instead of a character. | ||
if (gsProfile.getString(SETTINGS_PROFILE_CTRL_BACKSPACE_KEY) != SETTINGS_PROFILE_CTRL_BACKSPACE_VALUES[0] && (event.key.keyval == GdkKeysyms.GDK_BackSpace) && (event.key.state & ModifierType.CONTROL_MASK)) { | ||
switch (gsProfile.getString(SETTINGS_PROFILE_CTRL_BACKSPACE_KEY)) { | ||
case SETTINGS_PROFILE_CTRL_BACKSPACE_VALUES[1]: // ^w | ||
vte.feedChild("\u0017"); | ||
return true; | ||
case SETTINGS_PROFILE_CTRL_BACKSPACE_VALUES[2]: // ^h | ||
vte.feedChild("\u0008"); | ||
return true; | ||
case SETTINGS_PROFILE_CTRL_BACKSPACE_VALUES[3]: // ^? | ||
vte.feedChild("\u001F"); | ||
Comment on lines
+1058
to
+1059
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
edit: I think I knew a terminal that sends |
||
return true; | ||
case SETTINGS_PROFILE_CTRL_BACKSPACE_VALUES[4]: // DEL | ||
vte.feedChild("\u0007"); | ||
Comment on lines
+1061
to
+1062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return true; | ||
case SETTINGS_PROFILE_CTRL_BACKSPACE_VALUES[5]: // ESC [ 3 ~ | ||
vte.feedChild("\u001B\u005B\u0033\u007E"); | ||
return true; | ||
case SETTINGS_PROFILE_CTRL_BACKSPACE_VALUES[6]: // DEL | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There seems to be some mismatching. |
||
vte.feedChild("\u007F"); | ||
return true; | ||
default: | ||
break; | ||
} | ||
} | ||
|
||
if (event.key.keyval == GdkKeysyms.GDK_Return && checkVTEFeature(TerminalFeature.EVENT_SCREEN_CHANGED) && currentScreen == TerminalScreen.NORMAL) { | ||
glong row, column; | ||
vte.getCursorPosition(column, row); | ||
|
@@ -2491,6 +2519,7 @@ private: | |
SETTINGS_PROFILE_BACKSPACE_BINDING_KEY, | ||
SETTINGS_PROFILE_DELETE_BINDING_KEY, | ||
SETTINGS_PROFILE_CJK_WIDTH_KEY, SETTINGS_PROFILE_ENCODING_KEY, SETTINGS_PROFILE_CURSOR_BLINK_MODE_KEY, //Only pass the one font key, will handle both cases | ||
SETTINGS_PROFILE_CTRL_BACKSPACE_KEY, | ||
SETTINGS_PROFILE_FONT_KEY, | ||
SETTINGS_TERMINAL_TITLE_STYLE_KEY, SETTINGS_AUTO_HIDE_MOUSE_KEY, | ||
SETTINGS_PROFILE_USE_CURSOR_COLOR_KEY, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"tty" doesn't seem to be handled anywhere.