return to start a new text line

`Shift + Return` was not compatible with the ibusCandidatePopup.

So the only way to "validate" a text element is to click outside the text area.

Related to #56.
This commit is contained in:
abakkk 2021-02-17 12:00:23 +01:00
parent 5698f3f7cb
commit 3223a6fdca
1 changed files with 2 additions and 6 deletions

View File

@ -808,7 +808,7 @@ var DrawingArea = new Lang.Class({
this.currentElement.cursorPosition = 0; this.currentElement.cursorPosition = 0;
// Translators: %s is a key label // Translators: %s is a key label
this.emit('show-osd', Files.Icons.TOOL_TEXT, _("Press <i>%s</i>\nto start a new line") this.emit('show-osd', Files.Icons.TOOL_TEXT, _("Press <i>%s</i>\nto start a new line")
.format(Gtk.accelerator_get_label(Clutter.KEY_Return, 1)), "", -1, true); .format(Gtk.accelerator_get_label(Clutter.KEY_Return, 0)), "", -1, true);
this._updateTextCursorTimeout(); this._updateTextCursorTimeout();
this.textHasCursor = true; this.textHasCursor = true;
this._redisplay(); this._redisplay();
@ -835,6 +835,7 @@ var DrawingArea = new Lang.Class({
} }
this.textEntry.clutterText.set_single_line_mode(false); this.textEntry.clutterText.set_single_line_mode(false);
this.textEntry.clutterText.set_activatable(false);
this.textEntry.clutterText.connect('activate', (clutterText) => { this.textEntry.clutterText.connect('activate', (clutterText) => {
this._stopWriting(); this._stopWriting();
}); });
@ -861,11 +862,6 @@ var DrawingArea = new Lang.Class({
this.currentElement.text = ""; this.currentElement.text = "";
this._stopWriting(); this._stopWriting();
return Clutter.EVENT_STOP; return Clutter.EVENT_STOP;
} else if (event.has_shift_modifier() &&
(event.get_key_symbol() == Clutter.KEY_Return ||
event.get_key_symbol() == Clutter.KEY_KP_Enter)) {
clutterText.insert_unichar('\n');
return Clutter.EVENT_STOP;
} }
return Clutter.EVENT_PROPAGATE; return Clutter.EVENT_PROPAGATE;