Skip to content

Commit 2a9f936

Browse files
committed
Enable reflow when supported
term reflow is supported since libvterm v0.3 1. echo a long line of text 2. reduce the window width to be shorter than the line of the text 3. increase the window width to the original size old behavior: the text is truncated and not recovered new behavior: the text is reflowed
1 parent 94e2b0b commit 2a9f936

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ if (USE_SYSTEM_LIBVTERM)
5151
if (${VTermSBClearExists} EQUAL "0")
5252
add_definitions(-DVTermSBClearNotExists)
5353
endif()
54+
execute_process(COMMAND grep -c "vterm_screen_enable_reflow" "${LIBVTERM_INCLUDE_DIR}/vterm.h" OUTPUT_VARIABLE VTermEnableReflowExists)
55+
if (${VTermEnableReflowExists} EQUAL "0")
56+
message(WARNING "System libvterm too old, reflow not supported")
57+
add_definitions(-DVTermEnableReflowNotExists)
58+
endif()
5459
else()
5560
message(STATUS "System libvterm not found: libvterm will be downloaded and compiled as part of the build process")
5661
endif()

vterm-module.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,6 +1242,9 @@ emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs, emacs_value args[],
12421242
vterm_screen_set_callbacks(term->vts, &vterm_screen_callbacks, term);
12431243
vterm_screen_set_damage_merge(term->vts, VTERM_DAMAGE_SCROLL);
12441244
vterm_screen_enable_altscreen(term->vts, true);
1245+
#ifndef VTermEnableReflowNotExists
1246+
vterm_screen_enable_reflow(term->vts, true);
1247+
#endif
12451248
term->sb_size = MIN(SB_MAX, sb_size);
12461249
term->sb_current = 0;
12471250
term->sb_pending = 0;

0 commit comments

Comments
 (0)