1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Work on bug #73

This commit is contained in:
QC 2014-08-03 21:51:31 +02:00
parent 77a0a765ae
commit da69111a20
4 changed files with 106 additions and 33 deletions

View file

@ -253,6 +253,25 @@ the `-switchers` argument.
**rofi** website can be found at [here](https://davedavenport.github.io/rofi/) **rofi** website can be found at [here](https://davedavenport.github.io/rofi/)
## Keybinding
* `Ctrl-v, Insert`: Paste clipboard
* `Ctrl-Shift-v, Shift-Insert`: Paste primary selection
* `Ctrl-u`: Clear the line
* `Ctrl-a`: Beginning of line
* `Ctrl-e`: End of line
* `Ctrl-f, Right`: Forward one character
* `Ctrl-b, Left`: Back one character
* `Ctrl-d, Delete`: Delete character
* `Ctrl-h, Backspace`: Backspace (delete previous character)
* `Ctrl-j,Ctrl-m,Enter`: Accept entry
* `Ctrl-n,Down`: Select next entry
* `Ctrl-p,Up`: Select previous entry
* `Page Up`: Go to the previous page
* `Page Down`: Go to the next page
* `Ctrl-Page Up`: Go to the previous column
* `Ctrl-Page Down`: Go to the next column
## AUTHOR ## AUTHOR
Qball Cow <qball@gmpclient.org> Qball Cow <qball@gmpclient.org>

View file

@ -321,6 +321,41 @@ the \fB\fC\-switchers\fR argument.
\fBrofi\fP website can be found at here \fBrofi\fP website can be found at here
.UR https://davedavenport.github.io/rofi/ .UR https://davedavenport.github.io/rofi/
.UE .UE
.SH Keybinding
.RS
.IP \(bu 2
\fB\fCCtrl\-v, Insert\fR: Paste clipboard
.IP \(bu 2
\fB\fCCtrl\-Shift\-v, Shift\-Insert\fR: Paste primary selection
.IP \(bu 2
\fB\fCCtrl\-u\fR: Clear the line
.IP \(bu 2
\fB\fCCtrl\-a\fR: Beginning of line
.IP \(bu 2
\fB\fCCtrl\-e\fR: End of line
.IP \(bu 2
\fB\fCCtrl\-f, Right\fR: Forward one character
.IP \(bu 2
\fB\fCCtrl\-b, Left\fR: Back one character
.IP \(bu 2
\fB\fCCtrl\-d, Delete\fR: Delete character
.IP \(bu 2
\fB\fCCtrl\-h, Backspace\fR: Backspace (delete previous character)
.IP \(bu 2
\fB\fCCtrl\-j,Ctrl\-m,Enter\fR: Accept entry
.IP \(bu 2
\fB\fCCtrl\-n,Down\fR: Select next entry
.IP \(bu 2
\fB\fCCtrl\-p,Up\fR: Select previous entry
.IP \(bu 2
\fB\fCPage Up\fR: Go to the previous page
.IP \(bu 2
\fB\fCPage Down\fR: Go to the next page
.IP \(bu 2
\fB\fCCtrl\-Page Up\fR: Go to the previous column
.IP \(bu 2
\fB\fCCtrl\-Page Down\fR: Go to the next column
.RE
.SH AUTHOR .SH AUTHOR
.PP .PP
Qball Cow Qball Cow

View file

@ -1428,9 +1428,9 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
break; break;
} }
else{ else{
// Up or Shift-Tab // Up, Ctrl-p or Shift-Tab
if ( key == XK_Up || ( key == XK_Tab && ev.xkey.state & ShiftMask ) || if ( key == XK_Up || ( key == XK_Tab && ev.xkey.state & ShiftMask ) ||
( key == XK_k && ev.xkey.state & ControlMask ) ) { ( key == XK_p && ev.xkey.state & ControlMask ) ) {
if ( selected == 0 ) { if ( selected == 0 ) {
selected = filtered_lines; selected = filtered_lines;
} }
@ -1440,11 +1440,28 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
} }
update = TRUE; update = TRUE;
} }
// Down, Ctrl-n
else if ( key == XK_Down || else if ( key == XK_Down ||
( key == XK_j && ev.xkey.state & ControlMask ) ) { ( key == XK_n && ev.xkey.state & ControlMask ) ) {
selected = selected < filtered_lines - 1 ? MIN ( filtered_lines - 1, selected + 1 ) : 0; selected = selected < filtered_lines - 1 ? MIN ( filtered_lines - 1, selected + 1 ) : 0;
update = TRUE; update = TRUE;
} }
else if ( key == XK_Page_Up && ev.xkey.state & ControlMask ) {
if ( selected < max_rows ) {
selected = 0;
}
else{
selected -= max_rows;
}
update = TRUE;
}
else if ( key == XK_Page_Down && ev.xkey.state & ControlMask ) {
selected += max_rows;
if ( selected >= filtered_lines ) {
selected = filtered_lines - 1;
}
update = TRUE;
}
else if ( key == XK_Page_Up ) { else if ( key == XK_Page_Up ) {
if ( selected < max_elements ) { if ( selected < max_elements ) {
selected = 0; selected = 0;
@ -1462,22 +1479,6 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
} }
update = TRUE; update = TRUE;
} }
else if ( key == XK_h && ev.xkey.state & ControlMask ) {
if ( selected < max_rows ) {
selected = 0;
}
else{
selected -= max_rows;
}
update = TRUE;
}
else if ( key == XK_l && ev.xkey.state & ControlMask ) {
selected += max_rows;
if ( selected >= filtered_lines ) {
selected = filtered_lines - 1;
}
update = TRUE;
}
else if ( key == XK_Home || key == XK_KP_Home ) { else if ( key == XK_Home || key == XK_KP_Home ) {
selected = 0; selected = 0;
update = TRUE; update = TRUE;

View file

@ -368,30 +368,48 @@ int textbox_keypress ( textbox *tb, XEvent *ev )
len = Xutf8LookupString ( tb->xic, &ev->xkey, pad, sizeof ( pad ), &key, &stat ); len = Xutf8LookupString ( tb->xic, &ev->xkey, pad, sizeof ( pad ), &key, &stat );
pad[len] = 0; pad[len] = 0;
if ( key == XK_Left ) { // Left or Ctrl-b
textbox_cursor_dec ( tb ); if ( key == XK_Left ||
(( ev->xkey.state&ControlMask) && key == XK_b) ) {
textbox_cursor_dec ( tb );
return 1; return 1;
} }
else if ( key == XK_Right ) { // Right or Ctrl-F
else if ( key == XK_Right ||
(( ev->xkey.state&ControlMask) && key == XK_f) ) {
textbox_cursor_inc ( tb ); textbox_cursor_inc ( tb );
return 1; return 1;
} /*else if ( key == XK_Home ) { }
// Delete or Ctrl-D
textbox_cursor_home( tb ); else if ( key == XK_Delete ||
return 1; (( ev->xkey.state&ControlMask) && key == XK_d) ) {
} else if ( key == XK_End ) {
textbox_cursor_end( tb );
return 1;
} */
else if ( key == XK_Delete ) {
textbox_cursor_del ( tb ); textbox_cursor_del ( tb );
return 1; return 1;
} }
else if ( key == XK_BackSpace ) { // Ctrl-U: Kill from the beginning to the end of the line.
else if ( ( ev->xkey.state&ControlMask) && key == XK_u) {
textbox_text( tb, "");
return 1;
}
// Ctrl-A
else if ( ( ev->xkey.state&ControlMask) && key == XK_a) {
textbox_cursor ( tb, 0 );
return 1;
}
// Ctrl-E
else if ( ( ev->xkey.state&ControlMask) && key == XK_e) {
textbox_cursor_end ( tb );
return 1;
}
// BackSpace, Ctrl-h
else if ( key == XK_BackSpace ||
(( ev->xkey.state&ControlMask) && key == XK_h) ) {
textbox_cursor_bkspc ( tb ); textbox_cursor_bkspc ( tb );
return 1; return 1;
} }
else if ( key == XK_Return || key == XK_KP_Enter ) { else if ( key == XK_Return || key == XK_KP_Enter ||
((ev->xkey.state&ControlMask) && key == XK_j) ||
((ev->xkey.state&ControlMask) && key == XK_m)) {
return -1; return -1;
} }
else if ( !iscntrl ( *pad ) ) { else if ( !iscntrl ( *pad ) ) {