World: r3wp
[!RebGUI] A lightweight alternative to VID
older newer | first last |
Graham 21-Apr-2007 [6280x3] | I suspect it would not be particularly overkill to track the caret on every keystroke ... editors do it all the time. |
otherwise text insertion is going to be hit and miss | |
it violates gui principles if you claim the ability to insert at the caret, but it inserts elsewhere | |
Ashley 21-Apr-2007 [6283] | click inside a body of text to place the caret, and then push a button to insert a block of text Ah, got it. The solution is simple then. We add a line to set-text (after the string? test) that reads: all [view*/caret none? face/caret face/caret: index? view*/caret] |
Graham 21-Apr-2007 [6284x2] | let me try :) |
make object! [ code: 311 type: 'script id: 'invalid-path arg1: 'caret arg2: none arg3: none near: [all [view*/caret none? face/caret face/caret: index? view*/caret] insert either all ] where: 'show-text ] | |
Ashley 21-Apr-2007 [6286x2] | Probably needs to read: all [caret view*/caret none? face/caret face/caret: index? view*/caret] If this works the whole thing can be refactored a bit. |
Error looks like the widget hasn't got a caret aatribute. | |
Graham 21-Apr-2007 [6288x3] | Nope, not working. |
It's inserting at the head of the face and not at the caret after clicking on the text in the area | |
head of face/text | |
Ashley 21-Apr-2007 [6291x3] | Let me try here ... |
Update set-text with: unless string? face/text [exit] insert either caret [ if all [ none? face/caret face = view*/focal-face view*/caret ] [face/caret: index? view*/caret] either face/caret [at face/text face/caret] [tail face/text] ][ clear face/text ] form text | |
Then run the following: display "" [ f: field field button [set-text/caret f "X"] ] Click in f, type some text, click or arrow to the middle of the text and press the button. Text is inserted at caret. | |
Graham 21-Apr-2007 [6294x2] | not for me |
still requires a tab to set the caret position correctly | |
Ashley 21-Apr-2007 [6296x4] | Hmm, maybe there are other changes at play here. Let me upload latest build ... |
Build uploaded. | |
So, running the text above I click into f, type "ab", press the left arrow key once and then the button. What I see is an "X" inserted between letters "a" and "b" (i.e. "aXb") with the cursor positioned between the "a" and "X". Is this what you see? Is this "correct"? | |
Or do you expect the cursor to be positioned between the letters "X" and "b"? | |
Graham 21-Apr-2007 [6300] | doesn't matter |
Ashley 21-Apr-2007 [6301] | Huh? |
Graham 21-Apr-2007 [6302x4] | but if you now move the cursor to the head of the text, and click button, it still inserts as before. |
I guess the caret should be at the end of the inserted text | |
and this mirrors what happens when you type | |
the face/caret is not being updated when you click inside the text | |
Ashley 21-Apr-2007 [6306] | OK, Mk III unless string? face/text [exit] either caret [ if all [ face = view*/focal-face view*/caret ] [face/caret: index? view*/caret] either face/caret [ insert at face/text face/caret form text view*/caret: at face/text face/caret + length? form text face/caret: index? view*/caret ] [insert tail face/text form text] ] [insert clear face/text form text] |
Graham 21-Apr-2007 [6307x2] | sorry ... |
no better | |
Ashley 21-Apr-2007 [6309] | I type "ab" ArLeft and press button to get "aX|b" the ArLeft, ArLeft and press button to get "X|aXb" Is this what you get? |
Graham 21-Apr-2007 [6310x2] | No |
let me resync a new directory | |
PeterD 21-Apr-2007 [6312x2] | I get aXXb |
|aXXa | |
Graham 21-Apr-2007 [6314x2] | a|Xb |
|aXXb | |
Ashley 21-Apr-2007 [6316] | Ah, my fault. I didn't sync the above change. |
Graham 21-Apr-2007 [6317x3] | I did |
I put mark III in | |
>> checksum read %rebgui.r == 14063079 | |
Ashley 21-Apr-2007 [6320x2] | Uploaded. I still get the same, working, result. |
PeterD, you win tie breaks it seems ;) | |
Graham 21-Apr-2007 [6322] | Rebol isn't indeterminate |
PeterD 21-Apr-2007 [6323] | I get 16618006 for checksum ?? |
Ashley 21-Apr-2007 [6324] | Same here. |
Graham 21-Apr-2007 [6325x2] | not me .. and that was a fresh checkout :( |
and create-distribution.r | |
PeterD 21-Apr-2007 [6327] | I still get aXXb |
Graham 21-Apr-2007 [6328] | ok, same checksum, let's try again |
Ashley 21-Apr-2007 [6329] | Do a search on "build: " on %rebgui.r ... it should come back with "build: 87" |
older newer | first last |