GithubHelp home page GithubHelp logo

azuline / nnn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jarun/nnn

0.0 0.0 0.0 6.61 MB

n³ The unorthodox terminal file manager

License: BSD 2-Clause "Simplified" License

Shell 29.81% C++ 1.47% Python 0.31% C 61.50% AppleScript 0.05% Makefile 3.02% Roff 3.32% Elvish 0.15% Nushell 0.10% Nix 0.27%

nnn's People

Contributors

0xace avatar akimdi avatar annagrram avatar anomalocaridid avatar ath3 avatar azuline avatar bruce-hill avatar cantoromc avatar darukutsu avatar hiltjo avatar jarun avatar juan-blog avatar klzxs avatar leovilok avatar lostd avatar luukvbaal avatar marioortizmanero avatar maxice8 avatar maximbaz avatar n-r-k avatar patrickf1 avatar pavel-fokin avatar rindeal avatar sjmulder avatar snide avatar szlin avatar tonijarjour avatar vaygr avatar wustho avatar zmwangx avatar

nnn's Issues

scratchpad

sorting debugging

notes on variables:

  • sorting is controlled by cfg.* globals, which is used in entrycmp to sort entries. the cfg.* globals are per-context.
  • cfgsort controls the sort config across multiple contexts
  • the cd variable is true whenever the directory changes? something like that... it's set to false in special cases prior to goto begin:

notes on special mechanics of cfgsort:

  • control flow: we go to savecurctx, which does some magic on cfgsort, and then we go to begin:, which does additional magic on cfgsort
  • cfgsort[CTX_MAX] is a carrier that sometimes transports the new context's state to begin: for that logic to act on it. when cfgsort[curctx] == '0', that means we want to use the carried sort and ignore any other logic. this occurs when we switch to a pre-existing context in an order != null environment.
    • note that \0 is also a default value for each cfgsort. so we hit this when a new session is created.
  • when cfgsort[curctx] == 'z', that means:
    1. we've switched to a new context, and the current context has no sort. z converts to c in begin:
    2. we've cd'ed into a directory that's in the order kv. the sort flags have been set, and the cfgsort is nullified (aka set to z) so that it isn't persistent.

bugged scenario:

  1. NNN_ORDER must be set.
    • cfgsort[0] = '0', cfg0.reverse = 0, entrycmpfn = &entrycmp
  2. set context 1 to r
    • cfgsort[0] = 'r', cfg0.reverse = 1, entrycmpfn = &reventrycmp
  3. create context 2. context 2 should also be r.
    • cfgsort[0] = 'r', cfgsort[1] = 'r', cfg0.reverse = 1, cfg1.reverse = 1, entrycmpfn = &reventrycmp
  4. unset r in context 2.
    • cfgsort[0] = 'r', cfgsort[1] = 'c', cfg0.reverse = 1, cfg1.reverse = 0, entrycmpfn = &entrycmp
  5. switch back to context 1. context 1 should not be r.
    • we hit the "skip ordering on open context carry logic". so we do not change anything
    • cfgsort[0] = 'r', cfgsort[1] = 'c', cfg0.reverse = 1, cfg1.reverse = 0, entrycmpfn = &entrycmp
  6. try to set r again. no-ops when it should op.
    • cfgsort[0] = 'r', cfgsort[1] = 'c', cfg0.reverse = 0, cfg1.reverse = 0, entrycmpfn = &entrycmp

root cause: &entrycmpfn is out of sync with cfg/cfgsort

soln: restore fn pointers when restoring cfg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.