Hi Edward

On Wednesday, January 25, 2017 at 4:56:24 PM UTC, Edward K. Ream wrote:
>
> On Wed, Jan 25, 2017 at 7:56 AM, jkn <[email protected] <javascript:>
> > wrote:
>
>>
>> Edward, I am thinking that it might be worth having the functionality of 
>> cursorToTopOfPane() and cursorToEndOfPane() in Leo's (Qt) core?
>>
>
> ​Yes.  I'll move them there soon.  Thanks for this code.
>

cool! ;-)
 

>
> BTW, It was easy to convert your flattened code (good for review) to 
> separate nodes using parse-body.
>
> I don't think the 'use lossage()' key functions should be in the core, 
>> unless you know better...
>>
>
> ​Is this a problem?  view-lossage is not bound to any key by default.​
>  
> ​Why not use it.  Your code does.​
>

I didn't mean view-lossage, or my showLossage(); I meant the  
doMy[Ctrl]HomeKey() and doMy[Ctrl]EndKey() functions. See more below...


> - there can be a small amount of 'micro-scrolling' as you move the cursor 
> to the top/bottom of the pane. I think my other editor resizes the pane so 
> as not to have partial text lines. The current behaviour seems liveable 
> with, although I might be interested in learning how to 'fix' this.
>
> ​In some cases Leo saves/restores scrollbars.  Not sure this is 
> applicable.​
>

I don't think this is relevant, it is to do with what Qt reports as the 
top/end of client coordinates, and how this is converted into what I am 
calling a text position. There is probably an approach along the lines of: 

    get suggested new position
    if (moving cursor to this position would cause a scroll):
        tweak new position

but I am not rushing to look at this.

>
>     - I don't currently deal with any existing selected region. If this 
> were to go into the core this would probably all be refactored, maybe using 
> some of the existing helper functions
> ​.
>
> You should definitely use the helpers, defined in the node:
> qtm.Generic high-level interface.
> ​
>

Yes, I started looking at these but wanted to get the basics operational 
first.
 

>     - the doKey() function has to know about the key(s) that are calling 
> it, "Home" or "End" in the lossage() list. How might I improve this?
>
> ​I don't see any doKey function.​
>

Sorry, the perils of editing actual code before posting! I mean the 
(equivalent) functions which are called when one of [Ctrl]Home or [Ctrl]End 
are pressed, eg. doMyCtrlHomeKey().

These have to check lossage() for "previous instances of the same character 
that got me here", and currently nastily hard-coded those characters as 
"Ctrl+Home" or "Ctrl+End"

This is the stuff I don't think should go into core - the functions cannot 
be rebound to another key (without work, at least). Suggestinos for 
improvement welcome.

>
>     - I had some trouble calling the pre-existing editor commands, like 
> c.editCommand.
> ​​
> beginningOfBuffer() etc. Not 100% sure I am doing this correctly.
>
> ​I would have to see your code.
>

I was looking at the scripting guide 
http://leoeditor.com/scripting-miscellany.html?highlight=docommand#id13

and trying things like:

c.doCommand(c.beginningOfLine,label="beginningofline")
c.beginningOfLine()

But I think you are meaning something different here by 'commands'?


> It's great that you are giving this a go.  Feel free to ask questions.
>

I'm glad it's of interest! I have another small tweak to suggest in another 
post.

    Regards
    Jon N

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" 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/leo-editor.
For more options, visit https://groups.google.com/d/optout.

Reply via email to