Assembled 2
A column based text editor
Loading...
Searching...
No Matches
Classes | Macros | Functions
keyboard.c File Reference
#include <includes.h>
#include <editor/buffer/buffer.h>
#include <editor/keyboard.h>
#include <editor/config.h>
#include <interface/interface.h>
#include <global.h>
#include <stdio.h>

Classes

struct  AS_KeySeqList
 
struct  AS_KeySeq
 
struct  AS_KeyStackElem
 

Macros

#define MAX_FUNCTION_COUNT   256
 Maximum number of functions.
 
#define PARAM2(a, b)   { a, b },
 

Functions

void collapse_stack ()
 
void key (int c)
 
struct AS_CfgTokconfigure_keyboard (struct AS_CfgTok *token)
 

Detailed Description

Author
awewsomegamer awews.nosp@m.omeg.nosp@m.amer@.nosp@m.gmai.nosp@m.l.com

LICENSE

Assembled - Column based text editor Copyright (C) 2023-2024 awewsomegamer

This file is apart of Assembled.

Assembled is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

DESCRIPTION

Responsible for handling all keyboard input and determining when the user has entered a key sequence for the active screen to preform an action.

Function Documentation

◆ collapse_stack()

void collapse_stack ( )

Collapse or interpret the current key stack.

This function looks from the current key_stack_ptr to 0 seeing if it can detect an AS_KeySeq within it. If it can, the stack pointer is set to 0, and the active screen's local function is called. In the event that it detects the beginnings of a key sequence (that is not yet complete), it will return, leaving the stack pointer intact. Otherwise, it will default to calling LOCAL_BUFFER_CHAR with the character at the stack pointer.

◆ configure_keyboard()

struct AS_CfgTok * configure_keyboard ( struct AS_CfgTok * token)

Configure the keyboard.

This function is invoked by config.c's interpret_token_stream function. It is given the current element within within the token list. The token must be of type AS_CFG_TOKEN_KEY with a value of AS_CFG_LOOKUP_KEYBOARD.

Parameters
structAS_CfgTok *token - The token from which to start interpretation.
Returns
A pointer to the beginning of the next set of tokens.

◆ key()

void key ( int c)

Acknowledge keyboard input.

Place the given character onto the key_stack at key_stack_ptr. Then try to collapse the stack.

Parameters
intc - Character to acknowledge.