' Mini Text Editor — outLine-based editing with cursor display
#COMPILE EXE
#DIM ALL

FUNCTION PBMAIN() AS LONG
    LOCAL line0 AS STRING
LOCAL line1 AS STRING
LOCAL line2 AS STRING
    LOCAL line3 AS STRING
LOCAL line4 AS STRING
LOCAL line5 AS STRING
    LOCAL line6 AS STRING
LOCAL line7 AS STRING
LOCAL line8 AS STRING
    LOCAL line9 AS STRING
    LOCAL cmd AS LONG
LOCAL row AS LONG
    LOCAL running AS LONG

    line0 = "Welcome to Mini Text Editor"
    line1 = "==========================="
    line2 = "Commands: 1-9=view outLine,"
    line3 = "  0=load demo, 9=quit"
    line4 = ""
    line5 = ""
    line6 = "This is a text editor simulation."
    line7 = "It stores 10 lines of text."
    line8 = ""
    line9 = ""

    row = 0
    running = 1

    PRINT "=== Mini Text Editor ==="
    PRINT ""

    WHILE running
        PRINT "Line 0: "; line0
        PRINT "Line 1: "; line1
        PRINT "Line 2: "; line2
        PRINT "Line 3: "; line3
        PRINT "Line 4: "; line4
        PRINT "Line 5: "; line5
        PRINT "Line 6: "; line6
        PRINT "Line 7: "; line7
        PRINT "Line 8: "; line8
        PRINT "Line 9: "; line9
        PRINT ""
        PRINT "> Current outLine: "; row
        PRINT "  Cmd (0-9=select, 1=load demo, 9=quit): "

        cmd = row
        row = row + 1
        IF row > 9 THEN row = 0

        IF cmd >= 0 AND cmd <= 9 THEN
            PRINT "  Selected line "; cmd
        END IF

        IF cmd = 1 THEN
            line0 = "Demo text loaded!"
            line1 = "Line 2: Hello World"
            line2 = "Line 3: PBXB64 compiler"
            line3 = "Line 4: Text editing"
            line4 = "Line 5: Multiple lines"
            line5 = "Line 6: Are supported"
            line6 = "This is the last line."
            PRINT "  Demo text loaded."
        END IF

        IF cmd = 9 THEN
            running = 0
            PRINT "  Goodbye!"
        END IF

        PRINT ""
    WEND

    FUNCTION = 0
END FUNCTION
