summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/keyb.h2
-rw-r--r--include/textbox.h20
-rw-r--r--source/dialogs/ssh.c2
-rw-r--r--source/helper.c2
-rw-r--r--source/keyb.c1
-rw-r--r--source/rofi.c36
-rw-r--r--source/textbox.c12
-rw-r--r--source/view.c1
8 files changed, 46 insertions, 30 deletions
diff --git a/include/keyb.h b/include/keyb.h
index 7fee420a..a375d08c 100644
--- a/include/keyb.h
+++ b/include/keyb.h
@@ -35,6 +35,8 @@ typedef enum
REMOVE_CHAR_FORWARD,
/** Remove previous character */
REMOVE_CHAR_BACK,
+ /** Remove till EOL */
+ REMOVE_TO_EOL,
/** Accept the current selected entry */
ACCEPT_ENTRY,
ACCEPT_ALT,
diff --git a/include/textbox.h b/include/textbox.h
index 94c981be..898f0ac4 100644
--- a/include/textbox.h
+++ b/include/textbox.h
@@ -39,16 +39,16 @@ typedef struct
typedef enum
{
- TB_AUTOHEIGHT = 1 << 0,
- TB_AUTOWIDTH = 1 << 1,
- TB_LEFT = 1 << 16,
- TB_RIGHT = 1 << 17,
- TB_CENTER = 1 << 18,
- TB_EDITABLE = 1 << 19,
- TB_MARKUP = 1 << 20,
- TB_WRAP = 1 << 21,
- TB_PASSWORD = 1 << 22,
- TB_INDICATOR = 1 << 23,
+ TB_AUTOHEIGHT = 1 << 0,
+ TB_AUTOWIDTH = 1 << 1,
+ TB_LEFT = 1 << 16,
+ TB_RIGHT = 1 << 17,
+ TB_CENTER = 1 << 18,
+ TB_EDITABLE = 1 << 19,
+ TB_MARKUP = 1 << 20,
+ TB_WRAP = 1 << 21,
+ TB_PASSWORD = 1 << 22,
+ TB_INDICATOR = 1 << 23,
} TextboxFlags;
typedef enum
diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c
index 9cc75543..331e5431 100644
--- a/source/dialogs/ssh.c
+++ b/source/dialogs/ssh.c
@@ -198,7 +198,7 @@ static char **read_hosts_file ( char ** retv, unsigned int *length )
// Reading one line per time.
while ( getline ( &buffer, &buffer_length, fd ) > 0 ) {
// Evaluate one line.
- unsigned int index = 0, ti = 0;
+ unsigned int index = 0, ti = 0;
char *token = buffer;
// Tokenize it.
diff --git a/source/helper.c b/source/helper.c
index 4c0f5bca..684256f8 100644
--- a/source/helper.c
+++ b/source/helper.c
@@ -197,7 +197,7 @@ GRegex **tokenize ( const char *input, int case_sensitive )
}
char *saveptr = NULL, *token;
- GRegex **retv = NULL;
+ GRegex **retv = NULL;
if ( !config.tokenize ) {
retv = g_malloc0 ( sizeof ( GRegex* ) * 2 );
retv[0] = (GRegex *) create_regex ( input, case_sensitive );
diff --git a/source/keyb.c b/source/keyb.c
index c8d21ea8..61961cc8 100644
--- a/source/keyb.c
+++ b/source/keyb.c
@@ -47,6 +47,7 @@ DefaultBinding bindings[NUM_ABE] =
{ .id = REMOVE_WORD_FORWARD, .name = "kb-remove-word-forward", .keybinding = "Control+Alt+d", .comment = "Delete next word" },
{ .id = REMOVE_CHAR_FORWARD, .name = "kb-remove-char-forward", .keybinding = "Delete,Control+d", .comment = "Delete next char" },
{ .id = REMOVE_CHAR_BACK, .name = "kb-remove-char-back", .keybinding = "BackSpace,Control+h", .comment = "Delete previous char" },
+ { .id = REMOVE_TO_EOL, .name = "kb-remove-to-eol", .keybinding = "Control+k", .comment = "Delete till the end of line" },
{ .id = ACCEPT_ENTRY, .name = "kb-accept-entry", .keybinding = "Control+j,Control+m,Return,KP_Enter", .comment = "Accept entry" },
{ .id = ACCEPT_CUSTOM, .name = "kb-accept-custom", .keybinding = "Control+Return", .comment = "Use entered text as command (in ssh/run modi)" },
{ .id = ACCEPT_ALT, .name = "kb-accept-alt", .keybinding = "Shift+Return", .comment = "Use alternate accept command." },
diff --git a/source/rofi.c b/source/rofi.c
index af19c87c..74b2f5f6 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -74,9 +74,9 @@ struct xkb_stuff xkb = {
.keymap = NULL,
.state = NULL,
.compose = {
- .table = NULL,
- .state = NULL
-}
+ .table = NULL,
+ .state = NULL
+ }
};
char *config_path = NULL;
// Array of modi.
@@ -441,22 +441,22 @@ static gboolean main_loop_x11_event_handler ( xcb_generic_event_t *ev, G_GNUC_UN
xkb.state = xkb_x11_state_new_from_device ( xkb.keymap, xcb->connection, xkb.device_id );
break;
case XCB_XKB_STATE_NOTIFY:
- {
- xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
- guint modmask;
- xkb_state_update_mask ( xkb.state,
- ksne->baseMods,
- ksne->latchedMods,
- ksne->lockedMods,
- ksne->baseGroup,
- ksne->latchedGroup,
- ksne->lockedGroup );
- modmask = x11_get_current_mask ( &xkb );
- if ( modmask == 0 ) {
- abe_trigger_release ( );
- }
- break;
+ {
+ xcb_xkb_state_notify_event_t *ksne = (xcb_xkb_state_notify_event_t *) ev;
+ guint modmask;
+ xkb_state_update_mask ( xkb.state,
+ ksne->baseMods,
+ ksne->latchedMods,
+ ksne->lockedMods,
+ ksne->baseGroup,
+ ksne->latchedGroup,
+ ksne->lockedGroup );
+ modmask = x11_get_current_mask ( &xkb );
+ if ( modmask == 0 ) {
+ abe_trigger_release ( );
}
+ break;
+ }
}
return G_SOURCE_CONTINUE;
}
diff --git a/source/textbox.c b/source/textbox.c
index 7eb2584b..733cd85d 100644
--- a/source/textbox.c
+++ b/source/textbox.c
@@ -535,6 +535,15 @@ static void textbox_cursor_bkspc_word ( textbox *tb )
}
}
}
+static void textbox_cursor_del_eol ( textbox *tb )
+{
+ if ( tb->cursor >= 0 ) {
+ int length = strlen ( tb->text ) - tb->cursor;
+ if ( length >= 0 ) {
+ textbox_delete ( tb, tb->cursor, length );
+ }
+ }
+}
static void textbox_cursor_del_word ( textbox *tb )
{
if ( tb->cursor >= 0 ) {
@@ -587,6 +596,9 @@ int textbox_keybinding ( textbox *tb, KeyBindingAction action )
case REMOVE_WORD_FORWARD:
textbox_cursor_del_word ( tb );
return 1;
+ case REMOVE_TO_EOL:
+ textbox_cursor_del_eol ( tb );
+ return 1;
// Delete or Ctrl-D
case REMOVE_CHAR_FORWARD:
textbox_cursor_del ( tb );
diff --git a/source/view.c b/source/view.c
index 263db655..15ed2c44 100644
--- a/source/view.c
+++ b/source/view.c
@@ -1438,6 +1438,7 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, KeyBindingAction actio
case CLEAR_LINE:
case MOVE_FRONT:
case MOVE_END:
+ case REMOVE_TO_EOL:
case REMOVE_WORD_BACK:
case REMOVE_WORD_FORWARD:
case REMOVE_CHAR_FORWARD: