[MacPorts] #56381: It would be nice if shell mode saved command history immediately

MacPorts noreply at macports.org
Wed May 2 15:51:31 UTC 2018


#56381: It would be nice if shell mode saved command history immediately
----------------------------+--------------------
  Reporter:  ylluminarious  |      Owner:  (none)
      Type:  enhancement    |     Status:  new
  Priority:  Normal         |  Milestone:
 Component:  base           |    Version:  2.4.3
Resolution:                 |   Keywords:
      Port:                 |
----------------------------+--------------------
Changes (by raimue):

 * cc: raimue (added)


Comment:

 Hello, and welcome to MacPorts! Yes, you already found the right place
 with `process_command_file` in the port client.

 I guess the solution would be to call `rl_history write` ''before''
 executing the command. Then it would always be saved, even if the command
 itself is interrupted. Could even be done in `get_next_cmdline` where the
 line is added to the readline history in memory.

 One drawback is that this would always write the full history file instead
 of just appending a single line. It looks like readline (actually libedit)
 has a `append_history` function we are not yet wrapping in
 [https://github.com/macports/macports-
 base/blob/8dda587a7359d8aa71fea3ad9744ba7019dcd1f2/src/pextlib1.0/readline.c#L263-L334
 rl_history] that should be used for appends.

 Let us know if you get stuck or need assistance when working on this!

-- 
Ticket URL: <https://trac.macports.org/ticket/56381#comment:3>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list