mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
@@ -847,6 +847,34 @@ Item {
|
|||||||
cursorPosition = pos;
|
cursorPosition = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteToLineStart() {
|
||||||
|
clampCursorPosition();
|
||||||
|
if (cursorPosition === 0)
|
||||||
|
return;
|
||||||
|
root.passwordEdited(text.slice(cursorPosition));
|
||||||
|
cursorPosition = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteToLineEnd() {
|
||||||
|
clampCursorPosition();
|
||||||
|
if (cursorPosition === text.length)
|
||||||
|
return;
|
||||||
|
root.passwordEdited(text.slice(0, cursorPosition));
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteWordBackward() {
|
||||||
|
clampCursorPosition();
|
||||||
|
if (cursorPosition === 0)
|
||||||
|
return;
|
||||||
|
let pos = cursorPosition;
|
||||||
|
while (pos > 0 && text.charAt(pos - 1) === " ")
|
||||||
|
pos--;
|
||||||
|
while (pos > 0 && text.charAt(pos - 1) !== " ")
|
||||||
|
pos--;
|
||||||
|
root.passwordEdited(text.slice(0, pos) + text.slice(cursorPosition));
|
||||||
|
cursorPosition = pos;
|
||||||
|
}
|
||||||
|
|
||||||
function isPrintableText(value) {
|
function isPrintableText(value) {
|
||||||
if (value.length === 0)
|
if (value.length === 0)
|
||||||
return false;
|
return false;
|
||||||
@@ -912,6 +940,49 @@ Item {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((event.modifiers & Qt.ControlModifier) && !(event.modifiers & (Qt.AltModifier | Qt.MetaModifier))) {
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_A:
|
||||||
|
cursorPosition = 0;
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_E:
|
||||||
|
cursorPosition = text.length;
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_B:
|
||||||
|
clampCursorPosition();
|
||||||
|
cursorPosition = Math.max(0, cursorPosition - 1);
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_F:
|
||||||
|
clampCursorPosition();
|
||||||
|
cursorPosition = Math.min(text.length, cursorPosition + 1);
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_U:
|
||||||
|
deleteToLineStart();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_K:
|
||||||
|
deleteToLineEnd();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_W:
|
||||||
|
deleteWordBackward();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_H:
|
||||||
|
backspace();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_D:
|
||||||
|
deleteForward();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case Qt.Key_Return:
|
case Qt.Key_Return:
|
||||||
case Qt.Key_Enter:
|
case Qt.Key_Enter:
|
||||||
|
|||||||
Reference in New Issue
Block a user