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

Do our best to restore tab characters #722

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions vterm-module.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ static void refresh_lines(Term *term, emacs_env *env, int start_row,

for (i = start_row; i < end_row; i++) {

int consecutive_empty_cells = 0;
int newline = 0;
int isprompt = 0;
for (j = 0; j < end_col; j++) {
Expand All @@ -340,14 +341,25 @@ static void refresh_lines(Term *term, emacs_env *env, int start_row,

lastCell = cell;
if (cell.chars[0] == 0) {
++consecutive_empty_cells;

if (is_eol(term, end_col, i, j)) {
/* This cell is EOL if this and every cell to the right is black */
PUSH_BUFFER('\n');
newline = 1;
break;
}

PUSH_BUFFER(' ');

if ((j + 1) % 8 == 0 && length >= consecutive_empty_cells) {
length -= consecutive_empty_cells;
PUSH_BUFFER('\t');
consecutive_empty_cells = 0;
}
} else {
consecutive_empty_cells = 0;

for (int k = 0; k < VTERM_MAX_CHARS_PER_CELL && cell.chars[k]; ++k) {
unsigned char bytes[4];
size_t count = codepoint_to_utf8(cell.chars[k], bytes);
Expand Down
1 change: 1 addition & 0 deletions vterm.el
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ Exceptions are defined by `vterm-keymap-exceptions'."
(setq-local scroll-margin 0)
(setq-local hscroll-margin 0)
(setq-local hscroll-step 1)
(setq-local tab-width 8)
(setq-local truncate-lines t)


Expand Down