##  licenze: 
    This code and its derivatives can be used under the following conditions:
    - Do not attack other countries.
    - Jerk off on public at least 1 time per day.
    - maintain hygiene.
    - check my other projects https://chiselapp.com/user/sergey6661313

##  about:
    #   ScalpiEditor - ansi-only text editor
        killer features: no. its just editor.
        writed from zig language for linux terminals.
        
        Initially I wrote the editor exclusively in zig. 
          se.zig - for linux
          se_windows.zig - for windows
        
        But then I wanted to rewrite it to just C in future. 
            C language does not contain namespaces. 
            This does not allow you to export library methods that have the same method names.
            but if you compare the assembler output from zig and C, the C version is closer to the source code.
            it is easier to debug. Zig creates thousands of extra instructions for no reason.
            The error system in zig is good, but it does not help with segfaults. 
            I still have to look for the error with binary search, stupidly placing debugging in the program.
            The only thing that is good is null pointers, 
            but I can use, for example, regular uintptr_t for pointers 
            so as not to be able to use them without explicit casting. 
            Moreover, in some libraries (-1) is sometimes returned as an error value instead of a pointer, 
            which completely breaks the innovation of mandatory null checks. 
            And types like Tagged union are generally confusing. 
            It is much easier to use EXPLICIT structures with a tag and data.
          
    ## Editor Functionality:
        Handles input/output operations, including reading from and writing to the terminal.
        Supports text manipulation features such as inserting, deleting, and navigating through text.
        Includes clipboard operations, marking lines, and easy motion for quick navigation.
        Provides functionality to fold and unfold sections of the text based on indentation.
        Supports saving and loading files, including external copying using a temporary file.
        Implements a macro recording and playback system for repetitive tasks.
        Provides support for commentary highlighting and setting various font styles for text. (in src)

    ## Noteworthy Features
        Easy Motion: A mode for quick navigation within the text using key shortcuts.
        Macro Recording: Allows recording sequences of key presses to be replayed later.
        Text Folding: Automatically folds sections of text based on indentation levels.
        Clipboard Integration: Supports external clipboard operations via a temporary file.
    
    ##   videos (not tutorials. deprecated. many keys remaped. But idea of navigating is showed...):
        https://www.youtube.com/watch?v=8sJJOQeyOTE
        https://www.youtube.com/watch?v=8qQlMbE8Zmw
        https://www.youtube.com/watch?v=51ao2416ioE&t=60s

    ##  main dev page: 
        https://chiselapp.com/user/sergey6661313/repository/ScalpiEditor/
            
    ##   Download src:
        select version:
        https://chiselapp.com/user/sergey6661313/repository/ScalpiEditor/timeline?advm=0&ms=exact&n=20&ss=x&t&udc=1&y=ci
        just click to hash-summ link about selected leaf
        find link to tar.gz and download it.
            
        or if you're lucky you can try just clone latest version: https://chiselapp.com/user/sergey6661313/repository/ScalpiEditor/info?name=tip
        $ fossil clone https://chiselapp.com/user/sergey6661313/repository/ScalpiEditor ScalpiEditor.fossil
        $ mkdir ScalpiEditor
        $ cd ScalpiEditor
        $ fossil open ../ScalpiEditor.fossil
    
    #### after compiling you may rename and copy binary to "~/bin/se" like this:
        $ cp ./zig-out/bin/a.out ~/bin/se
        
    #### and add this lines to config (".bashrc" file for bash) for easy use:
        export EDITOR="~/bin/se"
        export PATH="~/bin:$PATH"

##  FAQ:
    * pasta from system clipboard makes the text move apart
        try paste multiline text only in folded mode (ctrl+e)
    
    * copy to file not work
        copy to file copyid only cutted lines...
        first clear "cut" buffer with [Alt] + [z]
        then copy blocks with ctrl + c to "cut" buffer
        and then use [Alt]+[c]
    
    * Why did I refuse to parse the colon in the file name? 
        In the linux operating system, files with a colon in the name are often created.
    
    * Nothing work or crash on start
        Use only stable version (green commits).
        Use terminal only with monospaced fonts. crazy fonts giving crazy resaults.
    
    * Does not offer to save the file on exit.
        Idiot protection does not work, if the fool is used to pressing "y" on every programm.
    
    * Why i not support UTF? why  display only ansi symbols?
        just help me write this :))
    
    * no history
        partialy undo work - only for current line.
        the editor doesn't have to keep the whole history, it's a job for csv. 
        like fossil, git or any you want
        do not make many changes to the code at once.
        It's unhealthy.
    
    * how to open and close multiple files?
        just use multiple tabs in your terminal. (if terminal can this)
        or use multiple terminals (if you use graphical mode)
        or use any terminal multiplexer.
        and use [Alt]+[c] and [Alt]+[v] for copy paste
    
    * Mouse not work
        I use scroling for view terminal history.
        I don not ability to catch only buttons without catch scrolling.

##  to support me
    with boosty: 
        https://boosty.to/cutloosedev
    
    with monero:
        87T7 qGbA TrM3 a6Br
        DyeC jQQf NWtU u3iZ
        bHVB MC6W mEbN NE13
        Qrrt KhBb e4vF 58NR
        8PTF dYk2 Sozc HexX
        4Q69 jbdQ Asrs P7B

##  additional tips for linux:
    i use "sakura" terminal. There no work "ctrl+shift+left" key-sequence but other thing work norm.
    previously i try terminals: zutty, kitty, alacritty, Terminology - all good (not perfect) work.
    
    ## you may rename and copy binary to "~/bin/se" like this:
        cp ./ScalpiEditor.exe ~/bin/se

##  additional tips for windows:
    in windows i recommend use alacritty. it does not overload the system. but sometimes you have to use shift+ins instead of the usual ctrl+shift+v.
    
    ## you can try add folder with bin file to system path like this:
        
        ## temporaly:
            $env:path += ";$($pwd.Path)"
        
        ## temporally for your custom folder
            $env:path += ";C:\TopSecret\Bin"
        
        ## or
            $addPath = 'C:\TopSecret\Bin'
        
        ## or for not temporally:
            [Environment]::SetEnvironmentVariable("Path", $env:Path + ";$($pwd.Path)", "User")
            
##  list of bindings:
  warning! the operation of certain key combinations depends on the terminal and not on me.
  if key combination not work try alternative version of combination or use alternative terminal.
  (for reference: in some programs all key combinations work, 
  not because their code is correct, but because they use dirty hacks. 
  For example, they intercept the keyboard through root access. 
  Such programs need to be installed into the system, instead of just copying.
  I don't like installers - that won't happen in my text editor.)

  basic keys:
    help         [F1] 
    save         [Ctrl]  +  [s]
    exit         [Ctrl]  +  [q]
    fold/unfold  [Ctrl]  +  [e]
  
  navigation:
    use arrows for navigation 
    or Alt with w a s d 
    or Alt with h j k l
    
    enter block            [Tab]
    leave block            [Esc] 
    go to start of line    [Home] or  [Ctrl] + [Shift] + [Left]
    go to end   of line    [End]  or  [Ctrl] + [Shift] + [Right]
    go to first line       [Ctrl]  +  [Up]
    go to last  line       [Ctrl]  +  [Down]
    go to line from number [Ctrl]  +  [g]
    go to left   word      [Ctrl]  +  [Left]
    go to right  word      [Ctrl]  +  [Right]
    go to prev paragraph   [Alt] + [;]
    go to next paragraph   [Alt] + [']
  
    easy motion:
      horizontal:          [Alt]   +  [q]
      vertical:            [Alt]   +  [e]
    
  symbol interacting:
    insert as prev        [any symbol]
    delete prev           [BackSpace]
    delete next           [Del]
  
  lines/blocks interacting:
    split line             [Enter]
    join lines             [Ctrl]  +  [j]   // also sometimes [Ctrl] + [enter] work. and you can try [num_enter]
    move up                [Alt]   +  [Up]  // not work on some terminals...
    move down              [Alt]   +  [Down]
    move out current block [Alt]   +  [8]
    clear line             [Shift] +  [Del]
    duplicate              [Ctrl]  +  [d]
  
  word interactig:
    delete current word:               [ctrl]  +  [w]
    copy current word to find buffer:  [Alt]   +  [1]
  
  indents: // this keys not work in some terminals
    copy intervalls from up line   [f5]
    copy intervalls from down line [f6]
    move indent to left            [Alt] + [<]
    add indent                     [Alt] + [>]
  
  mark:
    mark                     [Alt]   +  [m]
    jump to mark             [Alt]   +  [g]
    move block outside mark  [Alt]   +  [o] (only in folded mode)
    move block inside mark   [Alt]   +  [9] (only in folded mode)
    move block before mark   [Alt]   +  [0]
  
  also there are 4 buffers:
    1) buffer for blocks/lines:
      cut                    [Ctrl]  +  [x]
      copy                   [Ctrl]  +  [c]
      paste                  [Ctrl]  +  [v]
      discard cutted/coppied [Alt]   +  [z]

    2) external buffer (file "clipboard.txt")
      copy                   [Alt]  +  [c]
      paste                  [Alt]  +  [v]

    3) using buffer for finding text:
      copy current word      [Alt]   +  [1]
      find prev:             [Alt]   +  [2]
      find next:             [Alt]   +  [3]
      paste                  [Alt]   +  [4]
      edit finding buffer    [Ctrl]  +  [f]
      
      for current block: (in folded mode find only in current level)
        find next            [Alt]   +  [8]
        find prev:           [Alt]   +  [7]
    
    4) buffer for replace text
      edit buffer:           [Alt]   +  [5]
      replace finded:        [Alt]   +  [6] // for replace need cursor placed on start of finding text
    
    5) buffer for macroses
      start record macro             [F1]
      stop record macro              [F2]
      play latest recorded macro     [F3]
