Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Keyboard switch.
-
@shinya.ta The Pythonista keyboard only offers English keyboard.
Of course, you can always tap the globe key to shift to another international keyboard -
If so, please.
-
@cvp I haven't really delved into keyboard extensions on iOS, but apparently you should have access to a textDocumentProxy
- (void)moveCursorToLeft { [self.textDocumentProxy adjustTextPositionByCharacterOffset:-1]; } - (void)moveCursorToRight { [self.textDocumentProxy adjustTextPositionByCharacterOffset:1]; }
-
@JonB Not sure that could help because this proxy is a property of the UIControllerInputView and the associated methods are these ones that the keyboard module offers: move_cursor , insert, ....
I can move -1,+1 and I hoped that get_context would return the text before and after so i could move of their length but the returned tuple is only texts in the current line
-
Even this does not work, it stops after one line
def b_bottom_action(sender): while True: t = keyboard.get_input_context() if len(t[0]) == 0: break keyboard.move_cursor(-len(t[0]))
-
@shinya.ta New version here with buttons for
- left one position
- right one position
- begin of line
- end of line
Sorry, not yet found a way to go top and bottom of text
-
@cvp I could see that might not work., Without maybe a thread to keep moving?
-
@JonB Thanks to try to help us (him? 😀). I don't understand how I could follow your advice.
I've tried in the button's action to start a thread running the same loop, but no change -
@JonB But this works, not nice to see the cursor moving so slowly
import time import threading class my_thread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): while True: t = keyboard.get_input_context() if len(t[0]) == 0: break keyboard.move_cursor(-len(t[0])) time.sleep(0.0001)
-
Out of curiosity, what if you move_cursor(-10000) or something quite large... Does it only let you move the length of the context, or will it error if you go more than the textview would allow?
-
I tested.
This is wonderful.
If there is an up-and-down button, it is perfect. -
@JonB I had tried very big moves, no error but no movement
-
@JonB this morning, weird effect, regardless of where the cursor is, it always descends to the same place, while the move parameter is negative. Perhaps, it is too early for my iPad 😊
-
@shinya.ta I'll try, but this evening
-
@shinya.ta New version here with 6 buttons:
- left, right which seem ok
- beginning of document, end of document, up one line, down one line
But the process is not so good as hoped...
I've problems with keyboard.get_input_context that, sometimes 😢, returns texts of previous line, thus no way to compute length of texts at left and right of cursor because the texts are these ones of another line...Thus, buttons are there, in some cases, it is ok, and in other cases not 😂
I agree that is not so pleasant, but try it at least.
Thanks -
I'll take a test.
Is it possible to make a page with only cursor movement?
-
The top and bottom buttons don't move.
It doesn't seem to be good if the lines of the "文末" and "文頭" buttons are different. -
@shinya-ta Do you know about the built in "track ball" mode of the iOS keyboard? Tap keyboard with two fingers (or maybe long press spacebar, might be different depending on device) then the keyboard becomes a trackball that you can drag around your finger to move cursor.
-
@JonB Thanks to help me to try another solution 😀 because it is fastidious to develop a keyboard exactly as wanted...
-
@shinya.ta said:
The top and bottom buttons don't move
I told you I get problems with these buttons because the keyboard module does not work exactly as expected.