termpty: correctly handle wrap (DECAWM)

This commit is contained in:
Boris Faure 2018-12-28 17:41:33 +01:00
parent a95bbbe731
commit a940556cff
4 changed files with 52 additions and 3 deletions

View File

@ -329,7 +329,7 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b,
mode);
break;
case 7:
DBG("set wrap mode to %i", mode);
DBG("DECAWM: set/reset wrap mode to %i", mode);
ty->termstate.wrap = mode;
break;
case 8:

View File

@ -258,7 +258,6 @@ termpty_text_append(Termpty *ty, const Eina_Unicode *codepoints, int len)
{
ty->cursor_state.cx = max_right - offset;
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, max_right);
return;
}
TERMPTY_RESTRICT_FIELD(ty->cursor_state.cx, 0, max_right);
}

49
tests/decawm.sh Executable file
View File

@ -0,0 +1,49 @@
#!/bin/sh
#set color
printf '\033[46;31;3m'
# fill space with E
printf '\033#8'
# set wrap mode
printf '\033[?7h'
# move to 1; 75
printf '\033[1;75Habcdefghijkl'
# reset wrap mode
printf '\033[?7l'
# move to 3; 75
printf '\033[3;75Habcdefghijkl'
# set top/bottom margins:
printf '\033[10;20r'
# allow left/right margins
printf '\033[?69h'
# set left/right margins:
printf '\033[5;15s'
# fill margin with @
printf '\033[64;10;5;20;15$x'
# set wrap mode
printf '\033[?7h'
# move
printf '\033[12;12Habcdefghijkl'
# reset wrap mode
printf '\033[?7l'
# move
printf '\033[15;12Habcdefghijkl'
# set left/right margins:
printf '\033[25;35s'
# fill margin with @
printf '\033[64;10;25;20;35$x'
# restrict cursor
printf '\033[?6h'
# set wrap mode
printf '\033[?7h'
# move
printf '\033[2;5Habcdefghijkl'
# reset wrap mode
printf '\033[?7l'
# move
printf '\033[5;5Habcdefghijkl'

View File

@ -35,4 +35,5 @@ dch.sh 40cf655681c098251f0dc3e7733c4db9
cnl.sh 1f1512179c8e47e4bd880142774a3c66
cpl.sh 9145c88adb762a6a59c5bf69191b949e
cup.sh 11f5939a6cc990f6a7b9d1730ab3a8bf
decaln.sh 38ca494fb468752d510daff797f7c40c
decaln.sh 9c0cf4de336193bcdaed6ba6c0d6f590
decawm.sh 84321e76f07b40cf9462238ec0919dc0