Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor print logic #133

Merged
merged 5 commits into from
Jun 15, 2016
Merged

Refactor print logic #133

merged 5 commits into from
Jun 15, 2016

Commits on Jun 15, 2016

  1. Make match offsets disjoint

    The match offsets are set to 0 if no match is found. But 0 is also a
    valid offset. Therefore, make a existing and non-existing match disjoint
    by using -1 as a indicator for a missing match.
    mptre committed Jun 15, 2016
    Configuration menu
    Copy the full SHA
    7b82daa View commit details
    Browse the repository at this point in the history
  2. Consolidate output loop

    Also, inline counting of ANSI escape sequences for two reasons:
    
    - Performing the count while processing the input could cause incorrect
      behavior if a line is longer than the number of columns and contains
      ANSI escape sequences at a offset greater than the number of columns.
      This could be solved by only examining `MIN(columns, choice->length)`
      bytes, but it could also cause problems explained below.
    
    - Simplifies future handling of SIGWINCH since any re-calculation of the
      number of ANSI escape sequences is no longer needed.
    mptre committed Jun 15, 2016
    Configuration menu
    Copy the full SHA
    852323f View commit details
    Browse the repository at this point in the history
  3. Consolidate printing of choices

    In a attempt to solve #131.
    mptre committed Jun 15, 2016
    Configuration menu
    Copy the full SHA
    42999b1 View commit details
    Browse the repository at this point in the history
  4. Extract common logic into print_line

    Since printing the query and choices are similar.
    mptre committed Jun 15, 2016
    Configuration menu
    Copy the full SHA
    4feddcb View commit details
    Browse the repository at this point in the history
  5. Don't mix declarations and initializers

    - Declarations comes first, in alphabetical order.
    
    - Initializers comes second, one per line, in alphabetical order.
    mptre committed Jun 15, 2016
    Configuration menu
    Copy the full SHA
    9f4d257 View commit details
    Browse the repository at this point in the history