Hi Vincent,

 
>>
>>
>> 1. Create a tiddler with a short paragraph (shorter than a line), an 
>> empty line and another paragraph (line after 2 linebreaks). Go to the view 
>> mode, click the first paragraph, go to the its end. Press right: what I get 
>> is an *extra* block to the right from the first paragraph, then I press 
>> right again, I get the empty line block (which is ok), then the second 
>> paragraph. Interestingly enough, if I have a paragraph, a linebreak and a 
>> list item (only one linebreak after the paragraph before the "*" symbol), I 
>> get this "extra block", too; however, list items don't generate this "extra 
>> block" (which can be seen if tiddler contains a list item and then a 
>> paragraph). Another aspect: empty lines don't generate the "extra block".
>>
>
> The "extra block" corresponds to a BR element in the DOM tree. A paragraph 
> is usually followed by a BR, therefore you see that extra block. An empty 
> line is nothing but a BR, so that edit box for an empty line is already 
> that "extra box" itself, and that's why you don't get another extra box 
> again. Anything that's not followed by a BR does not give you this extra 
> box.
>  
> I am still thinking of a good way to handle those BR's.....
>
> Well, I think a BR element should generate an edit block only if it is 
followed by another BR, and if changes are to be applied the text should be 
inserted after it [the first one].
 

>
>> 2. In this case, I would expect "down" arrow to act like the "left" 
>> arrow. Well, not exactly in the same manner, but surely "down" should also 
>> bring me to the next block.
>>
>
> The down and up arrows are not implemented because I have not yet figured 
> out how to move the cursor in a visually consistent way. I mean when I 
> press the up arrow I do expect to see the cursor go straight above instead 
> of to the very left of the element above, don't I?
>  
>
That's a fair note. But I think this is not to be taken into account until 
the edit-area+preview pair is substituted with a WYSIWYGish edit area. Once 
that is done, you can calculate the X coordinate of the cursor, predict 
which coordinate it will get if it is place after the first letter of the 
line, after the second etc and decide which variant is closest to the 
current, and act accordingly. Alternatively, you can implement the 
behaviour of office-like editors: they find the position which is not 
closest (by X) to the current one, but rather to the "previous left" 
position which is changed on pressing anything but up or down (with 
exception of start/end-of-text positions). To simplify understanding this 
alternative behaviour, I'll illustrate it this way:

consider the text below, "x" are letters, "l" is the cursor:

xxxxxxxxxxxxxxxxxxxxxxxxxxx*l*xxxxx
xxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

If one presses "down" twice, in the first model (s)he will get:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxx
xxxxxxxxxxx*l*xxxxxxxxxxxxxxxxxxxxx

but in the second (s)he will get:

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx*l*xxxxx

So, after you understand the illustration, you may want to re-read my 
description which may be not very clear without it..

Again, untill a WYSIWYGish edit area is not implemented, you probably don't 
have to implement this "go right below" stuff (while the "down to get to 
the next block" behaviour is needed constantly when navigating through 
text). Yet, there's a third path: on "down", open the new text edit area 
(with preview) and predict the cursor position.

Auxiliary: to find X coordinate of the cursor in textarea and in other 
elements, you probably have to use different tools.
For textareas, [1] may be see helpful
For other elements, see [2] (but that's for *selection* and you will 
probably emulate a cursor anyway, and the cursor element will probably 
bring a better way by itself)

Best regards,
Yakov.

[1] 
http://stackoverflow.com/questions/29709/how-do-i-get-the-x-y-pixel-coordinates-of-the-caret-in-text-boxes
[2] 
http://stackoverflow.com/questions/6846230/coordinates-of-selected-text-in-browser-page

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/950ee098-ff10-44cf-a502-73e747791221%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to