Home Download Buy Blog Forum Support

"Smart" horizontal cursor positioning

Re: "Smart" horizontal cursor positioning

Postby bizoo on Tue Oct 16, 2012 8:24 am

Updated github right now with the new keybindings from adzenith and the fixes for the only issues I've found after a day of work:
-After selecting a text from right to left and delete/modify it, caret must be placed to the starting point of the selection (so, technically, always sel.a and not sel.begin()).
-Move down after an edit at the last line of the file move the caret horizontally but, of course, not vertically, which is IMHO not what users are expecting.
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: "Smart" horizontal cursor positioning

Postby bizoo on Mon Nov 12, 2012 2:06 pm

adzenith wrote:For what it's worth, I've replaced the standard up and down arrows with this. I did this:
Code: Select all
  { "keys": ["up"], "command": "smart_cursor", "args": {"cmd": "move", "by": "lines", "forward": false}, "context":
    [
      { "key": "auto_complete_visible", "operator": "equal", "operand": false }
    ]
  },
  { "keys": ["down"], "command": "smart_cursor", "args": {"cmd": "move", "by": "lines", "forward": true}, "context":
    [
      { "key": "auto_complete_visible", "operator": "equal", "operand": false }
    ]
  },

@adzenith:
I used these keymaps but found a small issue:
When you go at the end of the auto complete list, press one more down close the auto complete and execute a move down command, not a smart_cursor down command.
If I remove the context, it works as expected.

Did you find an issue with enabling the smart_cursor for auto complete or did you add context 'in case of' ?
Thanks for your reply.
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: "Smart" horizontal cursor positioning

Postby bizoo on Wed Feb 06, 2013 2:01 pm

@adzenith
I know it's a old question (previous post), but I'm still interested by the answer.
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: "Smart" horizontal cursor positioning

Postby adzenith on Wed Feb 06, 2013 9:41 pm

Hey, sorry, didn't notice the question until just now! I seem to recall I added them because I couldn't use the arrow keys to navigate autocomplete.
I just tried taking the context out, and it causes a different bug:

Code: Select all
foo| [autocomplete window, item 0 selected]


press down

Code: Select all
|foo [autocomplete window, item 1 selected]


The insertion point moves to the beginning of the line.
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: "Smart" horizontal cursor positioning

Postby bizoo on Thu Feb 07, 2013 7:51 am

Thanks for your answer.

I couldn't reproduce this bug, or I don't understand it:
You mean that when changing selection in autocomplete window, the cursor move in the file view ?
I couldn't reproduce it.
Do you have the last version of the repository https://github.com/bizoo/SmartCursor
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: "Smart" horizontal cursor positioning

Postby adzenith on Thu Feb 07, 2013 3:07 pm

Haha nope! Looks like I still had the second commit or so. I think I'd checked out the code using git so Package Manager stopped updating it. Whoops! Works now. :)
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: "Smart" horizontal cursor positioning

Postby adzenith on Thu Feb 07, 2013 3:09 pm

Oh wait, hold up, it's doing it again.
Open a new buffer, set it to Python (so we get autocomplete), and type:
Code: Select all
foo
foobar
f

now press down. For me, it snaps to the beginning of the line.
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: "Smart" horizontal cursor positioning

Postby bizoo on Thu Feb 07, 2013 3:23 pm

Yes you're right, there's something that goes wrong when autocomplete is triggered.
Thanks for your feedback, I'll take a look on this issue later..

If only Jon could implement this feature in core ST3 ;)
bizoo
 
Posts: 886
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: "Smart" horizontal cursor positioning

Postby adzenith on Thu Feb 07, 2013 10:15 pm

I just discovered also that you can't navigate the sidebar with the arrow keys unless you have those contexts set up...
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: "Smart" horizontal cursor positioning

Postby highend on Wed Apr 17, 2013 11:51 am

Is it ST3 compatible bizoo?
highend
 
Posts: 94
Joined: Fri Jan 20, 2012 2:47 pm

PreviousNext

Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 8 guests