mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
If we hit edge of entry box, make left/right move forward to listview.
This commit is contained in:
parent
fd56e07159
commit
c54a817555
2 changed files with 24 additions and 6 deletions
|
@ -1297,7 +1297,19 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, KeyBindingAction actio
|
|||
break;
|
||||
// If you add a binding here, make sure to add it to textbox_keybinding too
|
||||
case MOVE_CHAR_BACK:
|
||||
{
|
||||
if ( textbox_keybinding ( state->text, action ) == 0 ) {
|
||||
listview_nav_left ( state->list_view );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MOVE_CHAR_FORWARD:
|
||||
{
|
||||
if ( textbox_keybinding ( state->text, action ) == 0 ) {
|
||||
listview_nav_right ( state->list_view );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CLEAR_LINE:
|
||||
case MOVE_FRONT:
|
||||
case MOVE_END:
|
||||
|
|
|
@ -405,20 +405,28 @@ void textbox_cursor ( textbox *tb, int pos )
|
|||
* @param tb Handle to the textbox
|
||||
*
|
||||
* Move cursor one position forward.
|
||||
*
|
||||
* @returns if cursor was moved.
|
||||
*/
|
||||
static void textbox_cursor_inc ( textbox *tb )
|
||||
static int textbox_cursor_inc ( textbox *tb )
|
||||
{
|
||||
int old = tb->cursor;
|
||||
textbox_cursor ( tb, tb->cursor + 1 );
|
||||
return ( old != tb->cursor );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tb Handle to the textbox
|
||||
*
|
||||
* Move cursor one position backward.
|
||||
*
|
||||
* @returns if cursor was moved.
|
||||
*/
|
||||
static void textbox_cursor_dec ( textbox *tb )
|
||||
static int textbox_cursor_dec ( textbox *tb )
|
||||
{
|
||||
int old = tb->cursor;
|
||||
textbox_cursor ( tb, tb->cursor - 1 );
|
||||
return ( old != tb->cursor );
|
||||
}
|
||||
|
||||
// Move word right
|
||||
|
@ -625,12 +633,10 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action )
|
|||
{
|
||||
// Left or Ctrl-b
|
||||
case MOVE_CHAR_BACK:
|
||||
textbox_cursor_dec ( tb );
|
||||
return 2;
|
||||
return (textbox_cursor_dec ( tb ) == TRUE)?2:0;
|
||||
// Right or Ctrl-F
|
||||
case MOVE_CHAR_FORWARD:
|
||||
textbox_cursor_inc ( tb );
|
||||
return 2;
|
||||
return (textbox_cursor_inc ( tb ) == TRUE)?2:0;
|
||||
// Ctrl-U: Kill from the beginning to the end of the line.
|
||||
case CLEAR_LINE:
|
||||
textbox_text ( tb, "" );
|
||||
|
|
Loading…
Reference in a new issue