Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable reflow when supported #688

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ if (USE_SYSTEM_LIBVTERM)
if (${VTermSBClearExists} EQUAL "0")
add_definitions(-DVTermSBClearNotExists)
endif()
execute_process(COMMAND grep -c "vterm_screen_enable_reflow" "${LIBVTERM_INCLUDE_DIR}/vterm.h" OUTPUT_VARIABLE VTermEnableReflowExists)
if (${VTermEnableReflowExists} EQUAL "0")
message(WARNING "System libvterm too old, reflow not supported")
add_definitions(-DVTermEnableReflowNotExists)
endif()
else()
message(STATUS "System libvterm not found: libvterm will be downloaded and compiled as part of the build process")
endif()
Expand Down
7 changes: 6 additions & 1 deletion vterm-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ static int term_sb_push(int cols, const VTermScreenCell *cells, void *data) {
sbrow->info = term->lines[0];
memmove(term->lines, term->lines + 1,
sizeof(term->lines[0]) * (term->lines_len - 1));
if (term->resizing) {
if (term->resizing &&
term->height_resize < 0 &&
term->lines_len + term->height_resize > term->height) {
/* pushed by window height decr */
if (term->lines[term->lines_len - 1] != NULL) {
/* do not need free here ,it is reused ,we just need set null */
Expand Down Expand Up @@ -1242,6 +1244,9 @@ emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs, emacs_value args[],
vterm_screen_set_callbacks(term->vts, &vterm_screen_callbacks, term);
vterm_screen_set_damage_merge(term->vts, VTERM_DAMAGE_SCROLL);
vterm_screen_enable_altscreen(term->vts, true);
#ifndef VTermEnableReflowNotExists
vterm_screen_enable_reflow(term->vts, true);
#endif
term->sb_size = MIN(SB_MAX, sb_size);
term->sb_current = 0;
term->sb_pending = 0;
Expand Down