+
+ /* Now if we have printed the prompt string because the first difference
+ was within the prompt, see if we need to recompute where the lines
+ differ. Check whether where we are now is past the last place where
+ the old and new lines are the same and short-circuit now if we are. */
+ if ((od <= prompt_last_invisible || nd <= prompt_last_invisible) &&
+ omax == nmax &&
+ lendiff > (ols-old) && lendiff > (nls-new))
+ return;
+
+ /* XXX - we need to fix up our calculations if we are now past the
+ old ofd/nfd and the prompt length (or line length) has changed.
+ We punt on the problem and do a dumb update. We'd like to be able
+ to just output the prompt from the beginning of the line up to the
+ first difference, but you don't know the number of invisible
+ characters in that case.
+ This needs a lot of work to be efficient. */
+ if ((od <= prompt_last_invisible || nd <= prompt_last_invisible))
+ {
+ nfd = new + lendiff; /* number of characters we output above */
+ nd = lendiff;
+
+ /* Do a dumb update and return */
+dumb_update:
+ temp = ne - nfd;
+ if (temp > 0)
+ {
+ _rl_output_some_chars (nfd, temp);
+ if (mb_cur_max > 1 && rl_byte_oriented == 0)
+ {
+ _rl_last_c_pos += _rl_col_width (new, nd, ne - new, 1);
+ /* Need to adjust here based on wrap_offset. Guess that if
+ this is the line containing the last line of the prompt
+ we need to adjust by
+ wrap_offset-prompt_invis_chars_first_line
+ on the assumption that this is the number of invisible
+ characters in the last line of the prompt. */
+ if (wrap_offset > prompt_invis_chars_first_line &&
+ current_line == prompt_last_screen_line &&
+ prompt_physical_chars > _rl_screenwidth &&
+ _rl_horizontal_scroll_mode == 0)
+ {
+ _rl_last_c_pos -= wrap_offset - prompt_invis_chars_first_line;
+ cpos_adjusted = 1;
+ }
+ }
+ else
+ _rl_last_c_pos += temp;
+ }
+ if (nmax < omax)
+ goto clear_rest_of_line; /* XXX */
+ else
+ return;
+ }