Beispiel #1
0
int rl_sdl_getc_hook()
{
	unsigned int c;
	c=0;
	
	if(cc.displaydevice->get_input(&c)==1)
	{

		if(c&(1<<31))
		{
			rl_set_keymap(rl_get_keymap_by_name("emacs-meta"));	/* FIXME : this is a dirty trick : */
			//c&=!(1<<31);		/* FIXME : a dirty trick */
			c&=0xFFFFFF^(1<<31);	/* FIXME : a dirty trick */
			//std::cout << "alt!  : "<< (unsigned char)c <<" !\n";
			//rl_stuff_char(c);	/* warning : this may fail */
			rl_stuff_char(c);	/* warning : this may fail */
		}
		else
		{
			rl_set_keymap(rl_get_keymap_by_name("emacs"));		/* FIXME : this is a dirty trick : */
			//std::cout << "char in : "<< (unsigned char)c <<" !\n";
			rl_stuff_char(c);	/* warning : this may fail */
		}
		return 1;	
	}
	return 0;	
}
Beispiel #2
0
Datei: tui.c Projekt: 0mp/freebsd
/* Leave the tui mode.
   Remove the tui hooks and configure the gdb output and readline
   back to their original state.  The curses mode is left so that
   the terminal setting is restored to the point when we entered.  */
void
tui_disable (void)
{
  if (!tui_active)
    return;

  /* Restore initial readline keymap.  */
  rl_set_keymap (tui_readline_standard_keymap);

  /* Remove TUI hooks.  */
  tui_remove_hooks ();
  rl_startup_hook = 0;
  rl_already_prompted = 0;

  /* Leave curses and restore previous gdb terminal setting.  */
  endwin ();

  /* gdb terminal has changed, update gdb internal copy of it
     so that terminal management with the inferior works.  */
  tui_setup_io (0);

  /* Update gdb's knowledge of its terminal.  */
  target_terminal_save_ours ();

  tui_active = 0;
  tui_update_gdb_sizes ();
}
Beispiel #3
0
void
readline_status_mode (cli_context_t *ctx, const keymap_entry_t map[])
{
	int i;
	Keymap stkmap;

	readline_cli_ctx = ctx;
	rl_callback_handler_install (NULL, &readline_status_callback);

	/* Backup current keymap-name */
	readline_keymap = g_strdup (rl_get_keymap_name (rl_get_keymap ()));

	/* New keymap for status mode */
	stkmap = rl_make_bare_keymap ();

	/* Fill out the keymap and display it. */
	g_printf ("\n");
	for (i = 0; map[i].keyseq; i++) {
		rl_set_key (map[i].keyseq,
		            rl_named_function (map[i].named_function),
		            stkmap);
		if (map[i].readable_keyseq) {
			g_printf ("   (%s) %s\n", map[i].readable_keyseq,
			          map[i].readable_function ? map[i].readable_function
			                                   : map[i].named_function);
		}
	}
	g_printf ("\n");

	rl_set_keymap (stkmap);
}
Beispiel #4
0
Datei: tui.c Projekt: 0mp/freebsd
/* Change the TUI key mode by installing the appropriate readline keymap.  */
void
tui_set_key_mode (enum tui_key_mode mode)
{
  tui_current_key_mode = mode;
  rl_set_keymap (mode == TUI_SINGLE_KEY_MODE
                 ? tui_keymap : tui_readline_standard_keymap);
  tui_show_locator_content ();
}
Beispiel #5
0
void
readline_status_mode_exit (void)
{
	Keymap active;

	g_assert (cli_context_in_status (readline_cli_ctx, CLI_ACTION_STATUS_REFRESH));

	active = rl_get_keymap ();

	rl_set_keymap (rl_get_keymap_by_name (readline_keymap));
	rl_discard_keymap (active);

	rl_callback_handler_remove ();
	g_free (readline_keymap);
	status_free (cli_context_status_entry (readline_cli_ctx)); // TODO: handle via cli_context_free or somesuch?
	cli_context_status_mode_exit (readline_cli_ctx);
}