Fix DebugConsole up/down with word-wrapped lines
Fix these issues: - When the cursor was on the last soft-line of a word-wrapped line, pressing down wouldn't go to the next history entry - When the cursor was after the first soft-line of a word-wrapped line and that line was the first of the text area, pressing up would go to the previous history entry instead of moving the cursor to the first soft-line
This commit is contained in:
parent
8d4e67d6a4
commit
8db275ab37
@ -286,9 +286,6 @@ HDrawer {
|
|||||||
HTextArea {
|
HTextArea {
|
||||||
id: inputArea
|
id: inputArea
|
||||||
|
|
||||||
readonly property int cursorY:
|
|
||||||
text.substring(0, cursorPosition).split("\n").length - 1
|
|
||||||
|
|
||||||
function accept() {
|
function accept() {
|
||||||
if (! text) return
|
if (! text) return
|
||||||
runJS(text)
|
runJS(text)
|
||||||
@ -304,7 +301,8 @@ HDrawer {
|
|||||||
|
|
||||||
Keys.onUpPressed: ev => {
|
Keys.onUpPressed: ev => {
|
||||||
ev.accepted =
|
ev.accepted =
|
||||||
cursorY === 0 && historyEntry + 1 < history.length
|
cursorRectangle.top < topPadding + font.pixelSize &&
|
||||||
|
historyEntry + 1 < history.length
|
||||||
|
|
||||||
if (ev.accepted) {
|
if (ev.accepted) {
|
||||||
historyEntry += 1
|
historyEntry += 1
|
||||||
@ -314,7 +312,9 @@ HDrawer {
|
|||||||
|
|
||||||
Keys.onDownPressed: ev => {
|
Keys.onDownPressed: ev => {
|
||||||
ev.accepted =
|
ev.accepted =
|
||||||
cursorY === lineCount - 1 && historyEntry - 1 >= -1
|
cursorRectangle.bottom >=
|
||||||
|
height - bottomPadding - font.pixelSize &&
|
||||||
|
historyEntry - 1 >= -1
|
||||||
|
|
||||||
if (ev.accepted) historyEntry -= 1
|
if (ev.accepted) historyEntry -= 1
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user