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:
		@@ -286,9 +286,6 @@ HDrawer {
 | 
			
		||||
        HTextArea {
 | 
			
		||||
            id: inputArea
 | 
			
		||||
 | 
			
		||||
            readonly property int cursorY:
 | 
			
		||||
                text.substring(0, cursorPosition).split("\n").length - 1
 | 
			
		||||
 | 
			
		||||
            function accept() {
 | 
			
		||||
                if (! text) return
 | 
			
		||||
                runJS(text)
 | 
			
		||||
@@ -304,7 +301,8 @@ HDrawer {
 | 
			
		||||
 | 
			
		||||
            Keys.onUpPressed: ev => {
 | 
			
		||||
                ev.accepted =
 | 
			
		||||
                    cursorY === 0 && historyEntry + 1 < history.length
 | 
			
		||||
                    cursorRectangle.top < topPadding + font.pixelSize &&
 | 
			
		||||
                    historyEntry + 1 < history.length
 | 
			
		||||
 | 
			
		||||
                if (ev.accepted) {
 | 
			
		||||
                    historyEntry   += 1
 | 
			
		||||
@@ -314,7 +312,9 @@ HDrawer {
 | 
			
		||||
 | 
			
		||||
            Keys.onDownPressed: ev => {
 | 
			
		||||
                ev.accepted =
 | 
			
		||||
                    cursorY === lineCount - 1 && historyEntry - 1 >= -1
 | 
			
		||||
                    cursorRectangle.bottom >=
 | 
			
		||||
                    height - bottomPadding - font.pixelSize &&
 | 
			
		||||
                    historyEntry - 1 >= -1
 | 
			
		||||
 | 
			
		||||
                if (ev.accepted) historyEntry -= 1
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user