You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
can't move cursor to end of line in insert mode, cursor sticks prior to end of line instead of moving to end of line
To Reproduce
enter insert mode, enter text 1234. press escape to enter normal mode. move cursor left and right. It works as expected; i.e. 12[3]4 when moving left, 123[4] when moving right. Pressing right again does nothing.
enter insert mode with cursor on 4. Per vim usual the result is 123|4. Cursor left is 12|34, cursor right is 123|4. A further cursor right stays at 123|4
Expected behavior
a further cursor right in insert mode yields 1234| further right arrows stay at the end of the line
If I make the following patch, insert mode allows the cursor to move to the end of the line, but also allows the cursor to wrap to the next line, so not the same as vim. I was wondering if this rings any bells? I'm not sure what I might be doing wrong. I tried other solutions, but they had side effects, like allowing the cursor in normal mode to go beyond the end of the line. I started to think maybe there needs to be MotionInsertRight to exactly implement a vim behavior; at which point I thought I must be doing something wrong...
My key handler is very straightforward, basically lifted straight from the sample, I assume I'm using it correctly? I'm not sure where else to look for a bug in my code. I have verified that zep is definitely in insert mode, and it's definitely invoking MotionRight, so I'm feeling a bit stuck at the moment. MotionStandardRight lets me get to the end of the line for now, but I'd like to know where I've gone off the rails...
// returns true if the event was consumedboolHandleKeyInput(const ZepBuffer& buffer,
uint32_t key, bool ctrl, bool shift)
{
bool handled = false;
uint32_t mod = (ctrl ? Zep::ModifierKey::Ctrl : 0) |
(shift ? Zep::ModifierKey::Shift : 0);
switch (key)
{
case Zep::ExtKeys::TAB:
case Zep::ExtKeys::ESCAPE:
case Zep::ExtKeys::RETURN:
case Zep::ExtKeys::DEL:
case Zep::ExtKeys::HOME:
case Zep::ExtKeys::END:
case Zep::ExtKeys::BACKSPACE:
case Zep::ExtKeys::RIGHT:
case Zep::ExtKeys::LEFT:
case Zep::ExtKeys::UP:
case Zep::ExtKeys::DOWN:
case Zep::ExtKeys::PAGEDOWN:
case Zep::ExtKeys::PAGEUP:
buffer.GetMode()->AddKeyPress(key, mod);
returntrue;
}
if (ctrl)
{
if (key == '1')
{
SetGlobalMode(ZepMode_Standard::StaticName());
handled = true;
}
elseif (key == '2')
{
SetGlobalMode(ZepMode_Vim::StaticName());
handled = true;
}
elseif (key >= 'A' && key <= 'Z')
{
buffer.GetMode()->AddKeyPress(key - 'A' + 'a', mod);
handled = true;
}
elseif (key == '')
{
buffer.GetMode()->AddKeyPress('', mod);
handled = true;
}
}
if (!handled)
{
handled = true;
if (key != '\r')
{
buffer.GetMode()->AddKeyPress(key, mod);
}
}
return handled;
}
The text was updated successfully, but these errors were encountered:
Describe the bug
can't move cursor to end of line in insert mode, cursor sticks prior to end of line instead of moving to end of line
To Reproduce
enter insert mode, enter text 1234. press escape to enter normal mode. move cursor left and right. It works as expected; i.e. 12[3]4 when moving left, 123[4] when moving right. Pressing right again does nothing.
enter insert mode with cursor on 4. Per vim usual the result is 123|4. Cursor left is 12|34, cursor right is 123|4. A further cursor right stays at 123|4
Expected behavior
a further cursor right in insert mode yields 1234| further right arrows stay at the end of the line
If I make the following patch, insert mode allows the cursor to move to the end of the line, but also allows the cursor to wrap to the next line, so not the same as vim. I was wondering if this rings any bells? I'm not sure what I might be doing wrong. I tried other solutions, but they had side effects, like allowing the cursor in normal mode to go beyond the end of the line. I started to think maybe there needs to be MotionInsertRight to exactly implement a vim behavior; at which point I thought I must be doing something wrong...
My key handler is very straightforward, basically lifted straight from the sample, I assume I'm using it correctly? I'm not sure where else to look for a bug in my code. I have verified that zep is definitely in insert mode, and it's definitely invoking MotionRight, so I'm feeling a bit stuck at the moment. MotionStandardRight lets me get to the end of the line for now, but I'd like to know where I've gone off the rails...
The text was updated successfully, but these errors were encountered: