]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
commit readline-20151030 snapshot
authorChet Ramey <chet.ramey@case.edu>
Tue, 10 Nov 2015 21:23:48 +0000 (16:23 -0500)
committerChet Ramey <chet.ramey@case.edu>
Tue, 10 Nov 2015 21:23:48 +0000 (16:23 -0500)
display.c
histfile.c

index 4353d6e0543611a46c20afbea22f9913ee91d26c..bce4897404479de6257b9d27be11c9bfb0fc2ea0 100644 (file)
--- a/display.c
+++ b/display.c
@@ -580,13 +580,13 @@ rl_redisplay ()
   int inv_botlin, lb_botlin, lb_linenum, o_cpos;
   int newlines, lpos, temp, n0, num, prompt_lines_estimate;
   char *prompt_this_line;
+  int mb_cur_max = MB_CUR_MAX;
 #if defined (HANDLE_MULTIBYTE)
   wchar_t wc;
   size_t wc_bytes;
   int wc_width;
   mbstate_t ps;
   int _rl_wrapped_multicolumn = 0;
-  int mb_cur_max = MB_CUR_MAX;
 #endif
 
   if (_rl_echoing_p == 0)
@@ -1029,9 +1029,11 @@ rl_redisplay ()
             not the first.  */
          if (out >= _rl_screenchars)
            {
+#if defined (HANDLE_MULTIBYTE)
              if (mb_cur_max > 1 && rl_byte_oriented == 0)
                out = _rl_find_prev_mbchar (line, _rl_screenchars, MB_FIND_ANY);
              else
+#endif
                out = _rl_screenchars - 1;
            }
 
index 8749886b6e37e68df38ab1f928a506390339c7e9..860653fbf2e0c371e000d2130882e3cae3ef336c 100644 (file)
@@ -613,10 +613,11 @@ history_do_write (filename, nelements, overwrite)
   mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
 #endif
   histname = history_filename (filename);
-  tempname = (overwrite && histname) ? history_tempfile (histname) : 0;
-  output = tempname ? tempname : histname;
   exists = histname ? (stat (histname, &finfo) == 0) : 0;
 
+  tempname = (overwrite && exists && S_ISREG (finfo.st_mode)) ? history_tempfile (histname) : 0;
+  output = tempname ? tempname : histname;
+
   file = output ? open (output, mode, 0600) : -1;
   rv = 0;