Skip to content

Commit ff142af

Browse files
author
Hood
committed
Use the correct char_width, fix bug when prompt is empty
1 parent 5779894 commit ff142af

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

css/jquery.terminal-src.css

+6
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ body.full-screen-terminal .terminal {
186186
.terminal .terminal-output > div:not(.raw) div {
187187
white-space: nowrap;
188188
}
189+
189190
.cmd .cmd-prompt > span {
190191
float: left;
191192
}
@@ -315,6 +316,11 @@ terminal .terminal-output > div {
315316
.cmd .cmd-prompt {
316317
position: relative;
317318
z-index: 200;
319+
/* Make sure prompt margin takes up space so that echo with newline : false
320+
* works when prompt is empty
321+
*/
322+
border: 0.01px solid transparent;
323+
float: left;
318324
}
319325
.cmd [role="presentation"]:not(.cmd-cursor-line) {
320326
overflow: hidden;

js/jquery.terminal-src.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9387,7 +9387,7 @@
93879387
cmd_prompt.css('margin-left', partial_width);
93889388
cmd_outer.css('top', -last_row_rect.height);
93899389
// Measure length of partial line in characters
9390-
var char_width = command_line.char_width;
9390+
var char_width = self.geometry().char.width;
93919391
var prompt_margin = Math.round(partial_width / char_width);
93929392
command_line.__set_prompt_margin(prompt_margin);
93939393
}

0 commit comments

Comments
 (0)