File: History.md

package info (click to toggle)
rust-rustyline 14.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 820 kB
  • sloc: makefile: 2
file content (32 lines) | stat: -rw-r--r-- 1,111 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Config

max_history_size

# Current session

- we should remember (index) of the first line inserted by this session.
  - if no line has been inserted => do nothing on save
  - reset this index after saving successfully.
- we should remember (path and timestamp) of the file used to initialize/`load` history.
  - if path used to save history is the same:
    - if timestamp is still the same => we can append only new lines if history has not been truncated.
    - update timestamp after saving successfully.
- we should remember (path and timestamp) of the file used to persist/`save` history.
  - reset them if `load` is then called with a different path
  - update them if `load` is then called with same path.
  - update them after saving successfully
  - if path used to save history is the same:
    - if timestamp is still the same => we can append only new lines if history has not been truncated.

```
HistoryInfo
  first_add_index: Option<usize>, // first line inserted by this session
  truncated: bool //
  path_info: Option<PathInfo>,
```

```
PathInfo
  path: Path,
  modified: SystemTime,
```