683 | function TextInputElement:draw() |
684 | -- call ancestor drawing functions with empty text: |
685 | local text = self.text |
686 | self.text = "" |
687 | TextInputElement:superClass().draw(self) |
688 | self.text = text |
689 | |
690 | setTextAlignment(self.textAlignment) |
691 | local neededWidth = self:getNeededTextWidth() |
692 | |
693 | local textXPos = self.absPosition[1] + self.textOffset[1] |
694 | if self.textAlignment == RenderText.ALIGN_CENTER then |
695 | textXPos = textXPos + (self.maxInputTextWidth * 0.5) - (neededWidth * 0.5) |
696 | elseif self.textAlignment == RenderText.ALIGN_RIGHT then |
697 | textXPos = textXPos + self.maxInputTextWidth - neededWidth |
698 | end |
699 | textXPos = textXPos + (self.size[1]-self.maxInputTextWidth) / 2 |
700 | |
701 | local _, yOffset = self:getTextOffset() |
702 | local _, yPos = self:getTextPosition(self.text) |
703 | local textYPos = yPos + yOffset |
704 | |
705 | local displacementX = 0 |
706 | if (self.areFrontDotsVisible) then |
707 | local additionalDisplacement = self:drawTextPart(self.frontDotsText, textXPos, displacementX, textYPos) |
708 | displacementX = displacementX + additionalDisplacement |
709 | end |
710 | if (self.isVisibleTextPart1Visible) then |
711 | local additionalDisplacement = self:drawTextPart(self.visibleTextPart1, textXPos, displacementX, textYPos) |
712 | displacementX = displacementX + additionalDisplacement |
713 | end |
714 | if (self.isCursorVisible) then |
715 | local additionalDisplacement = self:drawCursor(textXPos, displacementX, textYPos) |
716 | displacementX = displacementX + additionalDisplacement |
717 | end |
718 | if (self.isVisibleTextPart2Visible) then |
719 | local additionalDisplacement = self:drawTextPart(self.visibleTextPart2, textXPos, displacementX, textYPos) |
720 | displacementX = displacementX + additionalDisplacement |
721 | end |
722 | |
723 | if (self.areBackDotsVisible) then |
724 | local additionalDisplacement = self:drawTextPart(self.backDotsText, textXPos, displacementX, textYPos) |
725 | displacementX = displacementX + additionalDisplacement |
726 | end |
727 | |
728 | setTextBold(false) |
729 | setTextAlignment(RenderText.ALIGN_LEFT) |
730 | setTextColor(1, 1, 1, 1) |
731 | end |
501 | function TextInputElement:keyEvent(unicode, sym, modifier, isDown, eventUsed) |
502 | if TextInputElement:superClass().keyEvent(self, unicode, sym, modifier, isDown, eventUsed) then |
503 | eventUsed = true |
504 | end |
505 | |
506 | if self.isRepeatingSpecialKeyDown and not isDown and self.repeatingSpecialKeySym == sym then |
507 | self:stopSpecialKeyRepeating() |
508 | end |
509 | |
510 | if self.blockTime <= 0 and self:getIsActive() and self:getOverlayState() == GuiOverlay.STATE_PRESSED then |
511 | local wasSpecialKey = false |
512 | |
513 | if not isDown then |
514 | -- react to input state-changing keys on key "up" to avoid double inputs in the menu |
515 | if sym == Input.KEY_return and self.isReturnDown then |
516 | self.isReturnDown = false |
517 | self:setForcePressed(not self.forcePressed) |
518 | self:raiseCallback("onEnterPressedCallback", self) |
519 | wasSpecialKey = true |
520 | elseif sym == Input.KEY_esc then |
521 | self.isEscDown = false |
522 | self:setForcePressed(not self.forcePressed) |
523 | self:raiseCallback("onEscPressedCallback", self) |
524 | wasSpecialKey = true |
525 | end |
526 | else |
527 | local startSpecialKeyRepeating = false |
528 | if (sym == Input.KEY_left) then |
529 | --self.cursorPosition = math.max(1, self.cursorPosition - 1) |
530 | -- is now handled by Focus system |
531 | self:moveCursorLeft() |
532 | startSpecialKeyRepeating = true |
533 | wasSpecialKey = true |
534 | elseif (sym == Input.KEY_right) then |
535 | --self.cursorPosition = math.min(utf8Strlen(self.text) + 1, self.cursorPosition + 1) |
536 | -- is now handled by focus system |
537 | self:moveCursorRight() |
538 | startSpecialKeyRepeating = true |
539 | wasSpecialKey = true |
540 | elseif (sym == Input.KEY_home) then |
541 | self.cursorPosition = 1 |
542 | wasSpecialKey = true |
543 | elseif (sym == Input.KEY_end) then |
544 | self.cursorPosition = utf8Strlen(self.text) + 1 |
545 | wasSpecialKey = true |
546 | elseif (sym == Input.KEY_delete) then |
547 | self:deleteText(true) |
548 | startSpecialKeyRepeating = true |
549 | wasSpecialKey = true |
550 | elseif (sym == Input.KEY_backspace) then |
551 | self:deleteText(false) |
552 | startSpecialKeyRepeating = true |
553 | wasSpecialKey = true |
554 | elseif sym == Input.KEY_esc then |
555 | self.isEscDown = true |
556 | wasSpecialKey = true |
557 | elseif sym == Input.KEY_return then |
558 | self.isReturnDown = true |
559 | wasSpecialKey = true |
560 | end |
561 | |
562 | if (startSpecialKeyRepeating) then |
563 | self.isRepeatingSpecialKeyDown = true |
564 | self.repeatingSpecialKeySym = sym |
565 | self.repeatingSpecialKeyDelayTime = TextInputElement.INITIAL_REPEAT_DELAY |
566 | self.repeatingSpecialKeyRemainingDelayTime = self.repeatingSpecialKeyDelayTime |
567 | end |
568 | |
569 | if (not wasSpecialKey) then |
570 | if self:getIsUnicodeAllowed(unicode) then |
571 | local textLength = utf8Strlen(self.text) |
572 | if ((not self.maxCharacters) or (textLength < self.maxCharacters)) then |
573 | self.text = |
574 | ((self.cursorPosition > 1) and utf8Substr(self.text, 0, self.cursorPosition - 1) or "") .. |
575 | unicodeToUtf8(unicode) .. |
576 | ((self.cursorPosition <= textLength) and utf8Substr(self.text, self.cursorPosition - 1) or "") |
577 | |
578 | self.cursorPosition = self.cursorPosition + 1 |
579 | |
580 | self:raiseCallback("onTextChangedCallback", self, self.text) |
581 | end |
582 | end |
583 | end |
584 | |
585 | self:updateVisibleTextElements() |
586 | |
587 | eventUsed = true |
588 | end |
589 | end |
590 | |
591 | return eventUsed |
592 | end |
100 | function TextInputElement:loadFromXML(xmlFile, key) |
101 | TextInputElement:superClass().loadFromXML(self, xmlFile, key) |
102 | |
103 | self:addCallback(xmlFile, key.."#onEnter", "onEnterCallback") |
104 | self:addCallback(xmlFile, key.."#onTextChanged", "onTextChangedCallback") |
105 | self:addCallback(xmlFile, key.."#onEnterPressed", "onEnterPressedCallback") |
106 | self:addCallback(xmlFile, key.."#onEscPressed", "onEscPressedCallback") |
107 | self:addCallback(xmlFile, key.."#onIsUnicodeAllowed", "onIsUnicodeAllowedCallback") |
108 | |
109 | self.imeKeyboardType = Utils.getNoNil(getXMLString(xmlFile, key.."#imeKeyboardType"), self.imeKeyboardType) |
110 | self.imeTitle = self:translate(getXMLString(xmlFile, key.."#imeTitle")) |
111 | self.imeDescription = self:translate(getXMLString(xmlFile, key.."#imeDescription")) |
112 | self.imePlaceholder = self:translate(getXMLString(xmlFile, key.."#imePlaceholder")) |
113 | |
114 | self.maxCharacters = Utils.getNoNil(getXMLInt(xmlFile, key.."#maxCharacters"), self.maxCharacters) |
115 | self.maxInputTextWidth = unpack(GuiUtils.getNormalizedValues(getXMLString(xmlFile, key.."#maxInputTextWidth"), {self.outputSize[1]}, {self.maxInputTextWidth})) |
116 | self.cursorOffset = GuiUtils.getNormalizedValues(getXMLString(xmlFile, key.."#cursorOffset"), self.outputSize, self.cursorOffset) |
117 | self.cursorSize = GuiUtils.getNormalizedValues(getXMLString(xmlFile, key.."#cursorSize"), self.outputSize, self.cursorSize) |
118 | |
119 | self.enterWhenClickOutside = Utils.getNoNil(getXMLBool(xmlFile, key .. "#enterWhenClickOutside"), self.enterWhenClickOutside) |
120 | |
121 | GuiOverlay.loadOverlay(self, self.cursor, "cursor", self.imageSize, nil, xmlFile, key) |
122 | GuiOverlay.createOverlay(self.cursor) |
123 | |
124 | self.isPassword = Utils.getNoNil(getXMLBool(xmlFile, key .. "#isPassword"), self.isPassword) |
125 | |
126 | self:finalize() |
127 | end |
352 | function TextInputElement:mouseEvent(posX, posY, isDown, isUp, button, eventUsed) |
353 | if self:getIsActive() then |
354 | local isCursorInside = GuiUtils.checkOverlayOverlap(posX, posY, self.absPosition[1], self.absPosition[2], self.size[1], self.size[2]) |
355 | |
356 | if not self.forcePressed then |
357 | if eventUsed then |
358 | self:setOverlayState(GuiOverlay.STATE_NORMAL) |
359 | end |
360 | |
361 | if not eventUsed and isCursorInside and not FocusManager:isLocked() then |
362 | FocusManager:setHighlight(self) |
363 | |
364 | eventUsed = true |
365 | if self:getOverlayState() == GuiOverlay.STATE_NORMAL then |
366 | self:setOverlayState(GuiOverlay.STATE_FOCUSED) |
367 | end |
368 | |
369 | if isDown and button == Input.MOUSE_BUTTON_LEFT then |
370 | self.textInputMouseDown = true |
371 | |
372 | if not self.useImeForMouse then |
373 | self:setOverlayState(GuiOverlay.STATE_PRESSED) |
374 | end |
375 | end |
376 | |
377 | if isUp and button == Input.MOUSE_BUTTON_LEFT and self.textInputMouseDown then |
378 | self.textInputMouseDown = false |
379 | |
380 | if self.useImeForMouse then |
381 | self:openIme() |
382 | end |
383 | self:setOverlayState(GuiOverlay.STATE_PRESSED) |
384 | self:setForcePressed(true) |
385 | end |
386 | else |
387 | if (isDown and button == Input.MOUSE_BUTTON_LEFT) or self.textInputMouseDown or self:getOverlayState() ~= GuiOverlay.STATE_PRESSED then |
388 | FocusManager:unsetHighlight(self) |
389 | end |
390 | |
391 | self.textInputMouseDown = false |
392 | end |
393 | elseif self.enterWhenClickOutside then |
394 | if not isCursorInside and isUp and button == Input.MOUSE_BUTTON_LEFT then |
395 | -- Dismiss when clicking outside of the box |
396 | self:abortIme() |
397 | self:setForcePressed(false) |
398 | |
399 | |
400 | self:raiseCallback("onEnterPressedCallback", self, true) |
401 | end |
402 | end |
403 | |
404 | if not eventUsed then |
405 | eventUsed = TextInputElement:superClass().mouseEvent(self, posX, posY, isDown, isUp, button, eventUsed) |
406 | end |
407 | end |
408 | |
409 | return eventUsed |
410 | end |
38 | function TextInputElement:new(target, custom_mt) |
39 | local self = ButtonElement:new(target, custom_mt or TextInputElement_mt) |
40 | |
41 | self.textInputMouseDown = false |
42 | self.forcePressed = false |
43 | self.isPassword = false |
44 | self.displayText = "" -- actually displayed text, masked if this is a password input field |
45 | self.cursor = {} |
46 | self.cursorBlinkTime = 0 |
47 | self.cursorBlinkInterval = 400 |
48 | self.cursorOffset = {0,0} |
49 | self.cursorSize = {0.0016, 0.018} |
50 | self.cursorNeededSize = { |
51 | self.cursorOffset[1] + self.cursorSize[1], |
52 | self.cursorOffset[2] + self.cursorSize[2] |
53 | } |
54 | self.cursorPosition = 1 |
55 | self.firstVisibleCharacterPosition = 1 |
56 | self.lastVisibleCharacterPosition = 1 |
57 | self.maxCharacters = nil |
58 | self.maxInputTextWidth = nil |
59 | self.frontDotsText = "..." |
60 | self.backDotsText = "..." |
61 | self.text = "" |
62 | self.useIme = imeIsSupported() |
63 | self.useImeForMouse = GS_PLATFORM_TYPE == GS_PLATFORM_TYPE_GGP and self.useIme -- Stadia requires mouse to trigger ime too |
64 | self.preImeText = "" |
65 | self.imeActive = false |
66 | self.blockTime = 0 |
67 | |
68 | self.isReturnDown = false |
69 | self.isEscDown = false |
70 | self.isCapturingInput = false |
71 | self.hadFocusOnCapture = false |
72 | self.enterWhenClickOutside = true |
73 | |
74 | self.imeKeyboardType = "normal" |
75 | |
76 | self.forceFocus = true |
77 | |
78 | return self |
79 | end |
225 | function TextInputElement:setCaptureInput(isCapturing) |
226 | self.blockTime = 200 |
227 | if not self.isCapturingInput and isCapturing then |
228 | -- reset control key flags to avoid immediately returning out of edit mode: |
229 | self.isReturnDown = false |
230 | self.isEscDown = false |
231 | |
232 | self.target:disableInputForDuration(0) |
233 | |
234 | if TextInputElement.inputContextActive then |
235 | -- Special case handling for mouse click activation of text input elements. Because of the call order, |
236 | -- another text element may previously have been active when this one has been activated by click. Avoid |
237 | -- corrupting the input context by reverting here first. |
238 | g_inputBinding:revertContext(true) |
239 | end |
240 | |
241 | g_inputBinding:setContext(TextInputElement.INPUT_CONTEXT_NAME, true, false) |
242 | TextInputElement.inputContextActive = true |
243 | |
244 | if not GS_IS_CONSOLE_VERSION then |
245 | -- Special case handling for gaming stations which do not have keyboards available for players: |
246 | -- Register menu back and accept actions so players can exit text boxes with gamepads using either input, |
247 | -- by default bound to buttons "A" for accept and "B" for back. |
248 | g_inputBinding:registerActionEvent(InputAction.MENU_BACK, self, self.inputEvent, false, true, false, true) |
249 | g_inputBinding:registerActionEvent(InputAction.MENU_ACCEPT, self, self.inputEvent, false, true, false, true) |
250 | end |
251 | |
252 | self.isCapturingInput = true |
253 | elseif self.isCapturingInput and not isCapturing then |
254 | if TextInputElement.inputContextActive then |
255 | -- Special case handling for mouse click activation of text input elements. Ensure to avoid double reverts |
256 | -- when switching from one text input to another. |
257 | g_inputBinding:revertContext(true) -- revert and clear text input context |
258 | TextInputElement.inputContextActive = false |
259 | end |
260 | |
261 | self.target:disableInputForDuration(200) |
262 | self.isCapturingInput = false |
263 | end |
264 | end |
629 | function TextInputElement:update(dt) |
630 | TextInputElement:superClass().update(self, dt) |
631 | |
632 | self.cursorBlinkTime = self.cursorBlinkTime+dt |
633 | while self.cursorBlinkTime > 2*self.cursorBlinkInterval do |
634 | self.cursorBlinkTime = self.cursorBlinkTime - 2*self.cursorBlinkInterval |
635 | end |
636 | |
637 | if (self.isRepeatingSpecialKeyDown) then |
638 | self.repeatingSpecialKeyRemainingDelayTime = self.repeatingSpecialKeyRemainingDelayTime - dt |
639 | if (self.repeatingSpecialKeyRemainingDelayTime <= 0) then |
640 | if (self.repeatingSpecialKeySym == Input.KEY_left) then |
641 | self:moveCursorLeft() |
642 | elseif (self.repeatingSpecialKeySym == Input.KEY_right) then |
643 | self:moveCursorRight() |
644 | elseif (self.repeatingSpecialKeySym == Input.KEY_delete) then |
645 | self:deleteText(true) |
646 | elseif (self.repeatingSpecialKeySym == Input.KEY_backspace) then |
647 | self:deleteText(false) |
648 | end |
649 | self:updateVisibleTextElements() |
650 | |
651 | -- reduce key delay each frame down to the minimum to accelerate input when holding control keys |
652 | self.repeatingSpecialKeyDelayTime = math.max(TextInputElement.MIN_REPEAT_DELAY, self.repeatingSpecialKeyDelayTime * (0.1^(dt/100))) |
653 | self.repeatingSpecialKeyRemainingDelayTime = self.repeatingSpecialKeyDelayTime |
654 | end |
655 | end |
656 | if (self.useIme and self.imeActive) then |
657 | local done,cancel = imeIsComplete() |
658 | if done then |
659 | self:setForcePressed(false) |
660 | if not cancel then |
661 | self:setText(imeGetLastString()) |
662 | self:raiseCallback("onEnterPressedCallback", self) |
663 | else |
664 | self:setText(self.preImeText) |
665 | self.preImeText = "" |
666 | self:raiseCallback("onEscPressedCallback", self) |
667 | end |
668 | self.imeActive = false |
669 | else |
670 | self:setText(imeGetLastString()) |
671 | self:setCursorPosition(imeGetCursorPos()+1) |
672 | self:updateVisibleTextElements() |
673 | end |
674 | end |
675 | |
676 | if self.blockTime > 0 then |
677 | self.blockTime = self.blockTime - dt |
678 | end |
679 | end |
816 | function TextInputElement:updateVisibleTextElements() |
817 | self.isCursorVisible = false |
818 | self.isVisibleTextPart1Visible = false |
819 | self.visibleTextPart1 = "" |
820 | self.isVisibleTextPart2Visible = false |
821 | self.visibleTextPart2 = "" |
822 | |
823 | self.areFrontDotsVisible = false |
824 | self.areBackDotsVisible = false |
825 | |
826 | self.firstVisibleCharacterPosition = 1 |
827 | |
828 | setTextBold(self.textBold) |
829 | |
830 | local displayText = self.text |
831 | if self.isPassword then |
832 | displayText = string.rep("*", #self.text) |
833 | end |
834 | |
835 | local textLength = utf8Strlen(displayText) |
836 | local availableTextWidth = self:getAvailableTextWidth() |
837 | |
838 | if (self:getIsActive() and (self:getOverlayState() == GuiOverlay.STATE_PRESSED)) then |
839 | -- input is gathered, cursor is shown, |
840 | -- text is displayed at an arbitrary position, both additonal text markers may be displayed |
841 | |
842 | self.isCursorVisible = true |
843 | |
844 | if (self.cursorPosition < self.firstVisibleCharacterPosition) then |
845 | -- cursor was moved to the left to display additional text |
846 | self.firstVisibleCharacterPosition = self.cursorPosition |
847 | end |
848 | |
849 | if (self.firstVisibleCharacterPosition > 1) then |
850 | self.areFrontDotsVisible = true |
851 | end |
852 | |
853 | local textInvisibleFrontTrimmed = utf8Substr(displayText, self.firstVisibleCharacterPosition-1) |
854 | local textWidthInvisibleFrontTrimmed = getTextWidth(self.textSize, textInvisibleFrontTrimmed) |
855 | availableTextWidth = self:getAvailableTextWidth() |
856 | |
857 | if (availableTextWidth and (textWidthInvisibleFrontTrimmed > availableTextWidth)) then |
858 | -- not all text fits into the visible area |
859 | if (self.cursorPosition <= textLength) then |
860 | -- the cursor is not at the last position of the text |
861 | --self.isBackAdditionalTextMarkerVisible = true |
862 | self.areBackDotsVisible = true |
863 | availableTextWidth = self:getAvailableTextWidth() |
864 | end |
865 | end |
866 | |
867 | |
868 | local visibleText = TextInputElement.limitTextToAvailableWidth(textInvisibleFrontTrimmed, self.textSize, availableTextWidth) |
869 | local visibleTextWidth = getTextWidth(self.textSize, visibleText) |
870 | local visibleTextLength = utf8Strlen(visibleText) |
871 | |
872 | if (availableTextWidth and (self.cursorPosition > self.firstVisibleCharacterPosition + visibleTextLength)) then |
873 | -- the cursor is on the right side and not visible anymore |
874 | -- text has to be shifted for the cursor to become visible again |
875 | --self.isFrontAdditionalTextMarkerVisible = true |
876 | self.areFrontDotsVisible = true |
877 | availableTextWidth = self:getAvailableTextWidth() |
878 | |
879 | local textTrimmedAtCursor = utf8Substr(textInvisibleFrontTrimmed, 0, self.cursorPosition - self.firstVisibleCharacterPosition) |
880 | visibleText = TextInputElement.limitTextToAvailableWidth( |
881 | textTrimmedAtCursor, self.textSize, availableTextWidth, true) |
882 | visibleTextWidth = getTextWidth(self.textSize, visibleText) |
883 | visibleTextLength = utf8Strlen(visibleText) |
884 | self.firstVisibleCharacterPosition = self.cursorPosition - visibleTextLength |
885 | end |
886 | |
887 | if ((availableTextWidth) and (not self.areBackDotsVisible) and (self.firstVisibleCharacterPosition > 1)) then |
888 | -- check if there is still room for additonal characters (can happen if text gets deleted) |
889 | local lastCharacterPosition = visibleTextLength + self.firstVisibleCharacterPosition |
890 | local nextCharacter = utf8Substr(displayText, self.firstVisibleCharacterPosition - 1, 1) |
891 | local additionalCharacterWidth = getTextWidth(self.textSize, nextCharacter) |
892 | if (((visibleTextWidth + additionalCharacterWidth) <= availableTextWidth) and (self.firstVisibleCharacterPosition > 1)) then |
893 | while (((visibleTextWidth + additionalCharacterWidth) <= availableTextWidth) and (self.firstVisibleCharacterPosition > 1)) do |
894 | -- there is still room for additonal characters |
895 | self.firstVisibleCharacterPosition = self.firstVisibleCharacterPosition - 1 |
896 | visibleTextWidth = visibleTextWidth + additionalCharacterWidth |
897 | nextCharacter = utf8Substr(displayText, self.firstVisibleCharacterPosition - 1, 1) |
898 | additionalCharacterWidth = getTextWidth(self.textSize, nextCharacter) |
899 | end |
900 | |
901 | if (self.firstVisibleCharacterPosition > 1) then |
902 | self.areFrontDotsVisible = false |
903 | local availableWidthWithoutFrontDots = self:getAvailableTextWidth() |
904 | self.areFrontDotsVisible = true |
905 | local neededWidthForCompleteText = getTextWidth(self.textSize, displayText) |
906 | if (neededWidthForCompleteText <= availableWidthWithoutFrontDots) then |
907 | self.areFrontDotsVisible = false |
908 | self.firstVisibleCharacterPosition = 1 |
909 | end |
910 | else |
911 | -- all characters are visible |
912 | self.areFrontDotsVisible = false |
913 | end |
914 | |
915 | visibleText = utf8Substr(displayText, self.firstVisibleCharacterPosition - 1, lastCharacterPosition) |
916 | end |
917 | end |
918 | |
919 | |
920 | self.isVisibleTextPart1Visible = true |
921 | self.visibleTextPart1 = utf8Substr(visibleText, 0, self.cursorPosition - self.firstVisibleCharacterPosition) |
922 | if (visibleTextLength > (self.cursorPosition - self.firstVisibleCharacterPosition)) then |
923 | self.isVisibleTextPart2Visible = true |
924 | self.visibleTextPart2 = utf8Substr(visibleText, self.cursorPosition - self.firstVisibleCharacterPosition) |
925 | end |
926 | |
927 | else |
928 | -- input is not gathered, cursor is not shown, |
929 | -- text is displayed from its beginning, only back additonal text marker may be displayed if text is too long |
930 | local textWidth = getTextWidth(self.textSize, displayText) |
931 | -- check if additional text marker has to be displayed |
932 | if (availableTextWidth and (textWidth > availableTextWidth)) then |
933 | --self.isBackAdditionalTextMarkerVisible = true |
934 | self.areBackDotsVisible = true |
935 | availableTextWidth = self:getAvailableTextWidth() |
936 | end |
937 | |
938 | -- set visible text |
939 | if (availableTextWidth and (textWidth > availableTextWidth)) then |
940 | -- not all text fits into the visible area |
941 | self.visibleTextPart1 = TextInputElement.limitTextToAvailableWidth(displayText, self.textSize, availableTextWidth) |
942 | self.isVisibleTextPart1Visible = true |
943 | else |
944 | -- all text fits into the visible area |
945 | self.visibleTextPart1 = displayText |
946 | self.isVisibleTextPart1Visible = true |
947 | end |
948 | end |
949 | setTextBold(false) |
950 | |
951 | -- print(string.format("updateVisibleTextElements finished :")) |
952 | -- print(string.format( |
953 | -- "text: %s - cursorPosition: %d - firstVisibleCharacterPosition: %d - areFrontDotsVisible: %s - isVisibleTextPart1Visible: %s - visibleTextPart1: %s - isCursorVisible: %s - isVisibleTextPart2Visible: %s - visibleTextPart2: %s - areBackDotsVisible: %s", |
954 | -- self.text, self.cursorPosition, self.firstVisibleCharacterPosition, tostring(self.areFrontDotsVisible), tostring(self.isVisibleTextPart1Visible), self.visibleTextPart1, tostring(self.isCursorVisible), tostring(self.isVisibleTextPart2Visible), self.visibleTextPart2, tostring(self.areBackDotsVisible))) |
955 | end |