|
@@ -460,6 +460,7 @@ tinyrl_init(tinyrl_t * this,
|
|
|
|
|
|
|
|
|
this->term = tinyrl_vt100_new(instream, outstream);
|
|
|
+ this->last_width = tinyrl_vt100__get_width(this->term);
|
|
|
|
|
|
|
|
|
this->history = tinyrl_history_new(stifle);
|
|
@@ -548,13 +549,20 @@ void tinyrl_redisplay(tinyrl_t * this)
|
|
|
int cols;
|
|
|
|
|
|
|
|
|
- if (this->last_buffer) {
|
|
|
+ if (this->last_buffer && (width == this->last_width)) {
|
|
|
+
|
|
|
eq_chars = lub_string_equal_part(this->line, this->last_buffer);
|
|
|
count = utf8_nsyms(this, this->last_buffer, this->last_point);
|
|
|
tinyrl_internal_position(this, this->prompt_len + eq_chars,
|
|
|
count - eq_chars, width);
|
|
|
- } else
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if (width != this->last_width) {
|
|
|
+ tinyrl_vt100_next_line(this->term);
|
|
|
+ tinyrl_vt100_erase_down(this->term);
|
|
|
+ }
|
|
|
tinyrl_vt100_printf(this->term, "%s", this->prompt);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
tinyrl_internal_print(this, this->line + eq_chars);
|
|
@@ -579,6 +587,7 @@ void tinyrl_redisplay(tinyrl_t * this)
|
|
|
lub_string_free(this->last_buffer);
|
|
|
this->last_buffer = lub_string_dup(this->line);
|
|
|
this->last_point = this->point;
|
|
|
+ this->last_width = width;
|
|
|
}
|
|
|
|
|
|
|