update packages
This commit is contained in:
@@ -51,6 +51,10 @@ 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 VTermScreenEnableReflowExists)
|
||||
if (${VTermScreenEnableReflowExists} EQUAL "0")
|
||||
add_definitions(-DVTermScreenEnableReflowNotExists)
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "System libvterm not found: libvterm will be downloaded and compiled as part of the build process")
|
||||
endif()
|
||||
|
||||
@@ -28,6 +28,9 @@ void free_lineinfo(LineInfo *line) {
|
||||
}
|
||||
static int term_sb_push(int cols, const VTermScreenCell *cells, void *data) {
|
||||
Term *term = (Term *)data;
|
||||
bool pushed_by_height_decr =
|
||||
term->height_resize < 0 &&
|
||||
term->sb_pending_by_height_decr < -term->height_resize;
|
||||
|
||||
if (!term->sb_size) {
|
||||
return 0;
|
||||
@@ -69,8 +72,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) {
|
||||
/* pushed by window height decr */
|
||||
if (pushed_by_height_decr) {
|
||||
/* Only shrink line metadata for rows lost to a height decrease.
|
||||
Reflow can also push lines during width changes. */
|
||||
if (term->lines[term->lines_len - 1] != NULL) {
|
||||
/* do not need free here ,it is reused ,we just need set null */
|
||||
term->lines[term->lines_len - 1] = NULL;
|
||||
@@ -97,8 +101,7 @@ static int term_sb_push(int cols, const VTermScreenCell *cells, void *data) {
|
||||
if (term->sb_pending < term->sb_size) {
|
||||
term->sb_pending++;
|
||||
/* when window height decreased */
|
||||
if (term->height_resize < 0 &&
|
||||
term->sb_pending_by_height_decr < -term->height_resize) {
|
||||
if (pushed_by_height_decr) {
|
||||
term->sb_pending_by_height_decr++;
|
||||
}
|
||||
}
|
||||
@@ -114,6 +117,9 @@ static int term_sb_push(int cols, const VTermScreenCell *cells, void *data) {
|
||||
/// @param data Term
|
||||
static int term_sb_pop(int cols, VTermScreenCell *cells, void *data) {
|
||||
Term *term = (Term *)data;
|
||||
bool popped_by_height_incr =
|
||||
term->height_resize > 0 &&
|
||||
term->lines_len < term->height + term->height_resize;
|
||||
|
||||
if (!term->sb_current) {
|
||||
return 0;
|
||||
@@ -142,14 +148,23 @@ static int term_sb_pop(int cols, VTermScreenCell *cells, void *data) {
|
||||
cells[col].width = 1;
|
||||
}
|
||||
|
||||
LineInfo **lines = malloc(sizeof(LineInfo *) * (term->lines_len + 1));
|
||||
|
||||
memmove(lines + 1, term->lines, sizeof(term->lines[0]) * term->lines_len);
|
||||
lines[0] = sbrow->info;
|
||||
if (popped_by_height_incr) {
|
||||
LineInfo **lines = malloc(sizeof(LineInfo *) * (term->lines_len + 1));
|
||||
memmove(lines + 1, term->lines, sizeof(term->lines[0]) * term->lines_len);
|
||||
lines[0] = sbrow->info;
|
||||
term->lines_len += 1;
|
||||
free(term->lines);
|
||||
term->lines = lines;
|
||||
} else if (term->lines_len > 0) {
|
||||
LineInfo *lastline = term->lines[term->lines_len - 1];
|
||||
memmove(term->lines + 1, term->lines,
|
||||
sizeof(term->lines[0]) * (term->lines_len - 1));
|
||||
term->lines[0] = sbrow->info;
|
||||
free_lineinfo(lastline);
|
||||
} else {
|
||||
free_lineinfo(sbrow->info);
|
||||
}
|
||||
free(sbrow);
|
||||
term->lines_len += 1;
|
||||
free(term->lines);
|
||||
term->lines = lines;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -421,8 +436,9 @@ static int term_resize(int rows, int cols, void *user_data) {
|
||||
term->invalid_start = 0;
|
||||
term->invalid_end = rows;
|
||||
|
||||
/* if rows=term->lines_len, that means term_sb_pop already resize term->lines
|
||||
*/
|
||||
/* term_sb_pop grows term->lines only for rows gained by height increases.
|
||||
* Reflow can also pop lines during width changes, but those pops keep the
|
||||
* metadata length stable. */
|
||||
/* if rows<term->lines_len, term_sb_push would resize term->lines there */
|
||||
/* we only need to take care of rows>term->height */
|
||||
|
||||
@@ -456,7 +472,6 @@ static int term_resize(int rows, int cols, void *user_data) {
|
||||
term->height = rows;
|
||||
|
||||
invalidate_terminal(term, -1, -1);
|
||||
term->resizing = false;
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -1253,6 +1268,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 VTermScreenEnableReflowNotExists
|
||||
vterm_screen_enable_reflow(term->vts, true);
|
||||
#endif
|
||||
term->sb_size = MIN(SB_MAX, sb_size);
|
||||
term->sb_current = 0;
|
||||
term->sb_pending = 0;
|
||||
@@ -1275,7 +1293,6 @@ emacs_value Fvterm_new(emacs_env *env, ptrdiff_t nargs, emacs_value args[],
|
||||
}
|
||||
term->linenum = term->height;
|
||||
term->linenum_added = 0;
|
||||
term->resizing = false;
|
||||
|
||||
term->pty_fd = -1;
|
||||
|
||||
@@ -1373,7 +1390,6 @@ emacs_value Fvterm_set_size(emacs_env *env, ptrdiff_t nargs, emacs_value args[],
|
||||
term->linenum_added = rows - term->height - term->sb_current;
|
||||
}
|
||||
}
|
||||
term->resizing = true;
|
||||
vterm_set_size(term->vt, rows, cols);
|
||||
vterm_screen_flush_damage(term->vts);
|
||||
|
||||
|
||||
@@ -113,7 +113,6 @@ typedef struct Term {
|
||||
|
||||
int width, height;
|
||||
int height_resize;
|
||||
bool resizing;
|
||||
bool disable_bold_font;
|
||||
bool disable_underline;
|
||||
bool disable_inverse_video;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
;; -*- no-byte-compile: t; lexical-binding: nil -*-
|
||||
(define-package "vterm" "20251119.1653"
|
||||
(define-package "vterm" "20260626.1906"
|
||||
"Fully-featured terminal emulator."
|
||||
'((emacs "25.1"))
|
||||
:url "https://github.com/akermu/emacs-libvterm"
|
||||
:commit "a01a2894a1c1e81a39527835a9169e35b7ec5dec"
|
||||
:revdesc "a01a2894a1c1"
|
||||
:commit "9495966d9124ac32c307aee5c0aeb4a06be37519"
|
||||
:revdesc "9495966d9124"
|
||||
:keywords '("terminals")
|
||||
:authors '(("Lukas Fürmetz" . "fuermetz@mailbox.org"))
|
||||
:maintainers '(("Lukas Fürmetz" . "fuermetz@mailbox.org")))
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
;; Copyright (C) 2017-2020 by Lukas Fürmetz & Contributors
|
||||
;;
|
||||
;; Author: Lukas Fürmetz <fuermetz@mailbox.org>
|
||||
;; Package-Version: 20251119.1653
|
||||
;; Package-Revision: a01a2894a1c1
|
||||
;; Package-Version: 20260626.1906
|
||||
;; Package-Revision: 9495966d9124
|
||||
;; URL: https://github.com/akermu/emacs-libvterm
|
||||
;; Keywords: terminals
|
||||
;; Package-Requires: ((emacs "25.1"))
|
||||
@@ -844,7 +844,10 @@ Exceptions are defined by `vterm-keymap-exceptions'."
|
||||
;; Support to compilation-shell-minor-mode
|
||||
;; Is this necessary? See vterm--compilation-setup
|
||||
(setq next-error-function 'vterm-next-error-function)
|
||||
(setq-local bookmark-make-record-function 'vterm--bookmark-make-record))
|
||||
(setq-local bookmark-make-record-function 'vterm--bookmark-make-record)
|
||||
|
||||
;; Support to display directory in buffer listings.
|
||||
(setq list-buffers-directory (expand-file-name default-directory)))
|
||||
|
||||
(defun vterm--tramp-get-shell (method)
|
||||
"Get the shell for a remote location as specified in `vterm-tramp-shells'.
|
||||
@@ -1244,12 +1247,9 @@ Argument ARG is passed to `yank'"
|
||||
But when clicking to the unused area below the last prompt,
|
||||
move the cursor to the prompt area."
|
||||
(interactive "e\np")
|
||||
(let ((pt (mouse-set-point event promote-to-region)))
|
||||
(if (= (count-words pt (point-max)) 0)
|
||||
(vterm-reset-cursor-point)
|
||||
pt))
|
||||
;; Otherwise it selects text for every other click
|
||||
(keyboard-quit))
|
||||
(if (> (count-words (posn-point (event-end event)) (point-max)) 0)
|
||||
(mouse-set-point event promote-to-region)
|
||||
(vterm-reset-cursor-point)))
|
||||
|
||||
(defun vterm-send-string (string &optional paste-p)
|
||||
"Send the string STRING to vterm.
|
||||
@@ -1703,7 +1703,9 @@ If N is negative backward-line from end of buffer."
|
||||
(defun vterm--set-directory (path)
|
||||
"Set `default-directory' to PATH."
|
||||
(let ((dir (vterm--get-directory path)))
|
||||
(when dir (setq default-directory dir))))
|
||||
(when dir
|
||||
(setq default-directory dir)
|
||||
(setq list-buffers-directory dir))))
|
||||
|
||||
(defun vterm--get-directory (path)
|
||||
"Get normalized directory to PATH."
|
||||
@@ -1719,7 +1721,10 @@ If N is negative backward-line from end of buffer."
|
||||
(progn
|
||||
(when (file-directory-p dir)
|
||||
(setq directory (file-name-as-directory dir))))
|
||||
(setq directory (file-name-as-directory (concat "/-:" path))))))
|
||||
(let ((method (if (tramp-tramp-file-p default-directory)
|
||||
(tramp-file-name-method (tramp-dissect-file-name default-directory))
|
||||
tramp-default-method-marker)))
|
||||
(setq directory (file-name-as-directory (concat tramp-prefix-format method tramp-postfix-method-format path)))))))
|
||||
(when (file-directory-p path)
|
||||
(setq directory (file-name-as-directory path))))
|
||||
directory)))
|
||||
|
||||
Reference in New Issue
Block a user