From b3a1017a264cfea7e9ae1a374208e9b02efbda5a Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 9 Sep 2021 08:59:26 +1000 Subject: [PATCH 1/2] Remove scrolling detection/optimization in terminal output Just validate if line changed or not. This should avoid flickering on terminals such as the linux console that eagerly redraw on line deletions. Unfortunately this means drawing will use more data and might add a bit of latency on slow links. Fixes #4317 Fixes #4320 --- src/terminal_ui.cc | 88 ++++++++++++++-------------------------------- 1 file changed, 26 insertions(+), 62 deletions(-) diff --git a/src/terminal_ui.cc b/src/terminal_ui.cc index 67b21e7f..e9519cce 100644 --- a/src/terminal_ui.cc +++ b/src/terminal_ui.cc @@ -286,7 +286,7 @@ void TerminalUI::Screen::output(bool force, bool synchronized, Writer& writer) // iTerm2 "begin synchronized update" sequence if (synchronized) - writer.write("\033P=1s\033\\"); + writer.write("\033[?2026h"); if (force) { @@ -299,77 +299,41 @@ void TerminalUI::Screen::output(bool force, bool synchronized, Writer& writer) return (hash_value(line.atoms) << 1) | 1; // ensure non-zero }; - struct Change { int keep; int add; int del; }; - Vector changes{Change{}}; - auto new_hashes = ArrayView{lines.get(), (size_t)size.line} | transform(hash_line); - for_each_diff(hashes.get(), (int)size.line, - new_hashes.begin(), (int)size.line, - [&changes](DiffOp op, int len) mutable { - switch (op) - { - case DiffOp::Keep: - changes.push_back({len, 0, 0}); - break; - case DiffOp::Add: - changes.back().add += len; - break; - case DiffOp::Remove: - changes.back().del += len; - break; - } - }); - std::copy(new_hashes.begin(), new_hashes.end(), hashes.get()); - - int line = 0; - for (auto& change : changes) + for (int line = 0; line < (int)size.line; ++line) { - line += change.keep; - if (int del = change.del - change.add; del > 0) - { - format_with(writer, "\033[{}H\033[{}M", line + 1, del); - line -= del; - } - line += change.del; - } + auto hash = hash_line(lines[line]); + if (hash == hashes[line]) + continue; + hashes[line] = hash; - line = 0; - for (auto& change : changes) - { - line += change.keep; - for (int i = 0; i < change.add; ++i) - { - if (int add = change.add - change.del; i == 0 and add > 0) - format_with(writer, "\033[{}H\033[{}L", line + 1, add); - else - format_with(writer, "\033[{}H", line + 1); + format_with(writer, "\033[{}H", line + 1); - ColumnCount pending_move = 0; - for (auto& [text, skip, face] : lines[line++].atoms) + ColumnCount pending_move = 0; + for (auto& [text, skip, face] : lines[line].atoms) + { + if (text.empty() and skip == 0) + continue; + + if (pending_move != 0) { - if (text.empty() and skip == 0) - continue; - - if (pending_move != 0) - { - format_with(writer, "\033[{}C", (int)pending_move); - pending_move = 0; - } - set_face(face, writer); - writer.write(text); - if (skip > 3 and face.attributes == Attribute{}) - { - writer.write("\033[K"); - pending_move = skip; - } - else if (skip > 0) - writer.write(String{' ', skip}); + format_with(writer, "\033[{}C", (int)pending_move); + pending_move = 0; } + set_face(face, writer); + writer.write(text); + if (skip > 3 and face.attributes == Attribute{}) + { + writer.write("\033[K"); + pending_move = skip; + } + else if (skip > 0) + writer.write(String{' ', skip}); } } // iTerm2 "end synchronized update" sequence if (synchronized) - writer.write("\033P=2s\033\\"); + writer.write("\033[?2026l"); } constexpr int TerminalUI::default_shift_function_key; From c52b1a3f22155c76253f14f0a205d7e509ced67b Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Wed, 15 Sep 2021 14:18:02 +0300 Subject: [PATCH 2/2] travis: Drop TravisCI --- .travis.yml | 41 ----------------------------------------- README.asciidoc | 4 +--- 2 files changed, 1 insertion(+), 44 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 97d8ecb9..00000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -language: cpp - -sudo: false - -os: - - linux - - osx - -osx_image: xcode10.1 - -compiler: - - clang - - gcc - -env: - global: - - secure: "R+NxqtytOslIcQ/eCbLoZhImsgYdJnljfjANdieFQGune9ACPPQL0YanXkF49c9SWGBSxrAcute0egQzv2CU2+ivSQIX/xnMebKHiOmSPYBoxX+VgxLT3U1itUYlpYwixo9rF8UnGdlgXid6oENSiCvfWtNKoM2qOL0Ttw31J9E=" - -before_install: if [ "$CXX" = "g++" ]; then export CXX=g++-7; fi - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - libstdc++-7-dev - - g++-7 - - libncursesw5-dev - homebrew: - update: true - packages: gcc@7 - coverity_scan: - project: - name: "mawww/kakoune" - description: "Build submitted via Travis CI" - notification_email: frrrwww@gmail.com - build_command_prepend: "cd src && make clean" - build_command: "make -j4" - branch_pattern: coverity-scan - -script: cd src && make && make test diff --git a/README.asciidoc b/README.asciidoc index aad46634..492dc024 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1,9 +1,7 @@ -= image:{logo}[K,30,30,link="{website}",title="Kakoune logo by p0nce"] Kakoune image:{travis-img}[link="{travis-url}"] image:{cirrus-img}[link="{cirrus-url}"] image:{irc-img}[link="{irc-url}"] += image:{logo}[K,30,30,link="{website}",title="Kakoune logo by p0nce"] Kakoune image:{cirrus-img}[link="{cirrus-url}"] image:{irc-img}[link="{irc-url}"] ifdef::env-github,env-browser[:outfilesuffix: .asciidoc] :logo: https://rawgit.com/mawww/kakoune/master/doc/kakoune_logo.svg :website: https://kakoune.org -:travis-img: https://travis-ci.org/mawww/kakoune.svg?branch=master -:travis-url: https://travis-ci.org/mawww/kakoune :cirrus-img: https://api.cirrus-ci.com/github/mawww/kakoune.svg :cirrus-url: https://cirrus-ci.com/github/mawww/kakoune :irc-img: https://img.shields.io/badge/IRC-%23kakoune-blue.svg