repeat character command
This commit is contained in:
@@ -152,7 +152,6 @@ define maplookup
|
|||||||
$(patsubst $(strip $(1)):%,%,$(filter $(strip $(1)):%,$(2)))
|
$(patsubst $(strip $(1)):%,%,$(filter $(strip $(1)):%,$(2)))
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
||||||
#Include options and target specific to the OUTPUT_TYPE
|
#Include options and target specific to the OUTPUT_TYPE
|
||||||
include Makefile.$(OUTPUT_TYPE)
|
include Makefile.$(OUTPUT_TYPE)
|
||||||
|
|
||||||
@@ -203,13 +202,16 @@ espsize:
|
|||||||
espmac:
|
espmac:
|
||||||
$(Q) esptool --port /dev/ttyUSB0 read_mac
|
$(Q) esptool --port /dev/ttyUSB0 read_mac
|
||||||
|
|
||||||
all: checkdirs parser $(TARGET_OUT) $(FW_BASE)
|
all: checkdirs
|
||||||
|
$(Q) make actual_all -j4 -B
|
||||||
|
|
||||||
|
actual_all: parser $(TARGET_OUT) $(FW_BASE)
|
||||||
|
|
||||||
libesphttpd/Makefile:
|
libesphttpd/Makefile:
|
||||||
$(Q) [[ -e "libesphttpd/Makefile" ]] || echo -e "\e[31mlibesphttpd submodule missing.\nIf build fails, run \"git submodule init\" and \"git submodule update\".\e[0m"
|
$(Q) [[ -e "libesphttpd/Makefile" ]] || echo -e "\e[31mlibesphttpd submodule missing.\nIf build fails, run \"git submodule init\" and \"git submodule update\".\e[0m"
|
||||||
|
|
||||||
libesphttpd: libesphttpd/Makefile
|
libesphttpd: libesphttpd/Makefile
|
||||||
$(Q) make -C libesphttpd USE_OPENSDK=$(USE_OPENSDK) SERVERNAME_PREFIX="ESPTerm "
|
$(Q) make -C libesphttpd USE_OPENSDK=$(USE_OPENSDK) SERVERNAME_PREFIX="ESPTerm " -j4
|
||||||
|
|
||||||
$(APP_AR): libesphttpd $(OBJ)
|
$(APP_AR): libesphttpd $(OBJ)
|
||||||
$(vecho) "AR $@"
|
$(vecho) "AR $@"
|
||||||
@@ -217,6 +219,9 @@ $(APP_AR): libesphttpd $(OBJ)
|
|||||||
|
|
||||||
checkdirs: $(BUILD_DIR) html/favicon.ico
|
checkdirs: $(BUILD_DIR) html/favicon.ico
|
||||||
|
|
||||||
|
html/favicon.ico:
|
||||||
|
$(Q) [[ -e "html/favicon.ico" ]] || ./build_web.sh
|
||||||
|
|
||||||
$(BUILD_DIR):
|
$(BUILD_DIR):
|
||||||
$(Q) mkdir -p $@
|
$(Q) mkdir -p $@
|
||||||
|
|
||||||
|
|||||||
+1
-1
Submodule front-end updated: 79664f56a6...0a975e8801
+1
-2
@@ -244,8 +244,7 @@ switch_csi_Plain(CSI_Data *opts)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'b':
|
case 'b':
|
||||||
// TODO repeat preceding graphic character n1 times
|
screen_repeat_last_character(n1);
|
||||||
ansi_noimpl("Repeat char");
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Set X
|
// Set X
|
||||||
|
|||||||
+81
-46
@@ -61,6 +61,7 @@ static struct {
|
|||||||
int vm1;
|
int vm1;
|
||||||
|
|
||||||
u32 tab_stops[TABSTOP_WORDS]; // tab stops bitmap
|
u32 tab_stops[TABSTOP_WORDS]; // tab stops bitmap
|
||||||
|
char last_char[4];
|
||||||
} scr;
|
} scr;
|
||||||
|
|
||||||
#define R0 scr.vm0
|
#define R0 scr.vm0
|
||||||
@@ -995,7 +996,7 @@ screen_cursor_move(int dy, int dx, bool scroll)
|
|||||||
if (cursor.auto_wrap && cursor.reverse_wrap) {
|
if (cursor.auto_wrap && cursor.reverse_wrap) {
|
||||||
// this is mimicking a behavior from xterm that allows any number of steps backwards with reverse wraparound enabled
|
// this is mimicking a behavior from xterm that allows any number of steps backwards with reverse wraparound enabled
|
||||||
int steps = -cursor.x;
|
int steps = -cursor.x;
|
||||||
if(steps > 1000) steps = 1; // avoid something stupid causing infinite loop here
|
if(steps > W*H) steps = W*H; // avoid something stupid causing infinite loop here
|
||||||
for(;steps>0;steps--) {
|
for(;steps>0;steps--) {
|
||||||
if (cursor.x > 0) {
|
if (cursor.x > 0) {
|
||||||
// backspace should go to col 79 if "hanging" after 80 (as if it never actually left the 80th col)
|
// backspace should go to col 79 if "hanging" after 80 (as if it never actually left the 80th col)
|
||||||
@@ -1349,6 +1350,58 @@ screen_report_sgr(char *buffer)
|
|||||||
|
|
||||||
//region --- Printing ---
|
//region --- Printing ---
|
||||||
|
|
||||||
|
static const char *putchar_graphic(const char *ch)
|
||||||
|
{
|
||||||
|
if (cursor.hanging) {
|
||||||
|
// perform the scheduled wrap if hanging
|
||||||
|
// if auto-wrap = off, it overwrites the last char
|
||||||
|
if (cursor.auto_wrap) {
|
||||||
|
cursor.x = 0;
|
||||||
|
cursor.y++;
|
||||||
|
// Y wrap
|
||||||
|
if (cursor.y > R1) {
|
||||||
|
// Scroll up, so we have space for writing
|
||||||
|
screen_scroll_up(1);
|
||||||
|
cursor.y = R1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor.hanging = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Cell *c = &screen[cursor.x + cursor.y * W];
|
||||||
|
|
||||||
|
// move the rest of the line if we're in Insert Mode
|
||||||
|
if (cursor.x < W-1 && scr.insert_mode) screen_insert_characters(1);
|
||||||
|
|
||||||
|
if (ch[1] == 0 && ch[0] <= 0x7f) {
|
||||||
|
// we have len=1 and ASCII, can be re-mapped using a table
|
||||||
|
utf8_remap(c->c, ch[0], (cursor.charsetN == 0) ? cursor.charset0 : cursor.charset1);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// copy unicode char
|
||||||
|
strncpy(c->c, ch, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cursor.inverse) {
|
||||||
|
c->fg = cursor.bg;
|
||||||
|
c->bg = cursor.fg;
|
||||||
|
} else {
|
||||||
|
c->fg = cursor.fg;
|
||||||
|
c->bg = cursor.bg;
|
||||||
|
}
|
||||||
|
c->attrs = cursor.attrs;
|
||||||
|
|
||||||
|
cursor.x++;
|
||||||
|
// X wrap
|
||||||
|
if (cursor.x >= W) {
|
||||||
|
cursor.hanging = true; // hanging - next typed char wraps around, but backspace and arrows still stay on the same line.
|
||||||
|
cursor.x = W - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return c->c;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a character in the cursor color, move to right with wrap.
|
* Set a character in the cursor color, move to right with wrap.
|
||||||
*/
|
*/
|
||||||
@@ -1387,57 +1440,39 @@ screen_putchar(const char *ch)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cursor.hanging) {
|
const char *result = putchar_graphic(ch);
|
||||||
// perform the scheduled wrap if hanging
|
|
||||||
// if auto-wrap = off, it overwrites the last char
|
|
||||||
if (cursor.auto_wrap) {
|
|
||||||
cursor.x = 0;
|
|
||||||
cursor.y++;
|
|
||||||
// Y wrap
|
|
||||||
if (cursor.y > R1) {
|
|
||||||
// Scroll up, so we have space for writing
|
|
||||||
screen_scroll_up(1);
|
|
||||||
cursor.y = R1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor.hanging = false;
|
// Remember the resulting character
|
||||||
}
|
// If we re-mapped ASCII to high UTF, the following Repeat command will
|
||||||
}
|
// not have to call the remap function repeatedly.
|
||||||
|
strncpy(scr.last_char, result, 4);
|
||||||
Cell *c = &screen[cursor.x + cursor.y * W];
|
|
||||||
|
|
||||||
// move the rest of the line if we're in Insert Mode
|
|
||||||
if (cursor.x < W-1 && scr.insert_mode) screen_insert_characters(1);
|
|
||||||
|
|
||||||
if (ch[1] == 0 && ch[0] <= 0x7f) {
|
|
||||||
// we have len=1 and ASCII
|
|
||||||
utf8_remap(c->c, ch[0], (cursor.charsetN == 0) ? cursor.charset0 : cursor.charset1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// copy unicode char
|
|
||||||
strncpy(c->c, ch, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cursor.inverse) {
|
|
||||||
c->fg = cursor.bg;
|
|
||||||
c->bg = cursor.fg;
|
|
||||||
} else {
|
|
||||||
c->fg = cursor.fg;
|
|
||||||
c->bg = cursor.bg;
|
|
||||||
}
|
|
||||||
c->attrs = cursor.attrs;
|
|
||||||
|
|
||||||
cursor.x++;
|
|
||||||
// X wrap
|
|
||||||
if (cursor.x >= W) {
|
|
||||||
cursor.hanging = true; // hanging - next typed char wraps around, but backspace and arrows still stay on the same line.
|
|
||||||
cursor.x = W - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
NOTIFY_DONE();
|
NOTIFY_DONE();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repeat last graphic character
|
||||||
|
* @param count
|
||||||
|
*/
|
||||||
|
void ICACHE_FLASH_ATTR
|
||||||
|
screen_repeat_last_character(int count)
|
||||||
|
{
|
||||||
|
NOTIFY_LOCK();
|
||||||
|
if (scr.last_char[0]==0) {
|
||||||
|
scr.last_char[0] = ' ';
|
||||||
|
scr.last_char[1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count > W*H) count = W*H;
|
||||||
|
|
||||||
|
while (count > 0) {
|
||||||
|
putchar_graphic(scr.last_char);
|
||||||
|
count--;
|
||||||
|
}
|
||||||
|
NOTIFY_DONE();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UTF remap
|
* UTF remap
|
||||||
* @param out - output char[4]
|
* @param out - output char[4]
|
||||||
|
|||||||
@@ -302,6 +302,12 @@ void screen_putchar(const char *ch);
|
|||||||
*/
|
*/
|
||||||
void screen_fill_with_E(void);
|
void screen_fill_with_E(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Repeat last graphic character
|
||||||
|
* @param count
|
||||||
|
*/
|
||||||
|
void screen_repeat_last_character(int count);
|
||||||
|
|
||||||
// --- Queries ---
|
// --- Queries ---
|
||||||
|
|
||||||
/** Report current SGR as num;num;... for DAC query */
|
/** Report current SGR as num;num;... for DAC query */
|
||||||
|
|||||||
Reference in New Issue
Block a user