From 86789c5d84542b2f50348b4bad32da147cc6723c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 21 Oct 2016 08:30:18 +0530 Subject: [PATCH] Removed unused junk from the terminfo file --- kitty/screen.py | 27 +++++++++++++++++---------- pyte/escape.py | 4 ++-- pyte/streams.py | 4 ++-- terminfo/kitty.terminfo | 4 ---- terminfo/x/xterm-kitty | Bin 1829 -> 1777 bytes 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/kitty/screen.py b/kitty/screen.py index e073ff808..b583c8373 100644 --- a/kitty/screen.py +++ b/kitty/screen.py @@ -86,6 +86,15 @@ class Screen(QObject): def display(self) -> Sequence[str]: return tuple(map(str, self.linebuf)) + def toggle_screen_buffer(self): + self.save_cursor() + if self.linebuf is self.main_linebuf: + self.linebuf, self.savepoints = self.alt_linebuf, self.alt_savepoints + else: + self.linebuf, self.savepoints = self.main_linebuf, self.main_savepoints + self.restore_cursor() + self.update_screen() + def reset(self): """Resets the terminal to its initial state. @@ -102,6 +111,8 @@ class Screen(QObject): and tabstops should be reset as well, thanks to :manpage:`xterm` -- we now know that. """ + if self.linebuf is self.alt_linebuf: + self.toggle_screen_buffer() self.linebuf.clear() self.linebuf[:] = (Line(self.columns) for i in range(self.lines)) self.mode = {mo.DECAWM, mo.DECTCEM} @@ -117,10 +128,12 @@ class Screen(QObject): # set every `n` spaces when the terminal is powered up. Since # we aim to support VT102 / VT220 and linux -- we use n = 8. self.tabstops = set(range(7, self.columns, 8)) + self.normal_keypad_mode() self.cursor = Cursor(0, 0) self.cursor_changed(self.cursor) self.cursor_position() + self.update_screen() def resize(self, lines: int, columns: int): """Resize the screen to the given dimensions. @@ -225,10 +238,7 @@ class Screen(QObject): self.cursor_changed(self.cursor) if mo.ALTERNATE_SCREEN in self.mode and self.linebuf is self.main_linebuf: - self.save_cursor() - self.linebuf, self.savepoints = self.alt_linebuf, self.alt_savepoints - self.restore_cursor() - self.update_screen() + self.toggle_screen_buffer() @property def in_bracketed_paste_mode(self): @@ -274,10 +284,7 @@ class Screen(QObject): self.cursor_changed(self.cursor) if mo.ALTERNATE_SCREEN not in self.mode and self.linebuf is not self.main_linebuf: - self.save_cursor() - self.linebuf, self.savepoints = self.main_linebuf, self.main_savepoints - self.restore_cursor() - self.update_screen() + self.toggle_screen_buffer() def define_charset(self, code, mode): """Defines ``G0`` or ``G1`` charset. @@ -975,10 +982,10 @@ class Screen(QObject): else: # DECLL pass - def numeric_keypad_mode(self): + def normal_keypad_mode(self): pass # TODO: Implement this - def application_keypad_mode(self): + def alternate_keypad_mode(self): pass # TODO: Implement this def debug(self, *args, **kwargs): diff --git a/pyte/escape.py b/pyte/escape.py index 45daaec8c..7f039bc2a 100644 --- a/pyte/escape.py +++ b/pyte/escape.py @@ -39,10 +39,10 @@ DECSC = b"7" #: selection. If none were saved, move cursor to home position. DECRC = b"8" -#: Set numeric keypad mode +#: Set normal keypad mode DECPNM = b'>' -#: Set application keypad mode +#: Set alternate keypad mode DECPAM = b'=' # "Sharp" escape sequences. diff --git a/pyte/streams.py b/pyte/streams.py index cc308a1bc..77b469c1d 100644 --- a/pyte/streams.py +++ b/pyte/streams.py @@ -82,8 +82,8 @@ class Stream(object): esc.HTS: "set_tab_stop", esc.DECSC: "save_cursor", esc.DECRC: "restore_cursor", - esc.DECPNM: 'numeric_keypad_mode', - esc.DECPAM: 'application_keypad_mode', + esc.DECPNM: 'normal_keypad_mode', + esc.DECPAM: 'alternate_keypad_mode', } #: "sharp" escape sequences -- ``ESC # ``. diff --git a/terminfo/kitty.terminfo b/terminfo/kitty.terminfo index 9a1a9ee08..a87bcc3d2 100644 --- a/terminfo/kitty.terminfo +++ b/terminfo/kitty.terminfo @@ -53,7 +53,6 @@ xterm-kitty|KovIdTTY, indn=\E[%p1%dS, initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, invis=\E[8m, - is2=\E[!p\E[?3;4l\E[4l\E>, kbs=\177, kcub1=\EOD, kcud1=\EOB, @@ -93,12 +92,10 @@ xterm-kitty|KovIdTTY, rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, - rmkx=\E[?1l\E>, rmm=\E[?1034l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, - rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m, setaf=\E[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m, @@ -108,7 +105,6 @@ xterm-kitty|KovIdTTY, smam=\E[?7h, smcup=\E[?1049h, smir=\E[4h, - smkx=\E[?1h\E=, smm=\E[?1034h, smso=\E[7m, smul=\E[4m, diff --git a/terminfo/x/xterm-kitty b/terminfo/x/xterm-kitty index 4483239c24b6a140fbd55e648052210d711674c2..efd38d43ab10ce54787d548202b3971132bc8f9d 100644 GIT binary patch delta 296 zcmZ3=_mP)dicyq7hJl|UlkxCG?#+Jxq2LF@|Nno07zF+SX=X+U`~QD-Ms7wyMo~sd zMp;H>MomV2MpH&>Mth*V3lMuS`Z5Lq=`bLUWt_Z`QOYfmF$>7~|G${AhOw2gk8wKV z0>+h$n;3U99s!I0|9_V8BI7k6`!(ZU?B83v=^iUFP4Dtyr=rZ)K_4?8y3r5dcFskoN!p delta 345 zcmey!yOfVxicyq7hJl|UlkxjR?#)3z82*C+7vul`d_W8W0zg_6%Krafl2MjXnNgil zn^B+9l+l{ekQ3O!Z8Y z1sO&7TENmEB}bV~Gl5KJx(JkEN@e|jmFYH^#r*#vNJ5YA8Pi9mZ%qG~n3(_n=Vk_} z70U!N(Lo+a%89!KDpkR}eX=g|Z+^uB>1canYm*%5Xdt$mtjdzd4Wt=>qJ|mLwv+o< P>II_F6m8~aeZ~j?C3u%w