 CONSTANT: HISTORY V{ }
 CONSTANT: LINKS V{ }
 CONSTANT: STACK V{ }
+CONSTANT: PAGE V{ }
 CONSTANT: URL V{ }
 
 : add-stack ( args -- )
+    dup PAGE keys index [ STACK delete-all ] unless
     URL ?first STACK index [
         1 + dup STACK ?nth pick = [
             2drop

! Copyright (C) 2021 John Benediktsson
! See http://factorcode.org/license.txt for BSD license

USING: accessors arrays combinators.short-circuit command-loop
formatting gemini gemini.private io io.directories
io.encodings.string io.encodings.utf8 io.files io.files.temp
io.launcher io.pipes kernel math math.parser namespaces present
sequences splitting system urls webbrowser ;

IN: gemini.cli


        "cat" swap 2array prefix run-pipeline drop
    ] [ 2drop ] if ;

: gemini-stack ( -- )
    STACK [
        1 + swap dup URL ?first = " (*)" f ?
        "[%d] %s%s\n" printf
    ] each-index
    LINKS delete-all STACK LINKS push-all ;

CONSTANT: COMMANDS {
    T{ command
        { name "back" }
