pub struct History {Show 14 fields
pub curhist: i64,
pub histlinect: i64,
pub histsiz: i64,
pub savehistsiz: i64,
pub histactive: u32,
pub stophist: i32,
pub histdone: i32,
pub hist_skip_flags: i32,
pub hist_ignore_all_dups: bool,
pub curline: Option<HistEntry>,
pub hsubl: Option<String>,
pub hsubr: Option<String>,
pub bangchar: char,
pub histfile: Option<String>,
/* private fields */
}Expand description
History state
Fields§
§curhist: i64Current history number
histlinect: i64History line count
histsiz: i64History size limit
savehistsiz: i64Save history size
histactive: u32History active state
stophist: i32Stop history flag
histdone: i32History done flags
hist_skip_flags: i32History skip flags
hist_ignore_all_dups: boolIgnore all dups
curline: Option<HistEntry>Current line being edited
hsubl: Option<String>History substitution patterns
hsubr: Option<String>§bangchar: charBang character
histfile: Option<String>History file path
Implementations§
Source§impl History
impl History
pub fn new() -> Self
Sourcepub fn recent(&self, n: usize) -> Option<&HistEntry>
pub fn recent(&self, n: usize) -> Option<&HistEntry>
Get the n-th most recent entry (0 = latest)
Sourcepub fn search_back(&self, pattern: &str, start: i64) -> Option<&HistEntry>
pub fn search_back(&self, pattern: &str, start: i64) -> Option<&HistEntry>
Search history backwards for a pattern
Sourcepub fn search_forward(&self, pattern: &str, start: i64) -> Option<&HistEntry>
pub fn search_forward(&self, pattern: &str, start: i64) -> Option<&HistEntry>
Search history forwards for a pattern
Sourcepub fn all_entries(&self) -> Vec<&HistEntry>
pub fn all_entries(&self) -> Vec<&HistEntry>
Get all entries in order
Source§impl History
History search containing pattern (from hist.c hconsearch lines 1836-1854)
impl History
History search containing pattern (from hist.c hconsearch lines 1836-1854)
pub fn hconsearch(&self, pattern: &str) -> Option<(i64, usize)>
Sourcepub fn hcomsearch(&self, prefix: &str) -> Option<i64>
pub fn hcomsearch(&self, prefix: &str) -> Option<i64>
History search by prefix (from hist.c hcomsearch lines 1859-1872)
Sourcepub fn getargs(&self, ev: i64, arg1: usize, arg2: usize) -> Option<String>
pub fn getargs(&self, ev: i64, arg1: usize, arg2: usize) -> Option<String>
Get arguments from history entry (from hist.c getargs lines 2453-2482)
Sourcepub fn save_context(&self) -> HistStack
pub fn save_context(&self) -> HistStack
Save history context (from hist.c hist_context_save lines 248-290)
Sourcepub fn restore_context(&mut self, ctx: &HistStack)
pub fn restore_context(&mut self, ctx: &HistStack)
Restore history context (from hist.c hist_context_restore lines 296-325)
Sourcepub fn hist_in_word(&mut self, yesno: bool)
pub fn hist_in_word(&mut self, yesno: bool)
Set history in-word state (from hist.c hist_in_word lines 339-345)
Sourcepub fn hist_is_in_word(&self) -> bool
pub fn hist_is_in_word(&self) -> bool
Check if in word (from hist.c hist_is_in_word lines 348-352)
Sourcepub fn addhistnum(&self, hl: i64, n: i64) -> i64
pub fn addhistnum(&self, hl: i64, n: i64) -> i64
Add history number with offset (from hist.c addhistnum lines 1265-1280)
Sourcepub fn histreduceblanks(line: &str, words: &[(usize, usize)]) -> String
pub fn histreduceblanks(line: &str, words: &[(usize, usize)]) -> String
Reduce blanks in history line (from hist.c histreduceblanks lines 1199-1250)
Sourcepub fn resizehistents(&mut self)
pub fn resizehistents(&mut self)
Resize history entries to fit histsiz (from hist.c resizehistents lines 2620-2632)
Sourcepub fn readhistfile(&mut self, filename: &str, err: bool) -> Result<usize>
pub fn readhistfile(&mut self, filename: &str, err: bool) -> Result<usize>
Read history file (from hist.c readhistfile lines 2675-2920)
Sourcepub fn savehistfile(&self, filename: &str, mode: WriteMode) -> Result<usize>
pub fn savehistfile(&self, filename: &str, mode: WriteMode) -> Result<usize>
Write history file (from hist.c savehistfile lines 2925-3155)
Sourcepub fn lockhistfile(&self, filename: &str, _excl: bool) -> Result<()>
pub fn lockhistfile(&self, filename: &str, _excl: bool) -> Result<()>
Lock history file (from hist.c lockhistfile lines 2961-2998)
Sourcepub fn unlockhistfile(&self, filename: &str) -> Result<()>
pub fn unlockhistfile(&self, filename: &str) -> Result<()>
Unlock history file (from hist.c unlockhistfile lines 3001-3018)
Sourcepub fn quotestring(s: &str) -> String
pub fn quotestring(s: &str) -> String
Quote string for history (from hist.c quotestring lines 2483-2523)
Sourcepub fn get_history_word(line: &str, idx: usize) -> Option<&str>
pub fn get_history_word(line: &str, idx: usize) -> Option<&str>
History word split (from hist.c get_history_word)
Sourcepub fn histword_count(line: &str) -> usize
pub fn histword_count(line: &str) -> usize
Count words in history line
Source§impl History
History entry navigation (from hist.c movehistent/up_histent/down_histent)
impl History
History entry navigation (from hist.c movehistent/up_histent/down_histent)
Sourcepub fn movehistent(&self, start: i64, n: i64) -> Option<&HistEntry>
pub fn movehistent(&self, start: i64, n: i64) -> Option<&HistEntry>
Move n entries in history (from hist.c movehistent)
Sourcepub fn up_histent(&self, current: i64) -> Option<&HistEntry>
pub fn up_histent(&self, current: i64) -> Option<&HistEntry>
Move up one entry (from hist.c up_histent)
Sourcepub fn down_histent(&self, current: i64) -> Option<&HistEntry>
pub fn down_histent(&self, current: i64) -> Option<&HistEntry>
Move down one entry (from hist.c down_histent)
Sourcepub fn gethistent(&self, ev: i64, near_match: bool) -> Option<&HistEntry>
pub fn gethistent(&self, ev: i64, near_match: bool) -> Option<&HistEntry>
Get history entry by event number with near-match (from hist.c gethistent)
Sourcepub fn prepnexthistent(&mut self) -> i64
pub fn prepnexthistent(&mut self) -> i64
Prepare next history entry (from hist.c prepnexthistent)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnsafeUnpin for History
impl UnwindSafe for History
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more