Compare commits
	
		
			3 Commits
		
	
	
		
			9a996c8440
			...
			8529f24a46
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8529f24a46 | |||
| 190e813d49 | |||
| 9af74259d2 | 
							
								
								
									
										2
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								NEWS
									
									
									
									
									
								
							| @ -4,6 +4,8 @@ Unreleased | ||||
| 
 | ||||
|  * Implemented mouse drags on the elapsed time gauge and the scrollbar | ||||
| 
 | ||||
|  * Added Tab and S-Tab bindings to iterate tabs | ||||
| 
 | ||||
|  * Added a "z" binding to center the view on the selected item | ||||
| 
 | ||||
|  * Added a "?" binding to describe items in various tabs | ||||
|  | ||||
							
								
								
									
										49
									
								
								nncmpp.c
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								nncmpp.c
									
									
									
									
									
								
							| @ -2948,6 +2948,8 @@ g_normal_defaults[] = | ||||
| 	{ "C-l",        ACTION_REDRAW             }, | ||||
| 	{ "M-Tab",      ACTION_TAB_LAST           }, | ||||
| 	{ "F1",         ACTION_TAB_HELP           }, | ||||
| 	{ "S-Tab",      ACTION_TAB_PREVIOUS       }, | ||||
| 	{ "Tab",        ACTION_TAB_NEXT           }, | ||||
| 	{ "C-Left",     ACTION_TAB_PREVIOUS       }, | ||||
| 	{ "C-Right",    ACTION_TAB_NEXT           }, | ||||
| 	{ "C-PageUp",   ACTION_TAB_PREVIOUS       }, | ||||
| @ -3108,9 +3110,28 @@ app_init_bindings (const char *keymap, | ||||
| 	return a; | ||||
| } | ||||
| 
 | ||||
| static char * | ||||
| app_strfkey (const termo_key_t *key) | ||||
| { | ||||
| 	// For display purposes, this is highly desirable
 | ||||
| 	int flags = termo_get_flags (g.tk); | ||||
| 	termo_set_flags (g.tk, flags | TERMO_FLAG_SPACESYMBOL); | ||||
| 	termo_key_t fixed = *key; | ||||
| 	termo_canonicalise (g.tk, &fixed); | ||||
| 	termo_set_flags (g.tk, flags); | ||||
| 
 | ||||
| 	char buf[16] = ""; | ||||
| 	termo_strfkey_utf8 (g.tk, buf, sizeof buf, &fixed, TERMO_FORMAT_ALTISMETA); | ||||
| 	return xstrdup (buf); | ||||
| } | ||||
| 
 | ||||
| static bool | ||||
| app_process_termo_event (termo_key_t *event) | ||||
| { | ||||
| 	char *formatted = app_strfkey (event); | ||||
| 	print_debug ("%s", formatted); | ||||
| 	free (formatted); | ||||
| 
 | ||||
| 	bool handled = false; | ||||
| 	if ((handled = event->type == TERMO_TYPE_FOCUS)) | ||||
| 	{ | ||||
| @ -4162,21 +4183,6 @@ help_tab_on_action (enum action action) | ||||
| 	return app_process_action (a), true; | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| help_tab_strfkey (const termo_key_t *key, struct strv *out) | ||||
| { | ||||
| 	// For display purposes, this is highly desirable
 | ||||
| 	int flags = termo_get_flags (g.tk); | ||||
| 	termo_set_flags (g.tk, flags | TERMO_FLAG_SPACESYMBOL); | ||||
| 	termo_key_t fixed = *key; | ||||
| 	termo_canonicalise (g.tk, &fixed); | ||||
| 	termo_set_flags (g.tk, flags); | ||||
| 
 | ||||
| 	char buf[16]; | ||||
| 	termo_strfkey_utf8 (g.tk, buf, sizeof buf, &fixed, TERMO_FORMAT_ALTISMETA); | ||||
| 	strv_append (out, buf); | ||||
| } | ||||
| 
 | ||||
| static void | ||||
| help_tab_assign_action (enum action action) | ||||
| { | ||||
| @ -4198,7 +4204,7 @@ help_tab_group (struct binding *keys, size_t len, struct strv *out, | ||||
| 		struct strv ass = strv_make (); | ||||
| 		for (size_t k = 0; k < len; k++) | ||||
| 			if (keys[k].action == i) | ||||
| 				help_tab_strfkey (&keys[k].decoded, &ass); | ||||
| 				strv_append_owned (&ass, app_strfkey (&keys[k].decoded)); | ||||
| 		if (ass.len) | ||||
| 		{ | ||||
| 			char *joined = strv_join (&ass, ", "); | ||||
| @ -5947,6 +5953,7 @@ x11_convert_keysym (KeySym keysym) | ||||
| 	{ | ||||
| 	case XK_BackSpace:     return TERMO_SYM_BACKSPACE; | ||||
| 	case XK_Tab:           return TERMO_SYM_TAB; | ||||
| 	case XK_ISO_Left_Tab:  return TERMO_SYM_TAB; | ||||
| 	case XK_Return:        return TERMO_SYM_ENTER; | ||||
| 	case XK_Escape:        return TERMO_SYM_ESCAPE; | ||||
| 
 | ||||
| @ -6057,8 +6064,14 @@ on_x11_keypress (XEvent *e) | ||||
| 			memcpy (k.multibyte, p, MIN (cp_len, sizeof k.multibyte - 1)); | ||||
| 			p += cp_len; | ||||
| 
 | ||||
| 			// This is unfortunate, but probably in the right place.
 | ||||
| 			if (cp >= 32) | ||||
| 			// This is all unfortunate, but probably in the right place.
 | ||||
| 			if (!cp) | ||||
| 			{ | ||||
| 				k.code.codepoint = ' '; | ||||
| 				if (ev->state & ShiftMask) | ||||
| 					k.modifiers |= TERMO_KEYMOD_SHIFT; | ||||
| 			} | ||||
| 			else if (cp >= 32) | ||||
| 				k.code.codepoint = cp; | ||||
| 			else if (ev->state & ShiftMask) | ||||
| 				k.code.codepoint = cp + 64; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user