history(n)

πŸ“¦
version 0.7 Β· 3 versions
, in alpine 3.24

πŸ’– NAME πŸ’–

okay so this is history(n), bestie β€” the manual page for history, and it literally provides a history for Entry widgets ✨ it’s giving β€œyour text entry has a memory now” and I’m obsessed πŸ’…

✨ SYNOPSIS ✨

here’s the synopsis, untouched and iconic:

package require Tcl  8.4

package require Tk  8.4

package require history  ?0.1?

::history::init pathName ?length?

::history::remove pathName

::history::add pathName text

::history::get pathName

::history::clear pathName

::history::configure pathName option ?value?

bell

🫢 DESCRIPTION 🫢

okay so this package gives you a convenient history mechanism for Entry widgets. you can access the history with the Up and Down arrow keys πŸ¦‹

  • ::history::init pathName ?length? β€” arranges to remember the history of the named Entry widget. the optional length determines the number of history entries to keep, and you can change it later with ::history::configure. history entries must be added with the ::history::add command before they can be seen πŸ‘€
  • ::history::remove pathName β€” forgets all history entries for the Entry pathName and removes the history bindings. bye-bye memory πŸ’€
  • ::history::add pathName text β€” used to add history entries to an Entry that has previously had ::history::init called on it. call this from your Entry handler with the contents of the entry (or whatever you wish to add to the history). yes bestie, you control the lore πŸ“
  • ::history::get pathName β€” returns a list containing the history entries for the Entry pathName πŸŽ€
  • ::history::clear pathName β€” clears the history list for the named Entry 🧹
  • ::history::configure pathName option ?value? β€” queries or sets configuration options. currently the options recognized are length and alert. setting the length determines the number of history entries to keep for the named Entry. alert specifies the command to run when the user reaches the end of the history, and it defaults to bell. although configure requires a pathName argument, the setting for alert is global and the path is ignored πŸ‘‘

then there’s this example, which I am placing here exactly because the vibes must be preserved:

entry .e
bind .e <Return> [list ProcessEntry %W]
::history::init .e
pack .e

proc ProcessEntry {w} {
    set text [$w get]
    if {$text == ""} { return }
    ::history::add $w $text
    puts $text
    $w delete 0 end
}

πŸ› BUGS, IDEAS, FEEDBACK πŸ›

okay so this document and the package it describes will undoubtedly contain bugs and other problems 😭 please report such in the category entry::history of the Tklib Trackers [http://core.tcl.tk/tklib/reportlist]. also please report any ideas for enhancements you may have for either package and/or documentation 🫢 no gatekeeping, bestie.

πŸ”‘ KEYWORDS πŸ”‘

entry, history πŸ’–


signed off with sparkle: source/version tklib 0.1, manual history(n) β€” no date in the footer, so consider this the forever-vibe date πŸŒˆπŸ’…

πŸ“¦ where this page comes from