mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00:00
Fix for stack overflow when overflowing a line
This commit is contained in:
parent
35e9fd1bb0
commit
ba070e21e4
1 changed files with 19 additions and 18 deletions
25
screen.cpp
25
screen.cpp
|
@ -413,10 +413,10 @@ static void s_check_status( screen_t *s)
|
|||
than the screen width.
|
||||
*/
|
||||
static void s_desired_append_char( screen_t *s,
|
||||
wchar_t b,
|
||||
int c,
|
||||
int indent,
|
||||
size_t prompt_width )
|
||||
wchar_t b,
|
||||
int c,
|
||||
int indent,
|
||||
size_t prompt_width )
|
||||
{
|
||||
int line_no = s->desired.cursor.y;
|
||||
|
||||
|
@ -448,14 +448,13 @@ static void s_desired_append_char( screen_t *s,
|
|||
int screen_width = common_get_width();
|
||||
int cw = fish_wcwidth(b);
|
||||
int ew = fish_wcwidth( ellipsis_char );
|
||||
int i;
|
||||
|
||||
s->desired.create_line(line_no);
|
||||
|
||||
/*
|
||||
Check if we are at the end of the line. If so, print an
|
||||
ellipsis character and continue on the next line.
|
||||
*/
|
||||
Check if we are at the end of the line. If so, print an
|
||||
ellipsis character and continue on the next line.
|
||||
*/
|
||||
if( s->desired.cursor.x + cw + ew > screen_width )
|
||||
{
|
||||
s->desired.line(line_no).append(ellipsis_char, HIGHLIGHT_COMMENT);
|
||||
|
@ -464,10 +463,12 @@ static void s_desired_append_char( screen_t *s,
|
|||
s->desired.add_line();
|
||||
s->desired.cursor.y++;
|
||||
s->desired.cursor.x=0;
|
||||
for( i=0; i < (prompt_width-ew); i++ )
|
||||
{
|
||||
s_desired_append_char( s, L' ', 0, indent, prompt_width );
|
||||
}
|
||||
if (prompt_width > ew) {
|
||||
for( size_t i=0; i < (prompt_width-ew); i++ )
|
||||
{
|
||||
s_desired_append_char( s, L' ', 0, indent, prompt_width );
|
||||
}
|
||||
}
|
||||
s_desired_append_char( s, ellipsis_char, HIGHLIGHT_COMMENT, indent, prompt_width );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue