To:
[email protected]
Subject: Patch 6.1b.018
Fcc: outbox
From: Bram Moolenaar <
[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 6.1b.018 (depends on 6.1b.006)
Problem: When entering the encryption key, special keys may still reveal
the typed characters.
Solution: Make sure stars are used or nothing is shown in all cases.
Files: src/digraph.c, src/getchar.c, src/ex_getln.c
*** ../vim61b.017/src/digraph.c Mon Aug 27 17:15:08 2001
--- src/digraph.c Sat Mar 16 13:44:47 2002
***************
*** 2039,2045 ****
return c;
if (cmdline)
{
! if (char2cells(c) == 1)
putcmdline(c, TRUE);
}
#ifdef FEAT_CMDL_INFO
--- 2039,2049 ----
return c;
if (cmdline)
{
! if (char2cells(c) == 1
! #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
! && cmdline_star == 0
! #endif
! )
putcmdline(c, TRUE);
}
#ifdef FEAT_CMDL_INFO
*** ../vim61b.017/src/getchar.c Sun Mar 10 14:52:59 2002
--- src/getchar.c Sat Mar 16 13:45:17 2002
***************
*** 2383,2388 ****
--- 2383,2391 ----
/* this looks nice when typing a dead character map */
if ((State & CMDLINE)
+ #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
+ && cmdline_star == 0
+ #endif
&& ptr2cells(typebuf.tb_buf + typebuf.tb_off
+ typebuf.tb_len - 1) == 1)
{
*** ../vim61b.017/src/ex_getln.c Fri Mar 15 19:58:00 2002
--- src/ex_getln.c Sat Mar 16 13:45:04 2002
***************
*** 77,82 ****
--- 77,83 ----
#endif
static void alloc_cmdbuff __ARGS((int len));
static int realloc_cmdbuff __ARGS((int len));
+ static void draw_cmdline __ARGS((int start, int len));
#ifdef FEAT_WILDMENU
static void cmdline_del __ARGS((int from));
#endif
***************
*** 1265,1272 ****
/* may need to remove ^ when composing char was typed */
if (enc_utf8 && utf_iscomposing(c) && !cmd_silent)
{
! msg_outtrans_len(ccline.cmdbuff + ccline.cmdpos,
! ccline.cmdlen - ccline.cmdpos);
msg_putchar(' ');
cursorcmd();
}
--- 1266,1272 ----
/* may need to remove ^ when composing char was typed */
if (enc_utf8 && utf_iscomposing(c) && !cmd_silent)
{
! draw_cmdline(ccline.cmdpos, ccline.cmdlen - ccline.cmdpos);
msg_putchar(' ');
cursorcmd();
}
***************
*** 1558,1564 ****
int idx;
{
#if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
! if (cmdline_star) /* showing '*', always 1 position */
return 1;
#endif
return ptr2cells(ccline.cmdbuff + idx);
--- 1561,1567 ----
int idx;
{
#if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
! if (cmdline_star > 0) /* showing '*', always 1 position */
return 1;
#endif
return ptr2cells(ccline.cmdbuff + idx);
***************
*** 1921,1926 ****
--- 1924,1949 ----
}
/*
+ * Draw part of the cmdline at the current cursor position. But draw stars
+ * when cmdline_star is TRUE.
+ */
+ static void
+ draw_cmdline(start, len)
+ int start;
+ int len;
+ {
+ #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
+ int i;
+
+ if (cmdline_star > 0)
+ for (i = 0; i < len; ++i)
+ msg_putchar('*');
+ else
+ #endif
+ msg_outtrans_len(ccline.cmdbuff + start, len);
+ }
+
+ /*
* Put a character on the command line. Shifts the following text to the
* right when "shift" is TRUE. Used for CTRL-V, CTRL-K, etc.
* "c" must be printable (fit in one display cell)!
***************
*** 1935,1942 ****
msg_no_more = TRUE;
msg_putchar(c);
if (shift)
! msg_outtrans_len(ccline.cmdbuff + ccline.cmdpos,
! ccline.cmdlen - ccline.cmdpos);
msg_no_more = FALSE;
cursorcmd();
}
--- 1958,1964 ----
msg_no_more = TRUE;
msg_putchar(c);
if (shift)
! draw_cmdline(ccline.cmdpos, ccline.cmdlen - ccline.cmdpos);
msg_no_more = FALSE;
cursorcmd();
}
***************
*** 1953,1959 ****
if (ccline.cmdlen == ccline.cmdpos)
msg_putchar(' ');
else
! msg_outtrans_len(ccline.cmdbuff + ccline.cmdpos, 1);
msg_no_more = FALSE;
cursorcmd();
}
--- 1975,1981 ----
if (ccline.cmdlen == ccline.cmdpos)
msg_putchar(' ');
else
! draw_cmdline(ccline.cmdpos, 1);
msg_no_more = FALSE;
cursorcmd();
}
***************
*** 2053,2074 ****
if (redraw && !cmd_silent)
{
! #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
! if (cmdline_star) /* only write '*' characters */
! for (i = ccline.cmdpos; i < ccline.cmdlen; ++i)
! msg_putchar('*');
! else
! #endif
! {
! msg_no_more = TRUE;
! i = cmdline_row;
! msg_outtrans_len(ccline.cmdbuff + ccline.cmdpos,
! ccline.cmdlen - ccline.cmdpos);
! /* Avoid clearing the rest of the line too often. */
! if (cmdline_row != i || ccline.overstrike)
! msg_clr_eos();
! msg_no_more = FALSE;
! }
}
#ifdef FEAT_FKMAP
/*
--- 2075,2087 ----
if (redraw && !cmd_silent)
{
! msg_no_more = TRUE;
! i = cmdline_row;
! draw_cmdline(ccline.cmdpos, ccline.cmdlen - ccline.cmdpos);
! /* Avoid clearing the rest of the line too often. */
! if (cmdline_row != i || ccline.overstrike)
! msg_clr_eos();
! msg_no_more = FALSE;
}
#ifdef FEAT_FKMAP
/*
***************
*** 2169,2200 ****
void
redrawcmd()
{
- #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
- int i;
- #endif
-
if (cmd_silent)
return;
msg_start();
redrawcmdprompt();
! #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
! if (cmdline_star)
! {
! /* Show '*' for every character typed */
! for (i = 0; i < ccline.cmdlen; ++i)
! msg_putchar('*');
! msg_clr_eos();
! }
! else
! #endif
! {
! /* Don't use more prompt, truncate the cmdline if it doesn't fit. */
! msg_no_more = TRUE;
! msg_outtrans_len(ccline.cmdbuff, ccline.cmdlen);
! msg_clr_eos();
! msg_no_more = FALSE;
! }
set_cmdspos_cursor();
/*
--- 2182,2199 ----
void
redrawcmd()
{
if (cmd_silent)
return;
msg_start();
redrawcmdprompt();
!
! /* Don't use more prompt, truncate the cmdline if it doesn't fit. */
! msg_no_more = TRUE;
! draw_cmdline(0, ccline.cmdlen);
! msg_clr_eos();
! msg_no_more = FALSE;
!
set_cmdspos_cursor();
/*
***************
*** 4367,4373 ****
int save_State = State;
/* Can't do this recursively. Can't do it when typing a password. */
! if (cmdwin_type != 0 || cmdline_star > 0)
{
beep_flush();
return K_IGNORE;
--- 4366,4376 ----
int save_State = State;
/* Can't do this recursively. Can't do it when typing a password. */
! if (cmdwin_type != 0
! # if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
! || cmdline_star > 0
! # endif
! )
{
beep_flush();
return K_IGNORE;
*** ../vim61b.017/src/version.c Sat Mar 16 11:50:27 2002
--- src/version.c Sat Mar 16 13:36:51 2002
***************
*** 608,609 ****
--- 608,611 ----
{ /* Add new patch number below this line */
+ /**/
+ 18,
/**/
--
"It's so simple to be wise. Just think of something stupid to say
and then don't say it." -- Sam Levenson
/// Bram Moolenaar --
[email protected] --
http://www.moolenaar.net \\\
/// Creator of Vim --
http://vim.sf.net --
ftp://ftp.vim.org/pub/vim \\\
\\\ Project leader for A-A-P --
http://www.a-a-p.org ///
\\\ Help me helping AIDS orphans in Uganda -
http://iccf-holland.org ///