mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-03 04:23:42 -05:00
Make dmenu mode behave more like dmenu
This commit is contained in:
parent
39b25093bd
commit
c32e18b600
7 changed files with 12 additions and 11 deletions
|
@ -118,8 +118,9 @@ SwitcherMode dmenu_switcher_dialog ( char **input )
|
|||
retv = DMENU_DIALOG;
|
||||
} else if ( n >=0 && list[n] != NULL ) {
|
||||
fputs( list[n],stdout );
|
||||
} else if ( n == -3 && *input != NULL && *input[0] != '\0' ) {
|
||||
fputs( *input, stdout );
|
||||
}
|
||||
|
||||
for ( unsigned int i=0; list[i] != NULL; i++ ) {
|
||||
free( list[i] );
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ SwitcherMode mark_switcher_dialog ( char **input )
|
|||
}
|
||||
|
||||
int shift=0;
|
||||
int n = menu( cmd_list, input, "mark ", NULL, &shift,token_match, NULL );
|
||||
int n = menu( cmd_list, input, "mark:", NULL, &shift,token_match, NULL );
|
||||
|
||||
if ( n == -2 ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
|
@ -178,7 +178,7 @@ SwitcherMode profile_switcher_dialog ( char **input )
|
|||
}
|
||||
|
||||
int shift=0;
|
||||
int n = menu( cmd_list, input, "profile ", NULL, &shift,token_match, NULL );
|
||||
int n = menu( cmd_list, input, "profile:", NULL, &shift,token_match, NULL );
|
||||
|
||||
if ( n == -2 ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
|
@ -247,7 +247,7 @@ SwitcherMode run_switcher_dialog ( char **input )
|
|||
}
|
||||
|
||||
int shift=0;
|
||||
int n = menu( cmd_list, input, "$ ", NULL, &shift,token_match, NULL );
|
||||
int n = menu( cmd_list, input, "$", NULL, &shift,token_match, NULL );
|
||||
|
||||
if ( n == -2 ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
|
@ -1130,7 +1130,7 @@ SwitcherMode run_switcher_window ( char **input )
|
|||
}
|
||||
}
|
||||
Time time;
|
||||
int n = menu( list, input, "> ", &time, NULL,window_match, ids );
|
||||
int n = menu( list, input, ">", &time, NULL,window_match, ids );
|
||||
|
||||
if ( n == -2 ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
|
@ -245,7 +245,7 @@ SwitcherMode ssh_switcher_dialog ( char **input )
|
|||
}
|
||||
|
||||
int shift=0;
|
||||
int n = menu( cmd_list, input, "ssh ", NULL, &shift,token_match, NULL );
|
||||
int n = menu( cmd_list, input, "ssh", NULL, &shift,token_match, NULL );
|
||||
|
||||
if ( n == -2 ) {
|
||||
retv = NEXT_DIALOG;
|
||||
|
|
|
@ -112,9 +112,9 @@ void textbox_font( textbox *tb, char *font, char *fg, char *bg )
|
|||
// outer code may need line height, width, etc
|
||||
void textbox_extents( textbox *tb )
|
||||
{
|
||||
int length = strlen( tb->text ) + strlen( tb->prompt );
|
||||
int length = strlen( tb->text ) + strlen( tb->prompt) +1;
|
||||
char *line = alloca( length + 1 );
|
||||
sprintf( line, "%s%s", tb->prompt, tb->text );
|
||||
sprintf( line, "%s %s", tb->prompt, tb->text );
|
||||
XftTextExtents8( display, tb->font, ( unsigned char* )line, length, &tb->extents );
|
||||
}
|
||||
|
||||
|
@ -220,12 +220,12 @@ void textbox_draw( textbox *tb )
|
|||
int cursor_width = MAX( 2, line_height/10 );
|
||||
|
||||
if ( tb->flags & TB_EDITABLE ) {
|
||||
int prompt_len = strlen( prompt );
|
||||
int prompt_len = strlen( prompt ) +1;
|
||||
length = text_len + prompt_len;
|
||||
cursor_offset = MIN( tb->cursor + prompt_len, length );
|
||||
|
||||
line = alloca( length + 10 );
|
||||
sprintf( line, "%s%s", prompt, text );
|
||||
sprintf( line, "%s %s", prompt, text );
|
||||
|
||||
// replace spaces so XftTextExtents8 includes their width
|
||||
for ( i = 0; i < length; i++ ) if ( isspace( line[i] ) ) line[i] = '_';
|
||||
|
@ -235,7 +235,7 @@ void textbox_draw( textbox *tb )
|
|||
cursor_x = extents.width;
|
||||
|
||||
// restore correct text string with spaces
|
||||
sprintf( line, "%s%s", prompt, text );
|
||||
sprintf( line, "%s %s", prompt, text );
|
||||
}
|
||||
|
||||
// calc full input text width
|
||||
|
|
Loading…
Reference in a new issue