mirror of
https://github.com/zoriya/ash.git
synced 2026-06-07 12:14:47 +00:00
Merge branch 'termios' of github.com:AnonymusRaccoon/ash into termios
This commit is contained in:
@@ -43,7 +43,8 @@ SRC = src/shell.c \
|
||||
src/key_bindings/control_commands.c \
|
||||
src/key_bindings/move_commands.c \
|
||||
src/my_ncurses/my_ncurses.c \
|
||||
src/my_ncurses/string_utils.c
|
||||
src/my_ncurses/string_utils.c \
|
||||
src/my_ncurses/pause_utils.c
|
||||
|
||||
OBJ = $(SRC:%.c=%.o)
|
||||
OBJ += src/main.o
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
typedef struct
|
||||
{
|
||||
struct termios old_termios;
|
||||
struct termios saved_termios;
|
||||
int x;
|
||||
int y;
|
||||
int w;
|
||||
@@ -65,4 +66,7 @@ my_addstr(window, str))
|
||||
|
||||
|
||||
#define my_clrtoeol() (printf("\x1B[K"))
|
||||
#define my_clrtobot() (printf("\x1B[J"))
|
||||
#define my_clrtobot() (printf("\x1B[J"))
|
||||
|
||||
void my_npause(my_window *window);
|
||||
void my_nresume(my_window *window);
|
||||
@@ -64,7 +64,9 @@ int newline_command(int key, buffer_t *buffer, env_t *env)
|
||||
my_addstr(env->window, "\n");
|
||||
if (buffer->buffer) {
|
||||
add_to_history(buffer->buffer, env);
|
||||
my_npause(env->window);
|
||||
ret = eval_raw_cmd(buffer->buffer, env);
|
||||
my_nresume(env->window);
|
||||
buffer->buffer[0] = '\0';
|
||||
buffer->pos = 0;
|
||||
my_getcuryx(&env->window->y, &env->window->x);
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
** EPITECH PROJECT, 2020
|
||||
** ash
|
||||
** File description:
|
||||
** pause_utils
|
||||
*/
|
||||
|
||||
#include "my_ncurses.h"
|
||||
#include <stddef.h>
|
||||
|
||||
void my_npause(my_window *window)
|
||||
{
|
||||
tcgetattr(0, &window->saved_termios);
|
||||
tcsetattr(0, TCSANOW, &window->old_termios);
|
||||
}
|
||||
|
||||
void my_nresume(my_window *window)
|
||||
{
|
||||
tcsetattr(0, TCSANOW, &window->saved_termios);
|
||||
}
|
||||
Reference in New Issue
Block a user