@@ -2295,8 +2295,6 @@ class RadioBrowserSearchWindow(object):
2295
2295
2296
2296
_global_functions = {}
2297
2297
2298
- _backslash_pressed = False
2299
-
2300
2298
def __init__ (self ,
2301
2299
parent ,
2302
2300
config ,
@@ -2716,6 +2714,8 @@ def show(self, parent=None):
2716
2714
self ._widgets [- 1 ].bracket = False
2717
2715
self ._widgets [- 1 ].use_paste_mode = True
2718
2716
self ._widgets [- 1 ].set_global_functions (self ._global_functions )
2717
+ self ._widgets [- 1 ]._global_functions [ord ('0' )] = self ._goto_first_history_item
2718
+ self ._widgets [- 1 ]._global_functions [ord ('$' )] = self ._goto_last_history_item
2719
2719
#self._widgets[-1].string = self.captions[n]
2720
2720
2721
2721
''' limit - index = -3 '''
@@ -3069,34 +3069,27 @@ def keypress(self, char):
3069
3069
return - 1
3070
3070
3071
3071
if self ._too_small :
3072
- self ._backslash_pressed = False
3073
3072
return 1
3074
3073
3075
3074
if char == ord ('0' ) and \
3076
3075
class_name != 'SimpleCursesLineEdit' :
3077
3076
self ._goto_first_history_item ()
3078
- self ._backslash_pressed = False
3079
3077
3080
3078
elif char == ord ('$' ) and \
3081
3079
class_name != 'SimpleCursesLineEdit' :
3082
3080
self ._goto_last_history_item ()
3083
- self ._backslash_pressed = False
3084
3081
3085
3082
elif char in (curses .KEY_PPAGE , ) and self ._focus != len (self ._widgets ) - 3 :
3086
3083
self ._jump_history_up ()
3087
- self ._backslash_pressed = False
3088
3084
3089
3085
elif char in (curses .KEY_NPAGE , ) and self ._focus != len (self ._widgets ) - 3 :
3090
3086
self ._jump_history_down ()
3091
- self ._backslash_pressed = False
3092
3087
3093
3088
elif char in (ord ('\t ' ), 9 ):
3094
3089
self ._focus_next ()
3095
- self ._backslash_pressed = False
3096
3090
3097
3091
elif char in (curses .KEY_BTAB , ):
3098
3092
self ._focus_previous ()
3099
- self ._backslash_pressed = False
3100
3093
3101
3094
elif char in (ord (' ' ), curses .KEY_ENTER , ord ('\n ' ),
3102
3095
ord ('\r ' )) and self ._focus == len (self ._widgets ) - 1 :
@@ -3106,47 +3099,39 @@ def keypress(self, char):
3106
3099
elif char in (ord (' ' ), curses .KEY_ENTER , ord ('\n ' ),
3107
3100
ord ('\r ' )) and self ._focus == len (self ._widgets ) - 2 :
3108
3101
''' enter on ok button '''
3109
- self ._backslash_pressed = False
3110
3102
ret = self ._handle_new_or_existing_search_term ()
3111
3103
return 0 if ret == 1 else ret
3112
3104
3113
3105
elif char in (curses .ascii .SO , ):
3114
3106
''' ^N - Next history item '''
3115
3107
self ._ctrl_n ()
3116
- self ._backslash_pressed = False
3117
3108
3118
3109
elif char in (curses .ascii .DLE , ):
3119
3110
''' ^P - Previous history item '''
3120
3111
self ._ctrl_p ()
3121
- self ._backslash_pressed = False
3122
3112
3123
3113
# elif char in (curses.ascii.ETB, ):
3124
3114
elif char in (curses .ascii .ENQ , ):
3125
3115
''' ^E - Save search history '''
3126
- self ._backslash_pressed = False
3127
3116
self ._handle_new_or_existing_search_term ()
3128
3117
''' Save search history '''
3129
3118
return 5
3130
3119
3131
3120
elif char in (curses .ascii .EM , ):
3132
3121
''' ^Y - Add history item '''
3133
3122
self ._handle_new_or_existing_search_term ()
3134
- self ._backslash_pressed = False
3135
3123
3136
3124
elif char in (curses .ascii .CAN , ):
3137
3125
''' ^X - Delete history item '''
3138
3126
self ._ctrl_x ()
3139
- self ._backslash_pressed = False
3140
3127
3141
3128
elif char in (curses .ascii .STX , ):
3142
3129
''' ^B - Set default item '''
3143
3130
self ._ctrl_b ()
3144
- self ._backslash_pressed = False
3145
3131
3146
3132
elif char in (curses .ascii .ACK , ):
3147
3133
''' ^F - Go to template (item 0) '''
3148
3134
self ._ctrl_f ()
3149
- self ._backslash_pressed = False
3150
3135
3151
3136
else :
3152
3137
if class_name == 'SimpleCursesWidgetColumns' :
@@ -3157,10 +3142,8 @@ def keypress(self, char):
3157
3142
elif ret == 2 :
3158
3143
# cursor moved
3159
3144
self ._win .refresh ()
3160
- self ._backslash_pressed = False
3161
3145
3162
3146
elif self ._focus in self ._checkbox_to_enable_widgets :
3163
- self ._backslash_pressed = False
3164
3147
ret = self ._widgets [self ._focus ].keypress (char )
3165
3148
if not ret :
3166
3149
tp = list (self ._checkbox_to_enable_widgets )
@@ -3172,37 +3155,17 @@ def keypress(self, char):
3172
3155
return 1
3173
3156
3174
3157
elif class_name == 'SimpleCursesCheckBox' :
3175
- self ._backslash_pressed = False
3176
3158
ret = self ._widgets [self ._focus ].keypress (char )
3177
3159
if not ret :
3178
3160
return 1
3179
3161
3180
3162
elif class_name == 'SimpleCursesCounter' :
3181
- self ._backslash_pressed = False
3182
3163
ret = self ._widgets [self ._focus ].keypress (char )
3183
3164
if ret == 0 :
3184
3165
self ._win .refresh ()
3185
3166
return 1
3186
3167
3187
3168
elif class_name == 'SimpleCursesLineEdit' :
3188
- if char == ord ('\\ ' ):
3189
- self ._backslash_pressed = True
3190
- # return 1
3191
-
3192
- if self ._backslash_pressed :
3193
- if char in self ._global_functions .keys ():
3194
- self ._backslash_pressed = False
3195
- self ._global_functions [char ]()
3196
- return 1
3197
- elif char == ord ('0' ):
3198
- self ._backslash_pressed = False
3199
- self ._goto_first_history_item ()
3200
- return 1
3201
- elif char == ord ('$' ):
3202
- self ._backslash_pressed = False
3203
- self ._goto_last_history_item ()
3204
- return 1
3205
-
3206
3169
ret = self ._widgets [self ._focus ].keypress (self ._win , char )
3207
3170
if ret == - 1 :
3208
3171
# Cancel
@@ -3213,7 +3176,6 @@ def keypress(self, char):
3213
3176
elif ret < 2 :
3214
3177
return 1
3215
3178
3216
- self ._backslash_pressed = False
3217
3179
if char in (ord ('s' ), ):
3218
3180
''' prerform search '''
3219
3181
ret = self ._handle_new_or_existing_search_term ()
0 commit comments