Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 56db8bd8d2 | |||
| a32ef2ff53 | |||
| 0c0c3d9ce5 | |||
| 7245003769 | |||
| 542b1d90a0 | |||
| a359f4e6c4 | |||
| a03dd0c433 | |||
| 561faf537c | |||
| 3a36b35c1f | |||
|
|
b1cb2532f6 |
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
|
||||
project(ke C) # Specify C language explicitly
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(KE_VERSION "1.3.1")
|
||||
set(KE_VERSION "1.3.5")
|
||||
|
||||
set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wshadow -Werror -std=c99 -g")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -D_XOPEN_SOURCE")
|
||||
|
||||
3
Makefile
3
Makefile
@@ -3,8 +3,9 @@ KE_VERSION := devel
|
||||
DEST := $(HOME)/.local/bin/$(TARGET)
|
||||
|
||||
CFLAGS := -Wall -Wextra -pedantic -Wshadow -Werror -std=c99 -g
|
||||
CFLAGS += -Wno-unused-result
|
||||
CFLAGS += -D_DEFAULT_SOURCE -D_XOPEN_SOURCE
|
||||
CFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
||||
CFLAGS += -fsanitize=address -fno-omit-frame-pointer
|
||||
|
||||
LDFLAGS := -fsanitize=address
|
||||
|
||||
|
||||
@@ -16,3 +16,6 @@ To get verbose ASAN messages:
|
||||
export LSAN_OPTIONS=verbosity=1:log_threads=1
|
||||
|
||||
Released under an ISC license.
|
||||
|
||||
Started by following along with kilo:
|
||||
https://viewsourcecode.org/snaptoken/kilo/
|
||||
|
||||
27
default.nix
Normal file
27
default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
lib,
|
||||
installShellFiles,
|
||||
stdenv,
|
||||
...
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "ke";
|
||||
version = "1.3.5";
|
||||
|
||||
src = lib.cleanSource ./.;
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin
|
||||
cp ke $out/bin/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
installManPage ke.1
|
||||
'';
|
||||
}
|
||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1763835633,
|
||||
"narHash": "sha256-HzxeGVID5MChuCPESuC0dlQL1/scDKu+MmzoVBJxulM=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "050e09e091117c3d7328c7b2b7b577492c43c134",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
18
flake.nix
Normal file
18
flake.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
description = "Kyle's Text Editor";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs }:
|
||||
let
|
||||
pkgs = import nixpkgs { system = "x86_64-linux"; };
|
||||
in
|
||||
{
|
||||
packages.x86_64-linux = {
|
||||
default = pkgs.callPackage ./default.nix { };
|
||||
};
|
||||
};
|
||||
}
|
||||
33
ke.1
33
ke.1
@@ -19,21 +19,26 @@ is
|
||||
K-command mode is entered using C-k. This is taken from Wordstar and just
|
||||
so happens to be blessed with starting with a most excellent letter of
|
||||
grandeur. Many commands work with and without control; for example,
|
||||
saving a file can be done with either C-k s or C-k C-s.
|
||||
.Pp
|
||||
saving a file can be done with either C-k s or C-k C-s. Other commands work
|
||||
with ESC or CTRL.
|
||||
.Sh K-COMMANDS
|
||||
.Bl -tag -width xxxxxxxxxxxx -offset indent
|
||||
.It C-k BACKSPACE
|
||||
Delete from the cursor to the beginning of the line.
|
||||
.It C-k SPACE
|
||||
Toggle the mark.
|
||||
.It C-k d
|
||||
Delete from the cursor to the end of the line.
|
||||
.It C-k C-d
|
||||
Delete the entire link.
|
||||
Delete the entire line.
|
||||
.It C-k e
|
||||
Edit a new file. Also C-k C-e.
|
||||
.It C-k f
|
||||
Incremental find.
|
||||
.It C-k g
|
||||
Go to a specific line. Also C-k C-g.
|
||||
.It C-k l
|
||||
List the number of lines of code in a saved file.
|
||||
.It C-k m
|
||||
Run make(1).
|
||||
.It C-k q
|
||||
@@ -47,6 +52,28 @@ Yank the killring.
|
||||
.It C-k \[char92]
|
||||
Dump core.
|
||||
.El
|
||||
.Sh OTHER KEYBINDINGS
|
||||
.Bl -tag -width xxxxxxxxxxxx -offset indent
|
||||
.It C-l
|
||||
Refresh the display.
|
||||
.It C-s
|
||||
Incremental find.
|
||||
.It C-w
|
||||
Kill the region if the mark is set.
|
||||
.It C-y
|
||||
Yank the killring.
|
||||
.It ESC BACKSPACE
|
||||
Delete the previous word.
|
||||
.It ESC b
|
||||
Move to the previous word.
|
||||
.It ESC d
|
||||
Delete the next word.
|
||||
.It ESC f
|
||||
Move to the next word.
|
||||
.It ESC w
|
||||
Save the region (if the mark is set) to the killring.
|
||||
.It
|
||||
.El
|
||||
.Sh FIND
|
||||
The find operation is an incremental search. The up or left arrow keys will
|
||||
go to the previous result, while the down or right arrow keys will go to
|
||||
|
||||
337
main.c
337
main.c
@@ -2,11 +2,7 @@
|
||||
* kyle's editor
|
||||
*
|
||||
* first version is a run-through of the kilo editor walkthrough as a
|
||||
* set of guiderails. I've made a lot of changes and did some things
|
||||
* differently. keep an eye for for kte, kyle's text editor - the
|
||||
* rewrite that will be coming out... when it comes out.
|
||||
*
|
||||
* https://viewsourcecode.org/snaptoken/kilo/
|
||||
* set of guiderails. I've made a lot of changes.
|
||||
*/
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
@@ -21,9 +17,11 @@
|
||||
#include <string.h>
|
||||
#include <locale.h>
|
||||
#include <wchar.h>
|
||||
#include <wctype.h>
|
||||
#include <termios.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
#ifndef KE_VERSION
|
||||
@@ -154,6 +152,7 @@ void killring_append_char(unsigned char ch);
|
||||
void killring_prepend_char(unsigned char ch);
|
||||
void toggle_markset(void);
|
||||
int cursor_after_mark(void);
|
||||
void indent_region(void);
|
||||
|
||||
/* miscellaneous */
|
||||
void die(const char *s);
|
||||
@@ -789,6 +788,50 @@ kill_region(void)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
indent_region(void)
|
||||
{
|
||||
int start_row, end_row;
|
||||
int i;
|
||||
|
||||
if (!editor.mark_set) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (editor.mark_cury < editor.cury) {
|
||||
start_row = editor.mark_cury;
|
||||
end_row = editor.cury;
|
||||
} else if (editor.mark_cury > editor.cury) {
|
||||
start_row = editor.cury;
|
||||
end_row = editor.mark_cury;
|
||||
} else {
|
||||
start_row = end_row = editor.cury;
|
||||
}
|
||||
|
||||
/* Ensure bounds are valid */
|
||||
if (start_row < 0) {
|
||||
start_row = 0;
|
||||
}
|
||||
|
||||
if (end_row >= editor.nrows) {
|
||||
end_row = editor.nrows - 1;
|
||||
}
|
||||
|
||||
if (start_row >= editor.nrows || end_row < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Prepend a tab character to every row in the region */
|
||||
for (i = start_row; i <= end_row; i++) {
|
||||
row_insert_ch(&editor.row[i], 0, '\t');
|
||||
}
|
||||
|
||||
/* Move cursor to beginning of the line it was on */
|
||||
editor.curx = 0;
|
||||
editor.dirty++;
|
||||
}
|
||||
|
||||
|
||||
/* call after kill_region */
|
||||
void
|
||||
delete_region(void)
|
||||
@@ -827,8 +870,8 @@ delete_region(void)
|
||||
void
|
||||
die(const char *s)
|
||||
{
|
||||
write(STDOUT_FILENO, "\x1b[2J", 4);
|
||||
write(STDOUT_FILENO, "\x1b[H", 3);
|
||||
(void)write(STDOUT_FILENO, "\x1b[2J", 4);
|
||||
(void)write(STDOUT_FILENO, "\x1b[H", 3);
|
||||
|
||||
perror(s);
|
||||
exit(1);
|
||||
@@ -873,11 +916,13 @@ goto_line(void)
|
||||
if (lineno < 1 || lineno >= editor.nrows) {
|
||||
editor_set_status("Line number must be between 1 and %d.",
|
||||
editor.nrows);
|
||||
free(query);
|
||||
return;
|
||||
}
|
||||
|
||||
editor.cury = lineno - 1;
|
||||
editor.rowoffs = editor.cury - (editor.rows / 2);
|
||||
free(query);
|
||||
}
|
||||
|
||||
|
||||
@@ -1438,17 +1483,17 @@ get_keypress(void)
|
||||
char *
|
||||
editor_prompt(char *prompt, void (*cb)(char *, int16_t))
|
||||
{
|
||||
size_t bufsz = 128;
|
||||
char *buf = malloc(bufsz);
|
||||
size_t buflen = 0;
|
||||
int16_t c;
|
||||
size_t bufsz = 128;
|
||||
char *buf = malloc(bufsz);
|
||||
size_t buflen = 0;
|
||||
int16_t c;
|
||||
|
||||
buf[0] = '\0';
|
||||
|
||||
while (1) {
|
||||
editor_set_status(prompt, buf);
|
||||
display_refresh();
|
||||
while ((c = get_keypress()) <= 0) ;
|
||||
while ((c = get_keypress()) <= 0);
|
||||
if (c == DEL_KEY || c == CTRL_KEY('h') || c == BACKSPACE) {
|
||||
if (buflen != 0) {
|
||||
buf[--buflen] = '\0';
|
||||
@@ -1468,7 +1513,7 @@ editor_prompt(char *prompt, void (*cb)(char *, int16_t))
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
} else if ((c == TAB_KEY) || (c >= 0x20 && c != 0x7f)) {
|
||||
} else if ((c == TAB_KEY) || (c >= 0x20 && c < 0x7f)) {
|
||||
if (buflen == bufsz - 1) {
|
||||
bufsz *= 2;
|
||||
buf = realloc(buf, bufsz);
|
||||
@@ -1586,6 +1631,41 @@ editor_openfile(void)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
first_nonwhitespace(struct erow *row)
|
||||
{
|
||||
int pos;
|
||||
wchar_t wc;
|
||||
mbstate_t state;
|
||||
size_t len;
|
||||
|
||||
if (row == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
pos = 0;
|
||||
while (pos < row->size) {
|
||||
len = mbrtowc(&wc, &row->line[pos], row->size - pos, &state);
|
||||
if (len == (size_t) -1 || len == (size_t) -2) {
|
||||
/* Invalid or incomplete sequence, stop here */
|
||||
break;
|
||||
}
|
||||
if (len == 0) {
|
||||
/* Null character, stop here */
|
||||
break;
|
||||
}
|
||||
if (!iswspace(wc)) {
|
||||
/* Found non-whitespace character */
|
||||
break;
|
||||
}
|
||||
pos += len;
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
move_cursor(int16_t c)
|
||||
{
|
||||
@@ -1595,86 +1675,97 @@ move_cursor(int16_t c)
|
||||
row = (editor.cury >= editor.nrows) ? NULL : &editor.row[editor.cury];
|
||||
|
||||
switch (c) {
|
||||
case ARROW_UP:
|
||||
case CTRL_KEY('p'):
|
||||
if (editor.cury > 0) {
|
||||
editor.cury--;
|
||||
}
|
||||
break;
|
||||
case ARROW_DOWN:
|
||||
case CTRL_KEY('n'):
|
||||
if (editor.cury < editor.nrows) {
|
||||
editor.cury++;
|
||||
}
|
||||
break;
|
||||
case ARROW_RIGHT:
|
||||
case CTRL_KEY('f'):
|
||||
if (row && editor.curx < row->size) {
|
||||
case ARROW_UP:
|
||||
case CTRL_KEY('p'):
|
||||
if (editor.cury > 0) {
|
||||
editor.cury--;
|
||||
row = (editor.cury >= editor.nrows)
|
||||
? NULL
|
||||
: &editor.row[editor.cury];
|
||||
editor.curx = first_nonwhitespace(row);
|
||||
}
|
||||
break;
|
||||
case ARROW_DOWN:
|
||||
case CTRL_KEY('n'):
|
||||
if (editor.cury < editor.nrows) {
|
||||
editor.cury++;
|
||||
row = (editor.cury >= editor.nrows)
|
||||
? NULL
|
||||
: &editor.row[editor.cury];
|
||||
editor.curx = first_nonwhitespace(row);
|
||||
}
|
||||
break;
|
||||
case ARROW_RIGHT:
|
||||
case CTRL_KEY('f'):
|
||||
if (row && editor.curx < row->size) {
|
||||
editor.curx++;
|
||||
/* skip over UTF-8 continuation bytes */
|
||||
while (row && editor.curx < row->size &&
|
||||
((unsigned char) row->line[editor.curx] &
|
||||
0xC0) == 0x80) {
|
||||
editor.curx++;
|
||||
/* skip over UTF-8 continuation bytes */
|
||||
while (row && editor.curx < row->size &&
|
||||
((unsigned char) row->line[editor.curx] &
|
||||
0xC0) == 0x80) {
|
||||
editor.curx++;
|
||||
}
|
||||
} else if (row && editor.curx == row->size) {
|
||||
editor.cury++;
|
||||
editor.curx = 0;
|
||||
}
|
||||
break;
|
||||
case ARROW_LEFT:
|
||||
case CTRL_KEY('b'):
|
||||
if (editor.curx > 0) {
|
||||
} else if (row && editor.curx == row->size) {
|
||||
editor.cury++;
|
||||
row = (editor.cury >= editor.nrows)
|
||||
? NULL
|
||||
: &editor.row[editor.cury];
|
||||
editor.curx = first_nonwhitespace(row);
|
||||
}
|
||||
break;
|
||||
case ARROW_LEFT:
|
||||
case CTRL_KEY('b'):
|
||||
if (editor.curx > 0) {
|
||||
editor.curx--;
|
||||
/* move to the start byte if we landed on a continuation */
|
||||
while (editor.curx > 0 &&
|
||||
((unsigned char) row->line[editor.curx] &
|
||||
0xC0) == 0x80) {
|
||||
editor.curx--;
|
||||
/* move to the start byte if we landed on a continuation */
|
||||
while (editor.curx > 0 &&
|
||||
((unsigned char) row->line[editor.curx] &
|
||||
0xC0) == 0x80) {
|
||||
editor.curx--;
|
||||
}
|
||||
} else if (editor.cury > 0) {
|
||||
editor.cury--;
|
||||
editor.curx = editor.row[editor.cury].size;
|
||||
/* ensure at a codepoint boundary at end of previous line */
|
||||
row = &editor.row[editor.cury];
|
||||
while (editor.curx > 0 &&
|
||||
((unsigned char) row->line[editor.curx] &
|
||||
0xC0) == 0x80) {
|
||||
editor.curx--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PG_UP:
|
||||
case PG_DN:
|
||||
if (c == PG_UP) {
|
||||
editor.cury = editor.rowoffs;
|
||||
} else if (c == PG_DN) {
|
||||
editor.cury = editor.rowoffs + editor.rows - 1;
|
||||
if (editor.cury > editor.nrows) {
|
||||
editor.cury = editor.nrows;
|
||||
}
|
||||
}
|
||||
|
||||
reps = editor.rows;
|
||||
while (--reps) {
|
||||
move_cursor(c == PG_UP ? ARROW_UP : ARROW_DOWN);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case HOME_KEY:
|
||||
case CTRL_KEY('a'):
|
||||
editor.curx = 0;
|
||||
break;
|
||||
case END_KEY:
|
||||
case CTRL_KEY('e'):
|
||||
if (editor.nrows == 0) {
|
||||
break;
|
||||
}
|
||||
} else if (editor.cury > 0) {
|
||||
editor.cury--;
|
||||
editor.curx = editor.row[editor.cury].size;
|
||||
/* ensure at a codepoint boundary at end of previous line */
|
||||
row = &editor.row[editor.cury];
|
||||
while (editor.curx > 0 &&
|
||||
((unsigned char) row->line[editor.curx] &
|
||||
0xC0) == 0x80) {
|
||||
editor.curx--;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PG_UP:
|
||||
case PG_DN:
|
||||
if (c == PG_UP) {
|
||||
editor.cury = editor.rowoffs;
|
||||
} else if (c == PG_DN) {
|
||||
editor.cury = editor.rowoffs + editor.rows - 1;
|
||||
if (editor.cury > editor.nrows) {
|
||||
editor.cury = editor.nrows;
|
||||
}
|
||||
}
|
||||
|
||||
reps = editor.rows;
|
||||
while (--reps) {
|
||||
move_cursor(c == PG_UP ? ARROW_UP : ARROW_DOWN);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case HOME_KEY:
|
||||
case CTRL_KEY('a'):
|
||||
editor.curx = 0;
|
||||
break;
|
||||
case END_KEY:
|
||||
case CTRL_KEY('e'):
|
||||
if (editor.nrows == 0) {
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
editor.curx = editor.row[editor.cury].size;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1691,7 +1782,10 @@ newline(void)
|
||||
{
|
||||
struct erow *row = NULL;
|
||||
|
||||
if (editor.curx == 0) {
|
||||
if (editor.cury >= editor.nrows) {
|
||||
/* At or past end of file, insert empty line */
|
||||
erow_insert(editor.cury, "", 0);
|
||||
} else if (editor.curx == 0) {
|
||||
erow_insert(editor.cury, "", 0);
|
||||
} else {
|
||||
row = &editor.row[editor.cury];
|
||||
@@ -1714,30 +1808,50 @@ newline(void)
|
||||
char *
|
||||
get_cloc_code_lines(const char* filename)
|
||||
{
|
||||
// Build the shell command dynamically
|
||||
char command[512];
|
||||
char command[512];
|
||||
char buffer[256];
|
||||
char *result = NULL;
|
||||
FILE *pipe = NULL;
|
||||
size_t len = 0;
|
||||
|
||||
if (editor.filename == NULL) {
|
||||
snprintf(command, sizeof(command),
|
||||
"buffer has no associated file.");
|
||||
result = malloc((strnlen(command, sizeof(command))) + 1);
|
||||
assert(result != NULL);
|
||||
strcpy(result, command);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (editor.dirty) {
|
||||
snprintf(command, sizeof(command),
|
||||
"buffer must be saved first.");
|
||||
result = malloc((strnlen(command, sizeof(command))) + 1);
|
||||
assert(result != NULL);
|
||||
strcpy(result, command);
|
||||
return result;
|
||||
}
|
||||
|
||||
snprintf(command,
|
||||
sizeof(command),
|
||||
"cloc --quiet %s | tail -2 | head -1 | awk '{print $5}'",
|
||||
filename);
|
||||
|
||||
// Open a pipe to run the command
|
||||
FILE *pipe = popen(command, "r");
|
||||
pipe = popen(command, "r");
|
||||
if (!pipe) {
|
||||
return NULL; // Error opening pipe
|
||||
snprintf(command, sizeof(command), "Error getting LOC: %s", strerror(errno));
|
||||
result = (char *)malloc(sizeof(buffer) + 1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Read the output (single line/number)
|
||||
char buffer[256];
|
||||
if (fgets(buffer, sizeof(buffer), pipe) != NULL) {
|
||||
// Remove trailing newline
|
||||
size_t len = strlen(buffer);
|
||||
len = strlen(buffer);
|
||||
if (len > 0 && buffer[len - 1] == '\n') {
|
||||
buffer[len - 1] = '\0';
|
||||
}
|
||||
|
||||
// Allocate and copy the string
|
||||
char *result = malloc(strlen(buffer) + 1);
|
||||
result = malloc(strlen(buffer) + 1);
|
||||
assert(result != NULL);
|
||||
if (result) {
|
||||
strcpy(result, buffer);
|
||||
pclose(pipe);
|
||||
@@ -1745,7 +1859,6 @@ get_cloc_code_lines(const char* filename)
|
||||
}
|
||||
}
|
||||
|
||||
// On error or empty output, return "0"
|
||||
pclose(pipe);
|
||||
char *zero = malloc(2);
|
||||
if (zero) {
|
||||
@@ -1899,12 +2012,17 @@ process_normal(int16_t c)
|
||||
case ESC_KEY:
|
||||
editor.mode = MODE_ESCAPE;
|
||||
break;
|
||||
default:
|
||||
/* Insert any printable byte: ASCII 0x20–0x7E and all bytes >=0x80. */
|
||||
if ((c == TAB_KEY) || (c >= 0x20 && c != 0x7f)) {
|
||||
insertch(c);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (c == TAB_KEY) {
|
||||
if (editor.mark_set) {
|
||||
indent_region();
|
||||
} else {
|
||||
insertch(c);
|
||||
}
|
||||
} else if (c >= 0x20 && c != 0x7f) {
|
||||
insertch(c);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
editor.dirtyex = 1;
|
||||
@@ -2032,8 +2150,8 @@ void
|
||||
display_clear(struct abuf *ab)
|
||||
{
|
||||
if (ab == NULL) {
|
||||
write(STDOUT_FILENO, ESCSEQ "2J", 4);
|
||||
write(STDOUT_FILENO, ESCSEQ "H", 3);
|
||||
(void)write(STDOUT_FILENO, ESCSEQ "2J", 4);
|
||||
(void)write(STDOUT_FILENO, ESCSEQ "H", 3);
|
||||
} else {
|
||||
ab_append(ab, ESCSEQ "2J", 4);
|
||||
ab_append(ab, ESCSEQ "H", 3);
|
||||
@@ -2247,7 +2365,7 @@ display_refresh(void)
|
||||
/* ab_append(&ab, ESCSEQ "1;2H", 7); */
|
||||
ab_append(&ab, ESCSEQ "?25h", 6);
|
||||
|
||||
write(STDOUT_FILENO, ab.b, ab.len);
|
||||
(void)write(STDOUT_FILENO, ab.b, ab.len);
|
||||
ab_free(&ab);
|
||||
}
|
||||
|
||||
@@ -2290,7 +2408,6 @@ loop(void)
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
// Set locale for proper UTF-8 handling
|
||||
setlocale(LC_ALL, "");
|
||||
|
||||
setup_terminal();
|
||||
|
||||
Reference in New Issue
Block a user