+ console_move_cursor( &vg_console.cursor_user, NULL, -1, 0 );
+}
+
+/* Match and receed both cursors */
+VG_STATIC void _console_left(void)
+{
+ int cursor_diff = vg_console.cursor_pos - vg_console.cursor_user? 0: 1;
+
+ console_move_cursor( &vg_console.cursor_user,
+ &vg_console.cursor_pos, -cursor_diff, 1 );
+}
+
+VG_STATIC void _console_right_select(void)
+{
+ console_move_cursor( &vg_console.cursor_user, NULL, 1, 0 );
+}
+
+VG_STATIC void _console_right(void)
+{
+ int cursor_diff = vg_console.cursor_pos - vg_console.cursor_user? 0: 1;
+
+ console_move_cursor( &vg_console.cursor_user,
+ &vg_console.cursor_pos, +cursor_diff, 1 );
+}
+
+VG_STATIC void _console_down(void)
+{
+ vg_console.history_pos = VG_MAX( 0, vg_console.history_pos-1 );
+ console_history_get( vg_console.input, vg_console.history_pos );
+
+ console_move_cursor( &vg_console.cursor_user,
+ &vg_console.cursor_pos,
+ vg_list_size( vg_console.input ), 1 );
+}
+
+VG_STATIC void _console_up(void)
+{
+ vg_console.history_pos = VG_MAX
+ (
+ 0,
+ VG_MIN
+ (
+ vg_console.history_pos+1,
+ VG_MIN
+ (
+ vg_list_size( vg_console.history ),
+ vg_console.history_count - 1
+ )
+ )
+ );
+
+ console_history_get( vg_console.input, vg_console.history_pos );
+ console_move_cursor( &vg_console.cursor_user,
+ &vg_console.cursor_pos,
+ vg_list_size( vg_console.input ), 1);
+}
+
+VG_STATIC void _console_backspace(void)
+{
+ vg_console.cursor_user = console_delete_char( -1 );
+ vg_console.cursor_pos = vg_console.cursor_user;
+}
+
+VG_STATIC void _console_delete(void)
+{
+ vg_console.cursor_user = console_delete_char( 1 );
+ vg_console.cursor_pos = vg_console.cursor_user;
+}
+
+VG_STATIC void _console_home_select(void)
+{
+ console_move_cursor( &vg_console.cursor_user, NULL, -10000, 0 );
+}
+
+VG_STATIC void _console_home(void)
+{
+ console_move_cursor( &vg_console.cursor_user,
+ &vg_console.cursor_pos, -10000, 1 );
+}
+
+VG_STATIC void _console_end_select(void)
+{
+ console_move_cursor( &vg_console.cursor_user, NULL, 10000, 0 );
+}
+
+VG_STATIC void _console_end(void)
+{
+ console_move_cursor( &vg_console.cursor_user,
+ &vg_console.cursor_pos,
+ vg_list_size( vg_console.input ), 1 );
+}
+
+VG_STATIC void _console_select_all(void)
+{
+ console_move_cursor( &vg_console.cursor_user, NULL, 10000, 0);
+ console_move_cursor( &vg_console.cursor_pos, NULL, -10000, 0);
+}
+
+VG_STATIC void _console_cut(void)
+{
+ console_to_clipboard();
+ vg_console.cursor_user = console_delete_char(0);
+ vg_console.cursor_pos = vg_console.cursor_user;
+}
+
+VG_STATIC void _console_enter(void)
+{
+ if( !strlen( vg_console.input ) )
+ return;
+
+ vg_info( "%s\n", vg_console.input );
+
+ if( strcmp( vg_console.input,
+ vg_console.history[ vg_console.history_last ]) )
+ {
+ vg_console.history_last = ( vg_console.history_last + 1) %
+ vg_list_size(vg_console.history );
+ vg_console.history_count =
+ VG_MIN( vg_list_size( vg_console.history ),
+ vg_console.history_count + 1 );
+ strcpy( vg_console.history[ vg_console.history_last ],
+ vg_console.input );
+ }
+
+ vg_console.history_pos = -1;
+ execute_console_input( vg_console.input );
+ console_move_cursor( &vg_console.cursor_user,
+ &vg_console.cursor_pos, -10000, 1 );
+ vg_console.input[0] = '\0';
+}
+
+VG_STATIC void console_proc_key( GLFWwindow* ptrW, int key, int scancode,
+ int action, int mods )
+{
+ if( !action )
+ return;