aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ChangeLog10
-rw-r--r--linein.c47
2 files changed, 54 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e6354a..6e99e96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-12-07 Tsutomu Okada <okada@furuno.co.jp>
+
+ * [w3m-dev 02638] completion for ! and/or @
+ * linein.c (next_compl): check "\\ ", "\\\t"
+ * linein.c (escape_spaces): added
+ * linein.c (unescape_spaces): added
+ * linein.c (doComplete): use unescape_spaces, escape_spaces
+
2001-12-07 Fumitoshi UKAI <ukai@debian.or.jp>
* [w3m-dev 02637]
@@ -1072,4 +1080,4 @@
* release-0-2-1
* import w3m-0.2.1
-$Id: ChangeLog,v 1.111 2001/12/06 22:49:00 ukai Exp $
+$Id: ChangeLog,v 1.112 2001/12/07 07:20:26 ukai Exp $
diff --git a/linein.c b/linein.c
index fff9933..3d33505 100644
--- a/linein.c
+++ b/linein.c
@@ -1,4 +1,4 @@
-/* $Id: linein.c,v 1.12 2001/12/06 16:36:54 ukai Exp $ */
+/* $Id: linein.c,v 1.13 2001/12/07 07:20:26 ukai Exp $ */
#include "fm.h"
#include "local.h"
#include "myctype.h"
@@ -681,7 +681,8 @@ next_compl(int next)
}
else {
for (b = CPos - 1; b >= 0; b--) {
- if (strBuf->ptr[b] == ' ' || strBuf->ptr[b] == CTRL_I)
+ if ((strBuf->ptr[b] == ' ' || strBuf->ptr[b] == CTRL_I) &&
+ !((b > 0) && strBuf->ptr[b-1] == '\\'))
break;
}
b++;
@@ -854,6 +855,40 @@ next_dcompl(int next)
}
}
+Str
+escape_spaces(Str s)
+{
+ char *p;
+
+ if (s == NULL)
+ return;
+ p = s->ptr;
+ s = Strnew();
+ while(*p) {
+ if (*p == ' ')
+ Strcat_char(s, '\\');
+ Strcat_char(s, *p++);
+ }
+ return s;
+}
+
+Str
+unescape_spaces(Str s)
+{
+ char *p;
+
+ if (s == NULL)
+ return;
+ p = s->ptr;
+ s = Strnew();
+ while (*p) {
+ if (!(*p == '\\' && *(p+1) && *(p+1) == ' '))
+ Strcat_char(s, *p);
+ p++;
+ }
+ return s;
+}
+
static Str
doComplete(Str ifn, int *status, int next)
{
@@ -866,6 +901,8 @@ doComplete(Str ifn, int *status, int next)
if (!cm_next) {
NCFileBuf = 0;
ifn = Str_conv_to_system(ifn);
+ if (cm_mode & CPL_ON)
+ ifn = unescape_spaces(ifn);
CompleteBuf = Strdup(ifn);
while (Strlastchar(CompleteBuf) != '/' && CompleteBuf->length > 0)
Strshrink(CompleteBuf, 1);
@@ -893,6 +930,8 @@ doComplete(Str ifn, int *status, int next)
if ((d = opendir(expandName(CompleteBuf->ptr))) == NULL) {
CompleteBuf = Strdup(ifn);
*status = CPL_FAIL;
+ if (cm_mode & CPL_ON)
+ CompleteBuf = escape_spaces(CompleteBuf);
return CompleteBuf;
}
fn = lastFileName(ifn->ptr);
@@ -924,6 +963,8 @@ doComplete(Str ifn, int *status, int next)
if (NCFileBuf == 0) {
CompleteBuf = Strdup(ifn);
*status = CPL_FAIL;
+ if (cm_mode & CPL_ON)
+ CompleteBuf = escape_spaces(CompleteBuf);
return CompleteBuf;
}
qsort(CFileBuf, NCFileBuf, sizeof(CFileBuf[0]), strCmp);
@@ -963,6 +1004,8 @@ doComplete(Str ifn, int *status, int next)
if (stat(expandName(p), &st) != -1 && S_ISDIR(st.st_mode))
Strcat_char(CompleteBuf, '/');
}
+ if (cm_mode & CPL_ON)
+ CompleteBuf = escape_spaces(CompleteBuf);
return Str_conv_from_system(CompleteBuf);
}