-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change of behavour of Right command for 1 space at the start of line #242
Conversation
babi/file.py
Outdated
self.buf.x < len(line) and | ||
tp == line[self.buf.x].isalnum() and | ||
not ( | ||
self.buf.x == 1 and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is sufficient -- the same problem would happen halfway through an indent if I understand correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think of case when we have \t\tSome words
And when we are on the 2nd tab we will jump to the end of "Some" word. I done it the same as spaces works, if you are on the space before the word you jump at the end of the word, and that is included in test. If you think behaviour should be different i can think of solution. I do not want to differentitate behaviour for space and space like chcaracters ( tab ) included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or cursor is at position 3 of a 4 space tab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok so you have in maind case when we have characters in intedn from tab? I still do not know what is expected behaviour from this.
You want to treat \t as 4 spaces and it should work the same? so when we have situatuation like this:
sad indent
^ ^ ^
| | | + when use tab as work separator
| | + when spaces as word separator
| + cursor postion
Do you want to override default behavior and when we have words separated by tab we should go to the start od the word?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I think I understand what you are thinking off. I will try to solve that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that doesn't look like the right direction at all. I suspect what actually should be done is to find the "break" points in the line and navigate to the next one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Understand but without knowing the width of the tab, i do not think that I will be able to determine if i should go to the begginig of the word or the postion after the word. Let look at examples:
tabsize:4
HI! Anthony
^ ^
| | should be here after ^right
| cursor position
tabsize:5
HI! Anthony
^ ^
| | should be here after ^right
| cursor position
I could use buf.x to differentiate that but problem is when we have something like that:
tabsize:4
HI Be thony
^ ^
| | should be here after ^right
| cursor position
tabsize:5
HI Be thony
^ ^
| | should be here after ^right
| cursor position
In that case we have just bad value in buf.x which is not corresponding to the screen position.
Question is if we have left with one "space" when using tab should we jump to the nearest word (easy fix) or to the space after the word ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the width of the tab doesn't matter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. So you want it working like in nano? So when tab is used it is alweys go to the start of the next word?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I make it the most trivial now how it can be. I do not really get the better idea of how to find break points without knowing the tab lenght. Current solution resolve most cases except one when we have something like that:
asd\tasd -> it will go to the a of the asd instead of the end. But i do not really know how i should find if we should go after the word or not without knowing the tab size and counting characters in the string.
Do not know what the exact requirements are for this functionality. I make it to work like in nano but it seems it in not good. Maybe will try it again in future if the description will be better. |
Target #237
The problem is for all spaces uses at the start of the line. PR target only those, and not changing behaviour of the rest. It should work for any characters recognized by the isspace method.