Good morning.

Ralph Corderoy <[email protected]> wrote:
 |s-nail 14.8.16-1 on Arch Linux.  I was writing an email and pasted text
 |from the web browser into the terminal.  It contained tabs.  The pasted
 |text had "[ERR_TOO_LONG]" added throughout.

The old N(ail)C(ommand)L(ine) editor uses the terminal line buffer
directly, and that is of a very restricted size on Linux.  You
would have a better experience with a BSD system, e.g., i have
developed this on MacOS X, then, and it almost never hit me.
Except maybe when i /usr/bin/<TAB>, or so.

The new M(ailx)L(ine)E(ditor) uses an intermediate buffer instead,
and has a 32-bit line size limit.

 |What's written to the terminal, captured by script(1), has lots of
 |Ctrl-Hs to backspace over what's already written.  Here's an example.
 |I've folded the single line.
 |
 |    Date & Time ^H^H^H^H^H^H^H^H^H^H^H^H            ^H^H^H^H^H^H^H^H

Yes, the NCL uses the terminal line buffer directly, and cursor
movement to the left is realized by writing backspaces (ASCII BS).
I.e., the NCL is a deriviation, or was at least inspired, by the
hetio.c source of NetBSD sh(1) and dash(1).  I.e., pretty
traditional.

 ...
 |The system calls captured by strace starting with the end of "Time "
 |above.
 ...
 |    read(0, "\t", 1)                        = 1
 |    rt_sigprocmask(SIG_BLOCK, ~[ILL ABRT BUS FPE KILL SEGV CHLD STOP \
 |    RTMIN RT_1], [], 8) = 0
 |    stat("*", 0x7ffcba68b710)               = -1 ENOENT (No such file \
 |    or directory)
 |    stat("*.gz", 0x7ffcba68b710)            = -1 ENOENT (No such file \
 |    or directory)
 |    stat("*.xz", 0x7ffcba68b710)            = -1 ENOENT (No such file \
 |    or directory)
 |    stat("*.bz2", 0x7ffcba68b710)           = -1 ENOENT (No such file \
 |    or directory)
 |
 |Why stat globs?  And if * is ENOENT then the others aren't going to fare
 |better.

This is getting funny.  I have realized tabulator completion by
using the same expand() (fexpand()) function that is in the
codebase since decades.  Along inside this is, and is still,
a call to the function which_protocol(), which context-free takes
the string input and tries to find out which protocol (file, pop3,
etc.) that string could represent.  Alongside this it needs to
test the possible compressor extensions we support out of the box,
because, and here it comes, the protocol may fall back to
"maildir" if we don't know otherwise and the user has set the
*newfolders* variable, and to "maildir".  So this is a terrible
hack, but we will need to carry it with us until v15, when we have
nice URL objects which will be carried along the way, so we have
context and only parse once.

But i see now that in the meanwhile i have added a flag
FEXP_NOPROTO to avoid exactly these cases, but we are not yet
using it for the development branch...  So added it, and my
strace(1), with signal handling stripped looks like:

  ?0!0[#/var/spool/mail/steffen]? abc) = 48
  read(0, "\t", 1)                        = 1
  open("./", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
  fstat(3, {st_mode=S_IFDIR|0700, st_size=12288, ...}) = 0
  getdents(3, /* 186 entries */, 32768)   = 6216
  getdents(3, /* 0 entries */, 32768)     = 0
  close(3)                                = 0
  read(0, 

which is now, i think, fine.

  ...
 |So it seems there's tab completion of filenames in the midst of writing
 |an email.  That seems of rare use, but a source of frequent annoyance.
 |How is it disabled?

Not at all.  In v14.9, however, you will be able to re-`bind' the
tabulator expansion for compose mode.  Let me see... ah ja, works:

  ?0[steffen@wales nail.git]$ ./s-nail -RSnoeditalong \
    -X "bind compose \$'\\t' RALPH@"
  s-nail version v14.9.0-pre3-165-g52ef04f4-dirty.  Type `?' for help
  /var/spool/mail/steffen: 0 messages [Read only]
  ?0!0[#/var/spool/mail/steffen]? m ralph
  Subject: RALPH
  Hi, RALPH, i am a RALPH.
  Ciao.

  s-nail: (Interrupt -- one more to kill letter)

 |Cheers, Ralph.

Committed and pushed the FEXP_NOPROTO fix.  Thanks.
Ciao.

--steffen

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
__________________________________
[email protected]

Reply via email to